Change header file guard names.
authormdw <mdw>
Fri, 10 Dec 1999 23:30:08 +0000 (23:30 +0000)
committermdw <mdw>
Fri, 10 Dec 1999 23:30:08 +0000 (23:30 +0000)
25 files changed:
acconfig.h
bf_ikey.h
blkc.h
blowfish.h
daftstory.h
des-base.h
des.h
des3.h
dh.h
dsa.h
idea.h
key.h
mpalloc.h
mpmont.h
mpscan.h
mptext.h
mptypes.c
mpw.h
noise.h
paranoia.h
pgen.h
rabin.c
rabin.h
rand.h
rc5.h

index b8e2eb5..8de2795 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: acconfig.h,v 1.1 1999/09/03 08:41:11 mdw Exp $
+ * $Id: acconfig.h,v 1.2 1999/12/10 23:30:08 mdw Exp $
  *
  * Configuration header for Catacomb
  *
  *
  * Configuration header for Catacomb
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: acconfig.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: acconfig.h,v $
+ * Revision 1.2  1999/12/10 23:30:08  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
-#ifndef ACCONFIG_H
-#define ACCONFIG_H
+#ifndef CATACOMB_ACCONFIG_H
+#define CATACOMB_ACCONFIG_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
index 9d602fb..c0ac92c 100644 (file)
--- a/bf_ikey.h
+++ b/bf_ikey.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: bf_ikey.h,v 1.1 1999/09/03 08:41:11 mdw Exp $
+ * $Id: bf_ikey.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Blowfish initial key data
  *
  *
  * Blowfish initial key data
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: bf_ikey.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: bf_ikey.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
-#ifndef BF_IKEY_H
-#define BF_IKEY_H
+#ifndef CATACOMB_BF_IKEY_H
+#define CATACOMB_BF_IKEY_H
 
 /*----- Macros ------------------------------------------------------------*/
 
 
 /*----- Macros ------------------------------------------------------------*/
 
diff --git a/blkc.h b/blkc.h
index e7f5518..fcd31dd 100644 (file)
--- a/blkc.h
+++ b/blkc.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: blkc.h,v 1.1 1999/09/03 08:41:11 mdw Exp $
+ * $Id: blkc.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Common definitions for block ciphers
  *
  *
  * Common definitions for block ciphers
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: blkc.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: blkc.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
-#ifndef BLKC_H
-#define BLKC_H
+#ifndef CATACOMB_BLKC_H
+#define CATACOMB_BLKC_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
@@ -70,9 +73,9 @@
 #define BLKC_FIRST(x, y, z) x
 #define BLKC_SECOND(x, y, z) y
 #define BLKC_THIRD(x, y, z) z
 #define BLKC_FIRST(x, y, z) x
 #define BLKC_SECOND(x, y, z) y
 #define BLKC_THIRD(x, y, z) z
