Give generic random objects separate namespaces for their supported misc
authormdw <mdw>
Sat, 3 Feb 2001 16:08:56 +0000 (16:08 +0000)
committermdw <mdw>
Sat, 3 Feb 2001 16:08:56 +0000 (16:08 +0000)
ops.  Add operations for reading the current seed value.

dsarand.c
dsarand.h

index 146a20f..4f12b98 100644 (file)
--- a/dsarand.c
+++ b/dsarand.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: dsarand.c,v 1.2 2000/06/17 10:54:00 mdw Exp $
+ * $Id: dsarand.c,v 1.3 2001/02/03 16:08:56 mdw Exp $
  *
  * Random number generator for DSA
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dsarand.c,v $
+ * Revision 1.3  2001/02/03 16:08:56  mdw
+ * Give generic random objects separate namespaces for their supported misc
+ * ops.  Add operations for reading the current seed value.
+ *
  * Revision 1.2  2000/06/17 10:54:00  mdw
  * Typesetting fixes.  Arena support.
  *
@@ -277,6 +281,8 @@ static int gmisc(grand *r, unsigned op, ...)
        case GRAND_SEEDBLOCK:
        case GRAND_SEEDRAND:
        case DSARAND_PASSES:
+       case DSARAND_SEEDSZ:
+       case DSARAND_GETSEED:
          rc = 1;
          break;
        default:
@@ -296,6 +302,12 @@ static int gmisc(grand *r, unsigned op, ...)
     case DSARAND_PASSES:
       g->d.passes = va_arg(ap, unsigned);
       break;
+    case DSARAND_SEEDSZ:
+      rc = g->d.sz;
+      break;
+    case DSARAND_GETSEED:
+      memcpy(va_arg(ap, void *), g->d.p, g->d.sz);
+      break;
     default:
       GRAND_BADOP;
       break;
index 131d31b..4d36d6d 100644 (file)
--- a/dsarand.h
+++ b/dsarand.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: dsarand.h,v 1.2 2000/06/17 10:54:14 mdw Exp $
+ * $Id: dsarand.h,v 1.3 2001/02/03 16:08:56 mdw Exp $
  *
  * Random number generator for DSA
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dsarand.h,v $
+ * Revision 1.3  2001/02/03 16:08:56  mdw
+ * Give generic random objects separate namespaces for their supported misc
+ * ops.  Add operations for reading the current seed value.
+ *
  * Revision 1.2  2000/06/17 10:54:14  mdw
  * Typesetting fixes.
  *
@@ -138,7 +142,9 @@ extern void dsarand_fill(dsarand */*d*/, void */*p*/, size_t /*sz*/);
 /* --- Miscellaneous operations --- */
 
 enum {
-  DSARAND_PASSES = GRAND_SPECIFIC
+  DSARAND_PASSES = GRAND_SPECIFIC('D'),        /* @unsigned n@ */
+  DSARAND_SEEDSZ,                      /* No args */
+  DSARAND_GETSEED                      /* @void *buf@ */
 };
 
 /* --- @dsarand_create@ --- *
@@ -148,8 +154,7 @@ enum {
  *
  * Returns:    Pointer to a generic generator.
  *
- * Use:                Constructs a generic generator interface over a Catacomb
- *             entropy pool generator.
+ * Use:                Constructs a generic generator interface to a DSA generator.
  */
 
 extern grand *dsarand_create(const void */*p*/, size_t /*sz*/);