rand/rand.[ch]: Spring-clean the random source cryptography.
[catacomb] / rand / rand.h
index 389526d..3c2fa73 100644 (file)
@@ -87,7 +87,8 @@
 
 #define RAND_POOLSZ 128                        /* Input pool size in bytes */
 #define RAND_BUFSZ 512                 /* Output buffer size in bytes */
-#define RAND_SECSZ 20                  /* Secret octets in output buffer */
+#define RAND_SECSZ 32                  /* Secret octets in output buffer */
+#define RAND_KEYSZ 32                  /* Recommended random key size */
 
 #define RAND_IBITS (RAND_POOLSZ * 8)
 #define RAND_OBITS (RAND_BUFSZ * 8)
@@ -104,7 +105,7 @@ typedef struct rand_pool {
   octet buf[RAND_BUFSZ];               /* Random octet output buffer */
   unsigned o;                          /* Current index into buffer */
   unsigned obits;                      /* Number of good bits in buffer */
-  rmd160_mackey k;                     /* Secret key for this pool */
+  union { octet k[RAND_KEYSZ]; rmd160_mackey _; } k; /* Key for the pool */
   const struct rand_source *s;         /* System-specific noise source */
 } rand_pool;