FIPS 140-1 random generator test.
[u/mdw/catacomb] / fipstest.h
diff --git a/fipstest.h b/fipstest.h
new file mode 100644 (file)
index 0000000..c267876
--- /dev/null
@@ -0,0 +1,81 @@
+/* -*-c-*-
+ *
+ * $Id: fipstest.h,v 1.1 2000/06/17 10:55:38 mdw Exp $
+ *
+ * FIPS 140-1 randomness tests
+ *
+ * (c) 2000 Straylight/Edgeware
+ */
+
+/*----- Licensing notice --------------------------------------------------* 
+ *
+ * This file is part of Catacomb.
+ *
+ * Catacomb is free software; you can redistribute it and/or modify
+ * 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: fipstest.h,v $
+ * Revision 1.1  2000/06/17 10:55:38  mdw
+ * FIPS 140-1 random generator test.
+ *
+ */
+
+#ifndef CATACOMB_FIPSTEST_H
+#define CATACOMB_FIPSTEST_H
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+/*----- Header files ------------------------------------------------------*/
+
+#include <mLib/bits.h>
+
+/*----- Magic numbers -----------------------------------------------------*/
+
+#define FIPSTEST_BUFSZ 2500
+
+enum {
+  FIPSTEST_OK = 0,
+  FIPSTEST_MONOBIT = 1,
+  FIPSTEST_POKER = 2,
+  FIPSTEST_RUNS = 4,
+  FIPSTEST_LONGRUNS = 8
+};
+
+/*----- Functions provided ------------------------------------------------*/
+
+/* --- @fipstest@ --- *
+ *
+ * Arguments:  @const octet *p@ = pointer to a buffer of @FIPSTEST_BUFSZ@
+ *                     bytes
+ *
+ * Returns:    Zero if OK, or a bitmask of failed tests.
+ *
+ * Use:                Performs the FIPS 140-1 randomness tests on a block of data.
+ */
+
+extern unsigned fipstest(const octet */*p*/);
+
+/*----- That's all, folks -------------------------------------------------*/
+
+#ifdef __cplusplus
+  }
+#endif
+
+#endif