typedef struct rand_pool {
octet pool[RAND_POOLSZ]; /* Actual contents of the pool */
- unsigned i; /* Current index into pool */
- unsigned irot; /* Current rotation applied */
+ unsigned gen; /* Generation number */
+ unsigned short i; /* Current index into pool */
+ unsigned short irot; /* Current rotation applied */
unsigned ibits; /* Number of good bits in pool */
octet buf[RAND_BUFSZ]; /* Random octet output buffer */
unsigned o; /* Current index into buffer */
extern void rand_init(rand_pool */*r*/);
+/* --- @rand_generation@ --- *
+ *
+ * Arguments: ---
+ *
+ * Returns: A nonzero generation number.
+ *
+ * Use: Returns a generation number for the current process. Each
+ * pool has its own number. If this matches the process number
+ * then all is well. If it doesn't match, then the pool needs
+ * to be cleaned before its next use.
+ */
+
+extern unsigned rand_generation(void);
+
/* --- @rand_noisesrc@ --- *
*
* Arguments: @rand_pool *r@ = pointer to a randomness pool
extern void rand_key(rand_pool */*r*/, const void */*k*/, size_t /*sz*/);
+/* --- @rand_quick@ --- *
+ *
+ * Arguments: @rand_pool *r@ = pointer to a randomness pool
+ *
+ * Returns: Zero on success; @-1@ on failure.
+ *
+ * Use Attempts to use some machine-specific `quick' source of
+ * entropy to top up @r@. This may not do anything at all on
+ * many systems.
+ */
+
+extern int rand_quick(rand_pool */*r*/);
+
/* --- @rand_add@ --- *
*
* Arguments: @rand_pool *r@ = pointer to a randomness pool