/* -*-c-*-
*
- * $Id: grand.h,v 1.4 2001/04/19 18:23:53 mdw Exp $
+ * $Id: grand.h,v 1.5 2004/04/08 01:36:15 mdw Exp $
*
* Generic interface to random number generators
*
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: grand.h,v $
- * Revision 1.4 2001/04/19 18:23:53 mdw
- * Use unsigned integer rather than enum for flags.
- *
- * Revision 1.3 2001/02/03 16:07:33 mdw
- * Give generic random objects separate namespaces for their supported misc
- * ops.
- *
- * 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
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 --- */
#define GRAND_CRYPTO 1u /* Cryptographically strong */
/* --- Generator-specific operations --- */
-#define GRAND_SPECIFIC(ch) ((unsigned)(ch) << 8)
+#define GRAND_SPECIFIC(ch) ((unsigned)(ch) << 8)
};
#define GRAND_BADOP assert(((void)"bad grand_misc op", 0))