From 838a6a51785f045ea6bdf6cf3eb70e3ac3d1930c Mon Sep 17 00:00:00 2001 From: mdw Date: Sat, 5 Mar 2005 16:48:24 +0000 Subject: [PATCH] Provide some more useful functions via the miscop interface. --- rand.c | 10 +++++++++- rand.h | 6 ++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/rand.c b/rand.c index 827474b..c50e10a 100644 --- a/rand.c +++ b/rand.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: rand.c,v 1.6 2004/04/08 01:36:15 mdw Exp $ + * $Id$ * * Secure random number generator * @@ -464,6 +464,8 @@ static int gmisc(grand *r, unsigned op, ...) case RAND_KEY: case RAND_NOISESRC: case RAND_SEED: + case RAND_TIMER: + case RAND_GOODBITS: rc = 1; break; default: @@ -507,6 +509,12 @@ static int gmisc(grand *r, unsigned op, ...) case RAND_SEED: rand_seed(&g->p, va_arg(ap, unsigned)); break; + case RAND_TIMER: + TIMER(&g->p); + break; + case RAND_GOODBITS: + rc = rand_goodbits(&g->p); + break; default: GRAND_BADOP; break; diff --git a/rand.h b/rand.h index fc6247b..22f0188 100644 --- a/rand.h +++ b/rand.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: rand.h,v 1.9 2004/04/08 01:36:15 mdw Exp $ + * $Id$ * * Secure random number generator * @@ -283,7 +283,9 @@ enum { RAND_STRETCH, /* No args */ RAND_KEY, /* @const void *k, size_t sz@ */ RAND_NOISESRC, /* @const rand_source *s@ */ - RAND_SEED /* @unsigned bits@ */ + RAND_SEED, /* @unsigned bits@ */ + RAND_TIMER, /* No args */ + RAND_GOODBITS /* No args */ }; /* --- Default random number generator --- */ -- 2.11.0