diff options
author | Mark Murray <markm@FreeBSD.org> | 2013-08-30 17:47:53 +0000 |
---|---|---|
committer | Mark Murray <markm@FreeBSD.org> | 2013-08-30 17:47:53 +0000 |
commit | 7737ec4198800562e2c6d46d6b8a15ce5282058c (patch) | |
tree | c8d40704b01d7542228da0a1d639c1cb2860e30f /sys/dev/random | |
parent | 77de2c3f58b5289827d4674b837ed805c27797f8 (diff) | |
download | src-7737ec4198800562e2c6d46d6b8a15ce5282058c.tar.gz src-7737ec4198800562e2c6d46d6b8a15ce5282058c.zip |
Remove short-lived idea; thread to harvest (eg) RDRAND enropy into the usual harvest queues. It was a nifty idea, but too heavyweight.
Submitted by: Arthur Mesh <arthurmesh@gmail.com>
Notes
Notes:
svn path=/projects/random_number_generator/; revision=255075
Diffstat (limited to 'sys/dev/random')
-rw-r--r-- | sys/dev/random/random_adaptors.c | 71 | ||||
-rw-r--r-- | sys/dev/random/random_adaptors.h | 2 |
2 files changed, 0 insertions, 73 deletions
diff --git a/sys/dev/random/random_adaptors.c b/sys/dev/random/random_adaptors.c index b017993c1ecc..f6a21f6e08f4 100644 --- a/sys/dev/random/random_adaptors.c +++ b/sys/dev/random/random_adaptors.c @@ -55,11 +55,6 @@ static struct sysctl_ctx_list random_clist; MALLOC_DEFINE(M_RANDOM_ADAPTORS, "random_adaptors", "Random adaptors buffers"); -struct entropy_thread_ctx { - struct random_adaptor *adaptor; - int *control; -}; - int random_adaptor_register(const char *name, struct random_adaptor *rsp) { @@ -186,72 +181,6 @@ random_adaptor_choose(struct random_adaptor **adaptor) } static void -random_proc(void *arg) -{ - struct entropy_thread_ctx *ctx; - u_char randomness[HARVESTSIZE]; - int i; - - ctx = (struct entropy_thread_ctx *)arg; - - /* Sanity check. */ - if (ctx->adaptor == NULL || ctx->adaptor->read == NULL) - return; - - for (; *ctx->control == 0;) { - i = ctx->adaptor->read(randomness, sizeof(randomness)); - - if (i > 0) - /* Be very conservative with entropy estimation here. */ - random_harvest(randomness, i, 0, 0, RANDOM_PURE); - - /* Wake up every 10 secs. */ - tsleep_sbt(ctx->adaptor, PWAIT | PCATCH, "-", SBT_1M / 6, 0, 0); - } - - printf("<%s> entropy source is exiting\n", ctx->adaptor->ident); - free(ctx, M_RANDOM_ADAPTORS); - kproc_exit(0); -} - -/* - * Use RNG's output as an entropy source for another RNG. i.e.: - * +--------+ +--------+ - * | Intel | | Yarrow | - * | RDRAND +--------->| | - * +--------+ +--------+ - * Very useful for seeding software RNGs with output of - * Hardware RNGs like Intel's RdRand and VIA's Padlock. - * - * Returns a handle to the newly created kernel process. - */ -void * -random_adaptor_use_as_entropy(const char *id, struct random_adaptor *adaptor, - int *control) -{ - int error; - struct proc *random_chain_proc; - struct entropy_thread_ctx *ctx; - - KASSERT(adaptor != NULL, ("can't obtain randomness")); - KASSERT(control != NULL, ("can't control entropy process")); - - ctx = malloc(sizeof(struct entropy_thread_ctx), M_RANDOM_ADAPTORS, - M_WAITOK); - - ctx->control = control; - ctx->adaptor = adaptor; - - /* Start the thread */ - error = kproc_create(random_proc, ctx, &random_chain_proc, RFHIGHPID, - 0, "%s_entropy", id); - if (error != 0) - panic("Cannot create rng chaining thread"); - - return random_chain_proc; -} - -static void random_adaptors_deinit(void *unused) { diff --git a/sys/dev/random/random_adaptors.h b/sys/dev/random/random_adaptors.h index b3038e750620..98f8c2ebe273 100644 --- a/sys/dev/random/random_adaptors.h +++ b/sys/dev/random/random_adaptors.h @@ -40,8 +40,6 @@ struct random_adaptors { struct random_adaptor *random_adaptor_get(const char *); int random_adaptor_register(const char *, struct random_adaptor *); void random_adaptor_choose(struct random_adaptor **); -void *random_adaptor_use_as_entropy(const char *, struct random_adaptor *, - int *); /* * random_adaptor's should be registered prior to |