aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/random/other_algorithm.c
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2019-12-26 19:32:11 +0000
committerConrad Meyer <cem@FreeBSD.org>2019-12-26 19:32:11 +0000
commit3ee1d5bb9dc2db929b19ca59421d197153dbdc08 (patch)
tree77b0983d76aeae4b202ee38a76066a33518433d2 /sys/dev/random/other_algorithm.c
parentaf00898b5d7bac6734c407c1d2f4362a08fe4532 (diff)
Notes
Diffstat (limited to 'sys/dev/random/other_algorithm.c')
-rw-r--r--sys/dev/random/other_algorithm.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/sys/dev/random/other_algorithm.c b/sys/dev/random/other_algorithm.c
index 4ed00c1156ff..b74d2ab6b860 100644
--- a/sys/dev/random/other_algorithm.c
+++ b/sys/dev/random/other_algorithm.c
@@ -87,8 +87,6 @@ static void random_other_pre_read(void);
static void random_other_read(uint8_t *, size_t);
static bool random_other_seeded(void);
static void random_other_process_event(struct harvest_event *);
-static void random_other_init_alg(void *);
-static void random_other_deinit_alg(void *);
/*
* RANDOM_OTHER_NPOOLS is used when reading hardware random
@@ -97,10 +95,11 @@ static void random_other_deinit_alg(void *);
*/
#define RANDOM_OTHER_NPOOLS 1
-struct random_algorithm random_alg_context = {
+#ifdef RANDOM_LOADABLE
+static
+#endif
+const struct random_algorithm random_alg_context = {
.ra_ident = "other",
- .ra_init_alg = random_other_init_alg,
- .ra_deinit_alg = random_other_deinit_alg,
.ra_pre_read = random_other_pre_read,
.ra_read = random_other_read,
.ra_seeded = random_other_seeded,
@@ -112,34 +111,20 @@ struct random_algorithm random_alg_context = {
static mtx_t other_mtx;
/*
- * void random_other_init_alg(void *unused __unused)
- *
* Do algorithm-specific initialisation here.
*/
-void
+static void
random_other_init_alg(void *unused __unused)
{
- RANDOM_RESEED_INIT_LOCK();
- /*
- * Do set-up work here!
- */
-}
+#ifdef RANDOM_LOADABLE
+ p_random_alg_context = &random_alg_context;
+#endif
-/*
- * void random_other_deinit_alg(void *unused __unused)
- *
- * Do algorithm-specific deinitialisation here.
- */
-static void
-random_other_deinit_alg(void *unused __unused)
-{
-
- /*
- * Do tear-down work here!
- */
- RANDOM_RESEED_DEINIT_LOCK();
+ RANDOM_RESEED_INIT_LOCK();
}
+SYSINIT(random_alg, SI_SUB_RANDOM, SI_ORDER_SECOND, random_other_init_alg,
+ NULL);
/*
* void random_other_pre_read(void)