X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/21c9a0ff462ba8cb1769b8ceb4277c8d99f56bf8..b817bfc642225b8c3c0b6a7e42d1fb949b61a606:/rand.h diff --git a/rand.h b/rand.h index 2f23440..fc6247b 100644 --- a/rand.h +++ b/rand.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: rand.h,v 1.5 1999/12/13 15:34:15 mdw Exp $ + * $Id: rand.h,v 1.9 2004/04/08 01:36:15 mdw Exp $ * * Secure random number generator * @@ -27,26 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: rand.h,v $ - * Revision 1.5 1999/12/13 15:34:15 mdw - * Fix a typo. - * - * Revision 1.4 1999/12/10 23:29:48 mdw - * Change header file guard names. - * - * Revision 1.3 1999/10/15 21:04:30 mdw - * Increase output buffer a bit for performance. - * - * Revision 1.2 1999/10/12 21:00:15 mdw - * Make pool and buffer sizes more sensible. - * - * Revision 1.1 1999/09/03 08:41:12 mdw - * Initial import. - * - */ - /*----- Notes on the random number generator ------------------------------* * * The algorithm is one of the author's own devising. It may therefore be @@ -172,6 +152,21 @@ extern void rand_init(rand_pool */*r*/); extern void rand_noisesrc(rand_pool */*r*/, const rand_source */*s*/); +/* --- @rand_seed@ --- * + * + * Arguments: @rand_pool *r@ = pointer to a randomness pool + * @unsigned bits@ = number of bits to ensure + * + * Returns: --- + * + * Use: Ensures that there are at least @bits@ good bits of entropy + * in the pool. It is recommended that you call this after + * initializing a new pool. Requesting @bits > RAND_IBITS@ is + * doomed to failure (and is an error). + */ + +extern void rand_seed(rand_pool */*r*/, unsigned /*bits*/); + /* --- @rand_key@ --- * * * Arguments: @rand_pool *r@ = pointer to a randomness pool @@ -284,10 +279,11 @@ extern void rand_getgood(rand_pool */*r*/, void */*p*/, size_t /*sz*/); /* --- Miscellaneous operations --- */ enum { - RAND_GATE = GRAND_SPECIFIC, /* No args */ + RAND_GATE = GRAND_SPECIFIC('R'), /* No args */ RAND_STRETCH, /* No args */ RAND_KEY, /* @const void *k, size_t sz@ */ - RAND_NOISESRC /* @const rand_source *s@ */ + RAND_NOISESRC, /* @const rand_source *s@ */ + RAND_SEED /* @unsigned bits@ */ }; /* --- Default random number generator --- */