Uprating of the passphrase pixie.
[u/mdw/catacomb] / grand.h
diff --git a/grand.h b/grand.h
index 54083d2..0446b2b 100644 (file)
--- a/grand.h
+++ b/grand.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: grand.h,v 1.2 2000/06/17 11:23:11 mdw Exp $
+ * $Id: grand.h,v 1.5 2004/04/08 01:36:15 mdw Exp $
  *
  * Generic interface to random number generators
  *
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: grand.h,v $
- * Revision 1.2  2000/06/17 11:23:11  mdw
- * Typesetting fix.  Add a flags word to the generic generator.
- *
- * Revision 1.1  1999/12/10 23:16:01  mdw
- * Generic interface.
- *
- */
-
 #ifndef CATACOMB_GRAND_H
 #define CATACOMB_GRAND_H
 
@@ -85,11 +74,15 @@ typedef struct grand_ops {
   void (*fill)(grand */*r*/, void */*p*/, size_t /*sz*/); /* Fill buffer */
 } grand_ops;
 
+#define GR_DESTROY(r)          (r)->ops->destroy((r))
+#define GR_RAW(r)              (r)->ops->raw((r))
+#define GR_WORD(r)             (r)->ops->word((r))
+#define GR_RANGE(r, l)         (r)->ops->range((r), (l))
+#define GR_FILL(r, p, sz)      (r)->ops->fill((r), (p), (sz))
+
 /* --- Flag types --- */
 
-enum {
-  GRAND_CRYPTO = 1u                    /* Cryptographically strong */
-};
+#define GRAND_CRYPTO 1u                        /* Cryptographically strong */
 
 /* --- Operation types --- */
 
@@ -105,11 +98,11 @@ enum {
   GRAND_SEEDUINT32,                    /* @uint32 i@ */
   GRAND_SEEDBLOCK,                     /* @const void *p, size_t sz@ */
   GRAND_SEEDMP,                                /* @mp *m@ */
-  GRAND_SEEDRAND,                      /* @grand *g@ */
+  GRAND_SEEDRAND                       /* @grand *g@ */
 
   /* --- Generator-specific operations --- */
 
-  GRAND_SPECIFIC = 256u
+#define GRAND_SPECIFIC(ch) ((unsigned)(ch) << 8) 
 };
 
 #define GRAND_BADOP assert(((void)"bad grand_misc op", 0))