diff options
author | markm <markm@FreeBSD.org> | 2013-08-26 18:29:51 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2013-08-26 18:29:51 +0000 |
commit | e007bbae78703d83fd29b3ba2507dfcac7e45b44 (patch) | |
tree | c6b9fa1a072b3a044fc794152e9ae4ec68733c7d /sys/dev/random/randomdev_soft.h | |
parent | bd5fc148c56b178ea549ad2e722738a8d6d81503 (diff) | |
download | FreeBSD-src-e007bbae78703d83fd29b3ba2507dfcac7e45b44.zip FreeBSD-src-e007bbae78703d83fd29b3ba2507dfcac7e45b44.tar.gz |
Snapshot of current work;
1) Clean up namespace; only use "Yarrow" where it is Yarrow-specific
or close enough to the Yarrow algorithm. For the rest use a neutral
name.
2) Tidy up headers; put private stuff in private places. More could
be done here.
3) Streamline the hashing/encryption; no need for a 256-bit counter;
128 bits will last for long enough.
There are bits of debug code lying around; these will be removed
at a later stage.
Diffstat (limited to 'sys/dev/random/randomdev_soft.h')
-rw-r--r-- | sys/dev/random/randomdev_soft.h | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/sys/dev/random/randomdev_soft.h b/sys/dev/random/randomdev_soft.h index 2007694..c92a5a8 100644 --- a/sys/dev/random/randomdev_soft.h +++ b/sys/dev/random/randomdev_soft.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000-2004 Mark R V Murray + * Copyright (c) 2000-2013 Mark R V Murray * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,9 +35,6 @@ * an enum in sys/random.h */ -/* Cryptographic block size in bits */ -#define BLOCKSIZE 256 - /* The ring size _MUST_ be a power of 2 */ #define HARVEST_RING_SIZE 1024 /* harvest ring buffer size */ #define HARVEST_RING_MASK (HARVEST_RING_SIZE - 1) @@ -51,34 +48,28 @@ MALLOC_DECLARE(M_ENTROPY); */ struct harvest { uintmax_t somecounter; /* fast counter for clock jitter */ - u_char entropy[HARVESTSIZE]; /* the harvested entropy */ + uint8_t entropy[HARVESTSIZE]; /* the harvested entropy */ u_int size, bits, frac; /* stats about the entropy */ enum esource source; /* stats about the entropy */ STAILQ_ENTRY(harvest) next; /* next item on the list */ }; -void random_yarrow_init(void); -void random_yarrow_deinit(void); +void randomdev_init(void); +void randomdev_deinit(void); -int random_yarrow_read(void *, int); -void random_yarrow_write(void *, int); +void randomdev_write(void *, int); -void random_yarrow_init_harvester(void (*)(u_int64_t, const void *, u_int, +void randomdev_init_harvester(void (*)(u_int64_t, const void *, u_int, u_int, u_int, enum esource), int (*)(void *, int)); -void random_yarrow_deinit_harvester(void); +void randomdev_deinit_harvester(void); void random_set_wakeup_exit(void *); void random_process_event(struct harvest *event); -void random_yarrow_reseed(void); -void random_yarrow_unblock(void); - -void random_yarrow_init_alg(struct sysctl_ctx_list *); -void random_yarrow_deinit_alg(void); +void randomdev_unblock(void); -extern struct random_adaptor random_yarrow; extern struct mtx random_reseed_mtx; -/* If this was c++, this would be a template */ +/* If this was C++, the macro below would be a template */ #define RANDOM_CHECK_UINT(name, min, max) \ static int \ random_check_uint_##name(SYSCTL_HANDLER_ARGS) \ |