-#define BLKC_TYPE(PRE) BLKC_APPLY(BLKC_FIRST, PRE ## _CLASS)
-#define BLKC_ENDIAN(PRE) BLKC_APPLY(BLKC_SECOND, PRE ## _CLASS)
-#define BLKC_BITS(PRE) BLKC_APPLY(BLKC_THIRD, PRE ## _CLASS)
+#define BLKC_TYPE(PRE) BLKC_APPLY(BLKC_FIRST, PRE##_CLASS)
+#define BLKC_ENDIAN(PRE) BLKC_APPLY(BLKC_SECOND, PRE##_CLASS)
+#define BLKC_BITS(PRE) BLKC_APPLY(BLKC_THIRD, PRE##_CLASS)
 
 #define BLKC_STORE_E(PRE) BLKC_GLUE(STORE32_, BLKC_ENDIAN(PRE))
 #define BLKC_LOAD_E(PRE) BLKC_GLUE(LOAD32_, BLKC_ENDIAN(PRE))
 
 #define BLKC_STORE_E(PRE) BLKC_GLUE(STORE32_, BLKC_ENDIAN(PRE))
 #define BLKC_LOAD_E(PRE) BLKC_GLUE(LOAD32_, BLKC_ENDIAN(PRE))
 
 #define BLKC_SKEL_X(PRE, decl, guts)                                   \
   BLKC_SKEL(PRE, int _i; decl,                                         \
 
 #define BLKC_SKEL_X(PRE, decl, guts)                                   \
   BLKC_SKEL(PRE, int _i; decl,                                         \
-           for (_i = 0; _i < PRE ## _BLKSZ / 4; _i++) {                \
+           for (_i = 0; _i < PRE##_BLKSZ / 4; _i++) {                  \
              guts                                                      \
            })
 
              guts                                                      \
            })
 
                                                                        \
 static int verify(dstr *v)                                             \
 {                                                                      \
                                                                        \
 static int verify(dstr *v)                                             \
 {                                                                      \
-  pre ## _ctx k;                                                       \
-  uint32 p[PRE ## _BLKSZ / 4];                                         \
-  uint32 c[PRE ## _BLKSZ / 4];                                         \
-  uint32 d[PRE ## _BLKSZ / 4];                                         \
+  pre##_ctx k;                                                         \
+  uint32 p[PRE##_BLKSZ / 4];                                           \
+  uint32 c[PRE##_BLKSZ / 4];                                           \
+  uint32 d[PRE##_BLKSZ / 4];                                           \
   dstr b = DSTR_INIT;                                                  \
   int ok = 1;                                                          \
                                                                        \
   /* --- Initialize the key buffer --- */                              \
                                                                        \
   dstr b = DSTR_INIT;                                                  \
   int ok = 1;                                                          \
                                                                        \
   /* --- Initialize the key buffer --- */                              \
                                                                        \
-  dstr_ensure(&b, PRE ## _BLKSZ);                                      \
-  b.len = PRE ## _BLKSZ;                                               \
-  pre ## _init(&k, v[0].buf, v[0].len);                                        \
+  dstr_ensure(&b, PRE##_BLKSZ);                                                \
+  b.len = PRE##_BLKSZ;                                                 \
+  pre##_init(&k, v[0].buf, v[0].len);                                  \
   BLKC_LOAD(PRE, p, v[1].buf);                                         \
   BLKC_LOAD(PRE, c, v[2].buf);                                         \
                                                                        \
   /* --- Test encryption --- */                                                \
                                                                        \
   BLKC_MOVE(PRE, d, p);                                                        \
   BLKC_LOAD(PRE, p, v[1].buf);                                         \
   BLKC_LOAD(PRE, c, v[2].buf);                                         \
                                                                        \
   /* --- Test encryption --- */                                                \
                                                                        \
   BLKC_MOVE(PRE, d, p);                                                        \
-  pre ## _eblk(&k, d, d);                                              \
+  pre##_eblk(&k, d, d);                                                        \
   BLKC_STORE(PRE, b.buf, d);                                           \
   BLKC_STORE(PRE, b.buf, d);                                           \
-  if (memcmp(b.buf, v[2].buf, PRE ## _BLKSZ)) {                                \
+  if (memcmp(b.buf, v[2].buf, PRE##_BLKSZ)) {                          \
     ok = 0;                                                            \
     printf("\nfail encryption:"                                                \
            "\n\tkey        = ");                                       \
     ok = 0;                                                            \
     printf("\nfail encryption:"                                                \
            "\n\tkey        = ");                                       \
@@ -238,9 +241,9 @@ static int verify(dstr *v)                                          \
   /* --- Test decryption --- */                                                \
                                                                        \
   BLKC_MOVE(PRE, d, c);                                                        \
   /* --- Test decryption --- */                                                \
                                                                        \
   BLKC_MOVE(PRE, d, c);                                                        \
-  pre ## _dblk(&k, d, d);                                              \
+  pre##_dblk(&k, d, d);                                                        \
   BLKC_STORE(PRE, b.buf, d);                                           \
   BLKC_STORE(PRE, b.buf, d);                                           \
-  if (memcmp(b.buf, v[1].buf, PRE ## _BLKSZ)) {                                \
+  if (memcmp(b.buf, v[1].buf, PRE##_BLKSZ)) {                          \
     ok = 0;                                                            \
     printf("\nfail decryption:"                                                \
            "\n\tkey        = ");                                       \
     ok = 0;                                                            \
     printf("\nfail decryption:"                                                \
            "\n\tkey        = ");                                       \
index 9f4fb56..f2f8b64 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: blowfish.h,v 1.1 1999/09/03 08:41:11 mdw Exp $
+ * $Id: blowfish.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * The Blowfish block cipher
  *
  *
  * The Blowfish block cipher
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: blowfish.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: blowfish.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
@@ -44,8 +47,8 @@
  * has a particularly heavyweight key schedule.
  */
 
  * has a particularly heavyweight key schedule.
  */
 
-#ifndef BLOWFISH_H
-#define BLOWFISH_H
+#ifndef CATACOMB_BLOWFISH_H
+#define CATACOMB_BLOWFISH_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
index d715a3f..c4b1bad 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: daftstory.h,v 1.2 1999/11/11 00:58:38 mdw Exp $
+ * $Id: daftstory.h,v 1.3 1999/12/10 23:29:48 mdw Exp $
  *
  * Daft story for use in test encryptions
  *
  *
  * Daft story for use in test encryptions
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: daftstory.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: daftstory.h,v $
+ * Revision 1.3  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.2  1999/11/11 00:58:38  mdw
  * Use fewer copies of the silly story to improve performance.
  *
  * Revision 1.2  1999/11/11 00:58:38  mdw
  * Use fewer copies of the silly story to improve performance.
  *
@@ -38,8 +41,8 @@
  *
  */
 
  *
  */
 
-#ifndef DAFTSTORY_H
-#define DAFTSTORY_H
+#ifndef CATACOMB_DAFTSTORY_H
+#define CATACOMB_DAFTSTORY_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
index dd4fdb7..db3391f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: des-base.h,v 1.1 1999/09/03 08:41:11 mdw Exp $
+ * $Id: des-base.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Common features for DES implementation
  *
  *
  * Common features for DES implementation
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: des-base.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: des-base.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
-#ifndef DES_BASE_H
-#define DES_BASE_H
+#ifndef CATACOMB_DES_BASE_H
+#define CATACOMB_DES_BASE_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/des.h b/des.h
index 857cec3..ac1461a 100644 (file)
--- a/des.h
+++ b/des.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: des.h,v 1.1 1999/09/03 08:41:11 mdw Exp $
+ * $Id: des.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * The Data Encryption Standard
  *
  *
  * The Data Encryption Standard
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: des.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: des.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
@@ -47,8 +50,8 @@
  * @des3@ interface which implements proper strong triple-DES.
  */
 
  * @des3@ interface which implements proper strong triple-DES.
  */
 
-#ifndef DES_H
-#define DES_H
+#ifndef CATACOMB_DES_H
+#define CATACOMB_DES_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/des3.h b/des3.h
index ce57ac9..d3bf294 100644 (file)
--- a/des3.h
+++ b/des3.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: des3.h,v 1.1 1999/09/03 08:41:11 mdw Exp $
+ * $Id: des3.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Implementation of double- and triple-DES
  *
  *
  * Implementation of double- and triple-DES
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: des3.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: des3.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:11  mdw
  * Initial import.
  *
  */
 
-#ifndef DES3_H
-#define DES3_H
+#ifndef CATACOMB_DES3_H
+#define CATACOMB_DES3_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
@@ -57,7 +60,7 @@
 
 #include <mLib/bits.h>
 
 
 #include <mLib/bits.h>
 
-#ifndef DES_H
+#ifndef CATACOMB_DES_H
 #  include "des.h"
 #endif
 
 #  include "des.h"
 #endif
 
diff --git a/dh.h b/dh.h
index 330c258..bf8d79a 100644 (file)
--- a/dh.h
+++ b/dh.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: dh.h,v 1.1 1999/11/20 22:24:44 mdw Exp $
+ * $Id: dh.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * [Diffie-Hellman key negotiation *
  * (c) 1999 Straylight/Edgeware
  *
  * [Diffie-Hellman key negotiation *
  * (c) 1999 Straylight/Edgeware
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dh.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dh.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/11/20 22:24:44  mdw
  * Add Diffie-Hellman support.
  *
  */
 
  * Revision 1.1  1999/11/20 22:24:44  mdw
  * Add Diffie-Hellman support.
  *
  */
 
-#ifndef DH_H
-#define DH_H
+#ifndef CATACOMB_DH_H
+#define CATACOMB_DH_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
@@ -43,7 +46,7 @@
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
 #  include "mp.h"
 #endif
 
 #  include "mp.h"
 #endif
 
diff --git a/dsa.h b/dsa.h
index 97f8241..ba3bad8 100644 (file)
--- a/dsa.h
+++ b/dsa.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: dsa.h,v 1.2 1999/11/20 22:23:48 mdw Exp $
+ * $Id: dsa.h,v 1.3 1999/12/10 23:29:48 mdw Exp $
  *
  * Digital Signature Algorithm
  *
  *
  * Digital Signature Algorithm
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dsa.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dsa.h,v $
+ * Revision 1.3  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.2  1999/11/20 22:23:48  mdw
  * Allow event handler to abort the search process.
  *
  * Revision 1.2  1999/11/20 22:23:48  mdw
  * Allow event handler to abort the search process.
  *
@@ -38,8 +41,8 @@
  *
  */
 
  *
  */
 
-#ifndef DSA_H
-#define DSA_H
+#ifndef CATACOMB_DSA_H
+#define CATACOMB_DSA_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
@@ -56,7 +59,7 @@
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
 #  include "mp.h"
 #endif
 
 #  include "mp.h"
 #endif
 
 enum {
   DSAEV_OK,                            /* Everything is fine */
 
 enum {
   DSAEV_OK,                            /* Everything is fine */
 
+  DSAEV_FINDQ,                         /* Search for a @q@ */
   DSAEV_FAILQ,                         /* @q@ failed primality test */
   DSAEV_PASSQ,                         /* @q@ passeed one iteration */
   DSAEV_GOODQ,                         /* Found good prime @q@ */
 
   DSAEV_FAILQ,                         /* @q@ failed primality test */
   DSAEV_PASSQ,                         /* @q@ passeed one iteration */
   DSAEV_GOODQ,                         /* Found good prime @q@ */
 
+  DSAEV_FINDP,                         /* Search for a @p@ */
   DSAEV_TRYP,                          /* Try prospective @p@ */
   DSAEV_FAILP,                         /* @p@ failed primality test */
   DSAEV_PASSP,                         /* @p@ passed one iteration */
   DSAEV_GOODP,                         /* @p@ accepted as being prime */
 
   DSAEV_TRYP,                          /* Try prospective @p@ */
   DSAEV_FAILP,                         /* @p@ failed primality test */
   DSAEV_PASSP,                         /* @p@ passed one iteration */
   DSAEV_GOODP,                         /* @p@ accepted as being prime */
 
+  DSAEV_FINDG,                         /* Search for a @g@ */
   DSAEV_TRYH,                          /* Try prospective @h@ */
   DSAEV_FAILH,                         /* @h@ failed */
   DSAEV_GOODG                          /* @g@ accepted as a generator */
   DSAEV_TRYH,                          /* Try prospective @h@ */
   DSAEV_FAILH,                         /* @h@ failed */
   DSAEV_GOODG                          /* @g@ accepted as a generator */
@@ -141,9 +147,9 @@ extern int dsa_seed(dsa_param */*dp*/, unsigned /*l*/,
 /* --- @dsa_mksig@ --- *
  *
  * Arguments:  @const dsa_param *dp@ = pointer to DSA parameters
 /* --- @dsa_mksig@ --- *
  *
  * Arguments:  @const dsa_param *dp@ = pointer to DSA parameters
- *             @const mp *a@ = secret signing key
- *             @const mp *m@ = message to be signed
- *             @const mp *k@ = random data
+ *             @mp *a@ = secret signing key
+ *             @mp *m@ = message to be signed
+ *             @mp *k@ = random data
  *             @mp **rr, **ss@ = where to put output parameters
  *
  * Returns:    ---
  *             @mp **rr, **ss@ = where to put output parameters
  *
  * Returns:    ---
@@ -151,8 +157,8 @@ extern int dsa_seed(dsa_param */*dp*/, unsigned /*l*/,
  * Use:                Computes a DSA signature of a message.
  */
 
  * Use:                Computes a DSA signature of a message.
  */
 
-extern void dsa_mksig(const dsa_param */*dp*/, const mp */*a*/,
-                     const mp */*m*/, const mp */*k*/,
+extern void dsa_mksig(const dsa_param */*dp*/, mp */*a*/,
+                     mp */*m*/, mp */*k*/,
                      mp **/*rr*/, mp **/*ss*/);
 
 /* --- @dsa_sign@ --- *
                      mp **/*rr*/, mp **/*ss*/);
 
 /* --- @dsa_sign@ --- *
@@ -183,22 +189,22 @@ extern void dsa_sign(dsa_param */*dp*/, mp */*a*/,
 /* --- @dsa_vrfy@ --- *
  *
  * Arguments:  @const dsa_param *dp@ = pointer to DSA parameters
 /* --- @dsa_vrfy@ --- *
  *
  * Arguments:  @const dsa_param *dp@ = pointer to DSA parameters
- *             @const mp *y@ = public verification key
- *             @const mp *m@ = message which was signed
- *             @const mp *r, *s@ = the signature
+ *             @mp *y@ = public verification key
+ *             @mp *m@ = message which was signed
+ *             @mp *r, *s@ = the signature
  *
  * Returns:    Zero if the signature is a forgery, nonzero if it's valid.
  *
  * Use:                Verifies a DSA digital signature.
  */
 
  *
  * Returns:    Zero if the signature is a forgery, nonzero if it's valid.
  *
  * Use:                Verifies a DSA digital signature.
  */
 
-extern int dsa_vrfy(const dsa_param */*dp*/, const mp */*y*/,
-                   const mp */*m*/, const mp */*r*/, const mp */*s*/);
+extern int dsa_vrfy(const dsa_param */*dp*/, mp */*y*/,
+                   mp */*m*/, mp */*r*/, mp */*s*/);
 
 /* --- @dsa_verify@ --- *
  *
  * Arguments:  @const dsa_param *dp@ = pointer to DSA parameters
 
 /* --- @dsa_verify@ --- *
  *
  * Arguments:  @const dsa_param *dp@ = pointer to DSA parameters
- *             @const mp *y@ = public verification key
+ *             @mp *y@ = public verification key
  *             @const void *m@ = pointer to message block
  *             @size_t msz@ = size of message block
  *             @const void *r@ = pointer to @r@ signature half
  *             @const void *m@ = pointer to message block
  *             @size_t msz@ = size of message block
  *             @const void *r@ = pointer to @r@ signature half
@@ -211,7 +217,7 @@ extern int dsa_vrfy(const dsa_param */*dp*/, const mp */*y*/,
  * Use:                Verifies a DSA digital signature.
  */
 
  * Use:                Verifies a DSA digital signature.
  */
 
-extern int dsa_verify(const dsa_param */*dp*/, const mp */*y*/,
+extern int dsa_verify(const dsa_param */*dp*/, mp */*y*/,
               const void */*m*/, size_t /*msz*/,
               const void */*r*/, size_t /*rsz*/,
               const void */*s*/, size_t /*ssz*/);
               const void */*m*/, size_t /*msz*/,
               const void */*r*/, size_t /*rsz*/,
               const void */*s*/, size_t /*ssz*/);
diff --git a/idea.h b/idea.h
index 5d26a57..84b7e51 100644 (file)
--- a/idea.h
+++ b/idea.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: idea.h,v 1.1 1999/09/03 08:41:12 mdw Exp $
+ * $Id: idea.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Implementation of the IDEA cipher
  *
  *
  * Implementation of the IDEA cipher
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: idea.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: idea.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
@@ -51,8 +54,8 @@
  * domain.
  */
 
  * domain.
  */
 
-#ifndef IDEA_H
-#define IDEA_H
+#ifndef CATACOMB_IDEA_H
+#define CATACOMB_IDEA_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/key.h b/key.h
index b7eb12b..3874f2c 100644 (file)
--- a/key.h
+++ b/key.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: key.h,v 1.1 1999/09/03 08:41:12 mdw Exp $
+ * $Id: key.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Simple key management
  *
  *
  * Simple key management
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: key.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: key.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  */
 
-#ifndef KEY_H
-#define KEY_H
+#ifndef CATACOMB_KEY_H
+#define CATACOMB_KEY_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
index a56ed00..8dc7bf7 100644 (file)
--- a/mpalloc.h
+++ b/mpalloc.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: mpalloc.h,v 1.1 1999/11/17 18:02:16 mdw Exp $
+ * $Id: mpalloc.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Allocation and freeing of MP buffers
  *
  *
  * Allocation and freeing of MP buffers
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpalloc.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpalloc.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/11/17 18:02:16  mdw
  * New multiprecision integer arithmetic suite.
  *
  */
 
  * Revision 1.1  1999/11/17 18:02:16  mdw
  * New multiprecision integer arithmetic suite.
  *
  */
 
-#ifndef MPARENA_H
-#define MPARENA_H
+#ifndef CATACOMB_MPARENA_H
+#define CATACOMB_MPARENA_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
@@ -44,7 +47,7 @@
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MPW_H
+#ifndef CATACOMB_MPW_H
 #  include "mpw.h"
 #endif
 
 #  include "mpw.h"
 #endif
 
index 20ae0ac..6b2b9bd 100644 (file)
--- a/mpmont.h
+++ b/mpmont.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: mpmont.h,v 1.2 1999/11/19 13:17:43 mdw Exp $
+ * $Id: mpmont.h,v 1.3 1999/12/10 23:29:48 mdw Exp $
  *
  * Montgomery reduction
  *
  *
  * Montgomery reduction
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpmont.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpmont.h,v $
+ * Revision 1.3  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.2  1999/11/19 13:17:43  mdw
  * Add extra interface to exponentiation which returns a Montgomerized
  * result.  Add simultaneous exponentiation interface.
  * Revision 1.2  1999/11/19 13:17:43  mdw
  * Add extra interface to exponentiation which returns a Montgomerized
  * result.  Add simultaneous exponentiation interface.
@@ -39,8 +42,8 @@
  *
  */
 
  *
  */
 
-#ifndef MPMONT_H
-#define MPMONT_H
+#ifndef CATACOMB_MPMONT_H
+#define CATACOMB_MPMONT_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
 #  include "mp.h"
 #endif
 
 #  include "mp.h"
 #endif
 
-/*----- What's going on here? ---------------------------------------------*
+/*----- Notes on Montgomery reduction -------------------------------------*
  *
  * Given a little bit of precomputation, Montgomery reduction enables modular
  * reductions of products to be calculated rather rapidly, without recourse
  *
  * Given a little bit of precomputation, Montgomery reduction enables modular
  * reductions of products to be calculated rather rapidly, without recourse
@@ -61,7 +64,9 @@
  * Before starting, you need to do a little work.  In particular, the
  * following things need to be worked out:
  *
  * Before starting, you need to do a little work.  In particular, the
  * following things need to be worked out:
  *
- *   * %$m$%, which is the modulus you'll be working with.
+ *   * %$m$%, which is the modulus you'll be working with.  This must be odd,
+ *     otherwise the whole thing doesn't work.  You're better off using
+ *     Barrett reduction if your modulus might be even.
  *
  *   * %$b$%, the radix of the number system you're in (here, it's
  *     @MPW_MAX + 1@).
  *
  *   * %$b$%, the radix of the number system you're in (here, it's
  *     @MPW_MAX + 1@).
@@ -77,8 +82,8 @@
  * The result of a Montgomery reduction of %$x$% is %$x R^{-1} \bmod m$%,
  * which doesn't look ever-so useful.  The trick is to initially apply a
  * factor of %$R$% to all of your numbers so that when you multiply and
  * The result of a Montgomery reduction of %$x$% is %$x R^{-1} \bmod m$%,
  * which doesn't look ever-so useful.  The trick is to initially apply a
  * factor of %$R$% to all of your numbers so that when you multiply and
- * perform a Montgomery reduction you get %$(xR \cdot yR)R^{-1} \bmod m$%,
- * which is just %$xyR \bmod m$%.  Thanks to distributivity, even additions
+ * perform a Montgomery reduction you get %$(x R \cdot y R) R^{-1} \bmod m$%,
+ * which is just %$x y R \bmod m$%.  Thanks to distributivity, even additions
  * and subtractions can be performed on numbers in this form -- the extra
  * factor of %$R$% just runs through all the calculations until it's finally
  * stripped out by a final reduction operation.
  * and subtractions can be performed on numbers in this form -- the extra
  * factor of %$R$% just runs through all the calculations until it's finally
  * stripped out by a final reduction operation.
@@ -112,6 +117,7 @@ typedef struct mpmont_factor {
  * Returns:    ---
  *
  * Use:                Initializes a Montgomery reduction context ready for use.
  * Returns:    ---
  *
  * Use:                Initializes a Montgomery reduction context ready for use.
+ *             The argument @m@ must be a positive odd integer.
  */
 
 extern void mpmont_create(mpmont */*mm*/, mp */*m*/);
  */
 
 extern void mpmont_create(mpmont */*mm*/, mp */*m*/);
@@ -132,51 +138,53 @@ extern void mpmont_destroy(mpmont */*mm*/);
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
  *             @mp *d@ = destination
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
  *             @mp *d@ = destination
- *             @const mp *a@ = source, assumed positive
+ *             @mp *a@ = source, assumed positive
  *
  * Returns:    Result, %$a R^{-1} \bmod m$%.
  */
 
  *
  * Returns:    Result, %$a R^{-1} \bmod m$%.
  */
 
-extern mp *mpmont_reduce(mpmont */*mm*/, mp */*d*/, const mp */*a*/);
+extern mp *mpmont_reduce(mpmont */*mm*/, mp */*d*/, mp */*a*/);
 
 /* --- @mpmont_mul@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
  *             @mp *d@ = destination
 
 /* --- @mpmont_mul@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
  *             @mp *d@ = destination
- *             @const mp *a, *b@ = sources, assumed positive
+ *             @mp *a, *b@ = sources, assumed positive
  *
  * Returns:    Result, %$a b R^{-1} \bmod m$%.
  */
 
  *
  * Returns:    Result, %$a b R^{-1} \bmod m$%.
  */
 
-extern mp *mpmont_mul(mpmont */*mm*/, mp */*d*/,
-                     const mp */*a*/, const mp */*b*/);
+extern mp *mpmont_mul(mpmont */*mm*/, mp */*d*/, mp */*a*/, mp */*b*/);
 
 /* --- @mpmont_expr@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
 
 /* --- @mpmont_expr@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
- *             @const mp *a@ = base
- *             @const mp *e@ = exponent
+ *             @mp *d@ = fake destination
+ *             @mp *a@ = base
+ *             @mp *e@ = exponent
  *
  * Returns:    Result, %$a^e R \bmod m$%.  This is useful if further modular
  *             arithmetic is to be performed on the result.
  */
 
  *
  * Returns:    Result, %$a^e R \bmod m$%.  This is useful if further modular
  *             arithmetic is to be performed on the result.
  */
 
-extern mp *mpmont_expr(mpmont */*mm*/, const mp */*a*/, const mp */*e*/);
+extern mp *mpmont_expr(mpmont */*mm*/, mp */*d*/, mp */*a*/, mp */*e*/);
 
 /* --- @mpmont_exp@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
 
 /* --- @mpmont_exp@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
- *             @const mp *a@ = base
- *             @const mp *e@ = exponent
+ *             @mp *d@ = fake destination
+ *             @mp *a@ = base
+ *             @mp *e@ = exponent
  *
  * Returns:    Result, %$a^e \bmod m$%.
  */
 
  *
  * Returns:    Result, %$a^e \bmod m$%.
  */
 
-extern mp *mpmont_exp(mpmont */*mm*/, const mp */*a*/, const mp */*e*/);
+extern mp *mpmont_exp(mpmont */*mm*/, mp */*d*/, mp */*a*/, mp */*e*/);
 
 /* --- @mpmont_mexpr@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
 
 /* --- @mpmont_mexpr@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
+ *             @mp *d@ = fake destination
  *             @mpmont_factor *f@ = pointer to array of factors
  *             @size_t n@ = number of factors supplied
  *
  *             @mpmont_factor *f@ = pointer to array of factors
  *             @size_t n@ = number of factors supplied
  *
@@ -187,11 +195,13 @@ extern mp *mpmont_exp(mpmont */*mm*/, const mp */*a*/, const mp */*e*/);
  *             %$g_0^{e_0} g_1^{e_1} \ldots g_{n-1}^{e_{n-1}} R \bmod m$%
  */
 
  *             %$g_0^{e_0} g_1^{e_1} \ldots g_{n-1}^{e_{n-1}} R \bmod m$%
  */
 
-extern mp *mpmont_mexpr(mpmont */*mm*/, mpmont_factor */*f*/, size_t /*n*/);
+extern mp *mpmont_mexpr(mpmont */*mm*/, mp */*d*/,
+                       mpmont_factor */*f*/, size_t /*n*/);
 
 /* --- @mpmont_mexp@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
 
 /* --- @mpmont_mexp@ --- *
  *
  * Arguments:  @mpmont *mm@ = pointer to Montgomery reduction context
+ *             @mp *d@ = fake destination
  *             @mpmont_factor *f@ = pointer to array of factors
  *             @size_t n@ = number of factors supplied
  *
  *             @mpmont_factor *f@ = pointer to array of factors
  *             @size_t n@ = number of factors supplied
  *
@@ -200,7 +210,8 @@ extern mp *mpmont_mexpr(mpmont */*mm*/, mpmont_factor */*f*/, size_t /*n*/);
  * Use:                Convenient interface over @mpmont_mexpr@.
  */
 
  * Use:                Convenient interface over @mpmont_mexpr@.
  */
 
-extern mp *mpmont_mexp(mpmont */*mm*/, mpmont_factor */*f*/, size_t /*n*/);
+extern mp *mpmont_mexp(mpmont */*mm*/, mp */*d*/,
+                      mpmont_factor */*f*/, size_t /*n*/);
 
 /*----- That's all, folks -------------------------------------------------*/
 
 
 /*----- That's all, folks -------------------------------------------------*/
 
index af7306d..98f2a3d 100644 (file)
--- a/mpscan.h
+++ b/mpscan.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: mpscan.h,v 1.2 1999/11/13 01:55:10 mdw Exp $
+ * $Id: mpscan.h,v 1.3 1999/12/10 23:29:48 mdw Exp $
  *
  * Sequential bit scan of multiprecision integers
  *
  *
  * Sequential bit scan of multiprecision integers
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpscan.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpscan.h,v $
+ * Revision 1.3  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.2  1999/11/13 01:55:10  mdw
  * Fixed so that they compile.  Minor interface changes.
  *
  * Revision 1.2  1999/11/13 01:55:10  mdw
  * Fixed so that they compile.  Minor interface changes.
  *
@@ -38,8 +41,8 @@
  *
  */
 
  *
  */
 
-#ifndef MPSCAN_H
-#define MPSCAN_H
+#ifndef CATACOMB_MPSCAN_H
+#define CATACOMB_MPSCAN_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
@@ -47,7 +50,7 @@
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MPW_H
+#ifndef CATACOMB_MPW_H
 #  include "mpw.h"
 #endif
 
 #  include "mpw.h"
 #endif
 
index 667c098..e9e68a8 100644 (file)
--- a/mptext.h
+++ b/mptext.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: mptext.h,v 1.1 1999/11/17 18:02:16 mdw Exp $
+ * $Id: mptext.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Textual representation of multiprecision numbers
  *
  *
  * Textual representation of multiprecision numbers
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mptext.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mptext.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/11/17 18:02:16  mdw
  * New multiprecision integer arithmetic suite.
  *
  */
 
  * Revision 1.1  1999/11/17 18:02:16  mdw
  * New multiprecision integer arithmetic suite.
  *
  */
 
-#ifndef MPTEXT_H
-#define MPTEXT_H
+#ifndef CATACOMB_MPTEXT_H
+#define CATACOMB_MPTEXT_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
@@ -44,7 +47,7 @@
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
 #  include "mp.h"
 #endif
 
 #  include "mp.h"
 #endif
 
index 28f44c4..dcdf839 100644 (file)
--- a/mptypes.c
+++ b/mptypes.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: mptypes.c,v 1.2 1999/11/13 01:54:32 mdw Exp $
+ * $Id: mptypes.c,v 1.3 1999/12/10 23:29:48 mdw Exp $
  *
  * Generate `mptypes.h' header file for current architecture
  *
  *
  * Generate `mptypes.h' header file for current architecture
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mptypes.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mptypes.c,v $
+ * Revision 1.3  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.2  1999/11/13 01:54:32  mdw
  * Format source code properly ;-).  Attach suffixes to the `max'
  * constants.
  * Revision 1.2  1999/11/13 01:54:32  mdw
  * Format source code properly ;-).  Attach suffixes to the `max'
  * constants.
@@ -154,8 +157,8 @@ int main(int argc, char *argv[])
  * mptypes.h [generated]\n\
  */\n\
 \n\
  * mptypes.h [generated]\n\
  */\n\
 \n\
-#ifndef MPTYPES_H\n\
-#define MPTYPES_H\n\
+#ifndef CATACOMB_MPTYPES_H\n\
+#define CATACOMB_MPTYPES_H\n\
 ");
   if ((mpd->flags | mpw->flags) & f_stdint) {
     puts("\
 ");
   if ((mpd->flags | mpw->flags) & f_stdint) {
     puts("\
diff --git a/mpw.h b/mpw.h
index 28c8629..3a9763c 100644 (file)
--- a/mpw.h
+++ b/mpw.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: mpw.h,v 1.1 1999/11/13 01:52:34 mdw Exp $
+ * $Id: mpw.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Very low-level multiprecision definitions
  *
  *
  * Very low-level multiprecision definitions
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpw.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mpw.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/11/13 01:52:34  mdw
  * Very low-level definitions for MP types.
  *
  * Revision 1.1  1999/11/13 01:52:34  mdw
  * Very low-level definitions for MP types.
  *
@@ -38,8 +41,8 @@
  *
  */
 
  *
  */
 
-#ifndef MPW_H
-#define MPW_H
+#ifndef CATACOMB_MPW_H
+#define CATACOMB_MPW_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef BITS_H
+#ifndef CATACOMB_BITS_H
 #  include <mLib/bits.h>
 #endif
 
 #  include <mLib/bits.h>
 #endif
 
-#ifndef MPTYPES_H
+#ifndef CATACOMB_MPTYPES_H
 #  include "mptypes.h"
 #endif
 
 #  include "mptypes.h"
 #endif
 
diff --git a/noise.h b/noise.h
index cadb747..d335448 100644 (file)
--- a/noise.h
+++ b/noise.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: noise.h,v 1.1 1999/09/03 08:41:12 mdw Exp $
+ * $Id: noise.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Acquisition of environmental noise (Unix specific)
  *
  *
  * Acquisition of environmental noise (Unix specific)
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: noise.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: noise.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  */
 
-#ifndef NOISE_H
-#define NOISE_H
+#ifndef CATACOMB_NOISE_H
+#define CATACOMB_NOISE_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
@@ -46,7 +49,7 @@
 
 #include <sys/types.h>
 
 
 #include <sys/types.h>
 
-#ifndef RAND_H
+#ifndef CATACOMB_RAND_H
 #  include "rand.h"
 #endif
 
 #  include "rand.h"
 #endif
 
index b2d19d8..58873bc 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: paranoia.h,v 1.1 1999/09/03 08:41:12 mdw Exp $
+ * $Id: paranoia.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Macros and functions for cryptographic paranoia
  *
  *
  * Macros and functions for cryptographic paranoia
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: paranoia.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: paranoia.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  */
 
-#ifndef PARANOIA_H
-#define PARANOIA_H
+#ifndef CATACOMB_PARANOIA_H
+#define CATACOMB_PARANOIA_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
diff --git a/pgen.h b/pgen.h
index 6f2000c..6d180c3 100644 (file)
--- a/pgen.h
+++ b/pgen.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: pgen.h,v 1.2 1999/11/20 22:23:05 mdw Exp $
+ * $Id: pgen.h,v 1.3 1999/12/10 23:29:48 mdw Exp $
  *
  * Finding and testing prime numbers
  *
  *
  * Finding and testing prime numbers
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pgen.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pgen.h,v $
+ * Revision 1.3  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.2  1999/11/20 22:23:05  mdw
  * Add multiply-and-add function for Diffie-Hellman safe prime generation.
  *
  * Revision 1.2  1999/11/20 22:23:05  mdw
  * Add multiply-and-add function for Diffie-Hellman safe prime generation.
  *
@@ -38,8 +41,8 @@
  *
  */
 
  *
  */
 
-#ifndef PGEN_H
-#define PGEN_H
+#ifndef CATACOMB_PGEN_H
+#define CATACOMB_PGEN_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
 #  include "mp.h"
 #endif
 
 #  include "mp.h"
 #endif
 
-#ifndef PTAB_H
+#ifndef CATACOMB_PTAB_H
 #  include "ptab.h"
 #endif
 
 #  include "ptab.h"
 #endif
 
diff --git a/rabin.c b/rabin.c
index 095c21d..7a7e234 100644 (file)
--- a/rabin.c
+++ b/rabin.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: rabin.c,v 1.1 1999/11/19 13:17:57 mdw Exp $
+ * $Id: rabin.c,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Miller-Rabin primality test
  *
  *
  * Miller-Rabin primality test
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rabin.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rabin.c,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/11/19 13:17:57  mdw
  * Prime number generator and tester.
  *
  * Revision 1.1  1999/11/19 13:17:57  mdw
  * Prime number generator and tester.
  *
@@ -122,7 +125,7 @@ int rabin_test(rabin *r, mp *g)
    * @y@ here has an extra factor of %$R$%.
    */
 
    * @y@ here has an extra factor of %$R$%.
    */
 
-  y = mpmont_expr(&r->mm, g, r->r);
+  y = mpmont_expr(&r->mm, MP_NEW, g, r->r);
   if (MP_CMP(y, ==, r->mm.r) || MP_CMP(y, ==, r->m1)) {
     rc = PGEN_MAYBE;
     goto done;
   if (MP_CMP(y, ==, r->mm.r) || MP_CMP(y, ==, r->m1)) {
     rc = PGEN_MAYBE;
     goto done;
diff --git a/rabin.h b/rabin.h
index ed08aeb..a161fa9 100644 (file)
--- a/rabin.h
+++ b/rabin.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: rabin.h,v 1.1 1999/11/19 13:17:57 mdw Exp $
+ * $Id: rabin.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * Miller-Rabin primality test
  *
  *
  * Miller-Rabin primality test
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rabin.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rabin.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/11/19 13:17:57  mdw
  * Prime number generator and tester.
  *
  */
 
  * Revision 1.1  1999/11/19 13:17:57  mdw
  * Prime number generator and tester.
  *
  */
 
-#ifndef RABIN_H
-#define RABIN_H
+#ifndef CATACOMB_RABIN_H
+#define CATACOMB_RABIN_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
 
 /*----- Header files ------------------------------------------------------*/
 
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
 #  include "mp.h"
 #endif
 
 #  include "mp.h"
 #endif
 
-#ifndef MPMONT_H
+#ifndef CATACOMB_MPMONT_H
 #  include "mpmont.h"
 #endif
 
 #  include "mpmont.h"
 #endif
 
-#ifndef PGEN_H
+#ifndef CATACOMB_PGEN_H
 #  include "pgen.h"
 #endif
 
 #  include "pgen.h"
 #endif
 
diff --git a/rand.h b/rand.h
index d83dcf2..543af41 100644 (file)
--- a/rand.h
+++ b/rand.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: rand.h,v 1.3 1999/10/15 21:04:30 mdw Exp $
+ * $Id: rand.h,v 1.4 1999/12/10 23:29:48 mdw Exp $
  *
  * Secure random number generator
  *
  *
  * Secure random number generator
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rand.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rand.h,v $
+ * Revision 1.4  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.3  1999/10/15 21:04:30  mdw
  * Increase output buffer a bit for performance.
  *
  * Revision 1.3  1999/10/15 21:04:30  mdw
  * Increase output buffer a bit for performance.
  *
@@ -53,7 +56,7 @@
  * concerns I expressed about the Linux generator in a Usenet article to
  * sci.crypt.
  *
  * concerns I expressed about the Linux generator in a Usenet article to
  * sci.crypt.
  *
- * The generator is divided into two parts: an input pool and an outpu
+ * The generator is divided into two parts: an input pool and an output
  * buffer.  New random data is placed into the pool in the way described
  * below, which is shamelessly stolen from the Linux /dev/random generator.
  * The only interaction that the pool has on the output buffer is through the
  * buffer.  New random data is placed into the pool in the way described
  * below, which is shamelessly stolen from the Linux /dev/random generator.
  * The only interaction that the pool has on the output buffer is through the
@@ -80,8 +83,8 @@
  * an adversary has to guess before predicting generator output.
  */
 
  * an adversary has to guess before predicting generator output.
  */
 
-#ifndef RAND_H
-#define RAND_H
+#ifndef CATACOMB_RAND_H
+#define CATACOMB_RAND_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {
 
 #include <stddef.h>
 
 
 #include <stddef.h>
 
-#include "rmd160-hmac.h"
+#ifndef CATACOMB_GRAND_H
+#  include "grand.h"
+#endif
+
+#ifndef CATACOMB_RMD160_HMAC_H
+#  include "rmd160-hmac.h"
+#endif
 
 /*----- Magic numbers -----------------------------------------------------*/
 
 
 /*----- Magic numbers -----------------------------------------------------*/
 
@@ -267,6 +276,33 @@ extern void rand_get(rand_pool */*r*/, void */*p*/, size_t /*sz*/);
 
 extern void rand_getgood(rand_pool */*r*/, void */*p*/, size_t /*sz*/);
 
 
 extern void rand_getgood(rand_pool */*r*/, void */*p*/, size_t /*sz*/);
 
+/*----- Generic random number generator interface -------------------------*/
+
+/* --- Miscellaneous operations --- */
+
+enum {
+  RAND_GATE = GRAND_SPECIFIC,          /* No args */
+  RAND_STRETCH,                                /* No args */
+  RAND_KEY,                            /* @const void *k, size_t sz@ */
+  RAND_NOISESRC                                /* @const rand_source *s@ */
+};
+
+/* --- Default random number generator --- */
+
+extern grand rand_global;
+
+/* --- @rand_create@ --- *
+ *
+ * Arguments:  ---
+ *
+ * Returns:    Pointer to a generic generator.
+ *
+ * Use:                Constructs a generic generator interface over a Catacomb
+ *             entropy pool generator.
+ */
+
+extern grand *rand_create(void);
+
 /*----- That's all, folks -------------------------------------------------*/
 
 #ifdef __cplusplus
 /*----- That's all, folks -------------------------------------------------*/
 
 #ifdef __cplusplus
diff --git a/rc5.h b/rc5.h
index 23e6080..877b849 100644 (file)
--- a/rc5.h
+++ b/rc5.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: rc5.h,v 1.1 1999/09/03 08:41:12 mdw Exp $
+ * $Id: rc5.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
  *
  * The RC5-32/12 block cipher
  *
  *
  * The RC5-32/12 block cipher
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rc5.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rc5.h,v $
+ * Revision 1.2  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  */
 
  * Revision 1.1  1999/09/03 08:41:12  mdw
  * Initial import.
  *
  */
 
-#ifndef RC5_H
-#define RC5_H
+#ifndef CATACOMB_RC5_H
+#define CATACOMB_RC5_H
 
 #ifdef __cplusplus
   extern "C" {
 
 #ifdef __cplusplus
   extern "C" {