Provide some more useful functions via the miscop interface.
authormdw <mdw>
Sat, 5 Mar 2005 16:48:24 +0000 (16:48 +0000)
committermdw <mdw>
Sat, 5 Mar 2005 16:48:24 +0000 (16:48 +0000)
rand.c
rand.h

diff --git a/rand.c b/rand.c
index 827474b..c50e10a 100644 (file)
--- 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 (file)
--- 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 --- */