Major memory management overhaul. Added arena support. Use the secure
[u/mdw/catacomb] / ofb-def.h
index 2d0fc94..20be645 100644 (file)
--- a/ofb-def.h
+++ b/ofb-def.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: ofb-def.h,v 1.1 1999/12/10 23:16:40 mdw Exp $
+ * $Id: ofb-def.h,v 1.2 1999/12/13 15:34:01 mdw Exp $
  *
  * Definitions for output feedback mode
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: ofb-def.h,v $
+ * Revision 1.2  1999/12/13 15:34:01  mdw
+ * Add support for seeding from a generic pseudorandom source.
+ *
  * Revision 1.1  1999/12/10 23:16:40  mdw
  * Split mode macros into interface and implementation.
  *
@@ -344,6 +347,7 @@ static int grmisc(grand *r, unsigned op, ...)                               \
        case GRAND_SEEDINT:                                             \
        case GRAND_SEEDUINT32:                                          \
        case GRAND_SEEDBLOCK:                                           \
+       case GRAND_SEEDRAND:                                            \
          rc = 1;                                                       \
          break;                                                        \
        default:                                                        \
@@ -371,6 +375,14 @@ static int grmisc(grand *r, unsigned op, ...)                              \
       }                                                                        \
       pre##_ofbsetiv(&g->k, p);                                                \
     } break;                                                           \
+    case GRAND_SEEDRAND: {                                             \
+      grand *rr = va_arg(ap, grand *);                                 \
+      rr->ops->fill(rr, buf, sizeof(buf));                             \
+      pre##_ofbsetiv(&g->k, buf);                                      \
+    } break;                                                           \
+    default:                                                           \
+      GRAND_BADOP;                                                     \
+      break;                                                           \
   }                                                                    \
                                                                        \
   va_end(ap);                                                          \