Make flags be macros rather than enumerations, to ensure that they're
authormdw <mdw>
Wed, 6 Dec 2000 20:33:27 +0000 (20:33 +0000)
committermdw <mdw>
Wed, 6 Dec 2000 20:33:27 +0000 (20:33 +0000)
unsigned.

dsig.c
fipstest.h
hashsum.c
key.h
keyutil.c
limlee.h
lmem.h
mkphrase.c
passphrase.c
pixie.c
rspit.c

diff --git a/dsig.c b/dsig.c
index a1e945d..a34cca2 100644 (file)
--- a/dsig.c
+++ b/dsig.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: dsig.c,v 1.5 2000/10/08 12:12:09 mdw Exp $
+ * $Id: dsig.c,v 1.6 2000/12/06 20:33:27 mdw Exp $
  *
  * Verify signatures on distribuitions of files
  *
  *
  * Verify signatures on distribuitions of files
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dsig.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: dsig.c,v $
+ * Revision 1.6  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.5  2000/10/08 12:12:09  mdw
  * Shut up some warnings.
  *
  * Revision 1.5  2000/10/08 12:12:09  mdw
  * Shut up some warnings.
  *
@@ -876,11 +880,9 @@ static void fhex(FILE *fp, const void *p, size_t sz)
 
 static int sign(int argc, char *argv[])
 {
 
 static int sign(int argc, char *argv[])
 {
-  enum {
-    f_raw = 1,
-    f_bin = 2,
-    f_bogus = 4
-  };
+#define f_raw 1u
+#define f_bin 2u
+#define f_bogus 4u
 
   unsigned f = 0;
   const char *kt = 0;
 
   unsigned f = 0;
   const char *kt = 0;
@@ -1118,17 +1120,19 @@ static int sign(int argc, char *argv[])
   if (f & f_bogus)
     die(EXIT_FAILURE, "error(s) occurred while creating signature");
   return (EXIT_SUCCESS);
   if (f & f_bogus)
     die(EXIT_FAILURE, "error(s) occurred while creating signature");
   return (EXIT_SUCCESS);
+
+#undef f_raw
+#undef f_bin
+#undef f_bogus
 }
 
 /*----- Signature verification --------------------------------------------*/
 
 static int verify(int argc, char *argv[])
 {
 }
 
 /*----- Signature verification --------------------------------------------*/
 
 static int verify(int argc, char *argv[])
 {
-  enum {
-    f_bogus = 1,
-    f_bin = 2,
-    f_ok = 4
-  };
+#define f_bogus 1u
+#define f_bin 2u
+#define f_ok 4u
 
   unsigned f = 0;
   unsigned verb = 1;
 
   unsigned f = 0;
   unsigned verb = 1;
@@ -1347,6 +1351,10 @@ done:
       puts("OK signature verified");
   }
   return (f & f_bogus ? EXIT_FAILURE : EXIT_SUCCESS);
       puts("OK signature verified");
   }
   return (f & f_bogus ? EXIT_FAILURE : EXIT_SUCCESS);
+
+#undef f_bogus
+#undef f_bin
+#undef f_ok
 }
 
 /*----- Main code ---------------------------------------------------------*/
 }
 
 /*----- Main code ---------------------------------------------------------*/
@@ -1409,9 +1417,7 @@ int main(int argc, char *argv[])
   cmd *c = 0, *cc = 0;
   size_t n;
 
   cmd *c = 0, *cc = 0;
   size_t n;
 
-  enum {
-    f_bogus = 1
-  };
+#define f_bogus 1u
 
   /* --- Initialize the library --- */
 
 
   /* --- Initialize the library --- */
 
@@ -1479,6 +1485,8 @@ int main(int argc, char *argv[])
   if (!cc)
     die(EXIT_FAILURE, "unknown command `%s'", argv[0]);
   return (cc->func(argc, argv));
   if (!cc)
     die(EXIT_FAILURE, "unknown command `%s'", argv[0]);
   return (cc->func(argc, argv));
+
+#undef f_bogus
 }
 
 /*----- That's all, folks -------------------------------------------------*/
 }
 
 /*----- That's all, folks -------------------------------------------------*/
index fa150e2..9596d8a 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: fipstest.h,v 1.2 2000/08/11 21:34:34 mdw Exp $
+ * $Id: fipstest.h,v 1.3 2000/12/06 20:33:27 mdw Exp $
  *
  * FIPS140 randomness tests
  *
  *
  * FIPS140 randomness tests
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: fipstest.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: fipstest.h,v $
+ * Revision 1.3  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.2  2000/08/11 21:34:34  mdw
  * Change to use the new thresholds given in the draft FIPS140-2.
  *
  * Revision 1.2  2000/08/11 21:34:34  mdw
  * Change to use the new thresholds given in the draft FIPS140-2.
  *
 
 #define FIPSTEST_BUFSZ 2500
 
 
 #define FIPSTEST_BUFSZ 2500
 
-enum {
-  FIPSTEST_OK = 0,
-  FIPSTEST_MONOBIT = 1,
-  FIPSTEST_POKER = 2,
-  FIPSTEST_RUNS = 4,
-  FIPSTEST_LONGRUNS = 8
-};
+#define FIPSTEST_OK 0u
+#define FIPSTEST_MONOBIT 1u
+#define FIPSTEST_POKER 2u
+#define FIPSTEST_RUNS 4u
+#define FIPSTEST_LONGRUNS 8u
 
 /*----- Functions provided ------------------------------------------------*/
 
 
 /*----- Functions provided ------------------------------------------------*/
 
index db7d7f7..5776d93 100644 (file)
--- a/hashsum.c
+++ b/hashsum.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: hashsum.c,v 1.4 2000/08/04 23:23:44 mdw Exp $
+ * $Id: hashsum.c,v 1.5 2000/12/06 20:33:27 mdw Exp $
  *
  * Hash files using some secure hash function
  *
  *
  * Hash files using some secure hash function
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: hashsum.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: hashsum.c,v $
+ * Revision 1.5  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.4  2000/08/04 23:23:44  mdw
  * Various <ctype.h> fixes.
  *
  * Revision 1.4  2000/08/04 23:23:44  mdw
  * Various <ctype.h> fixes.
  *
@@ -82,16 +86,14 @@ static const gchash *hashtab[] = {
   0
 };
 
   0
 };
 
-enum {
-  f_binary = 1,
-  f_bogus = 2,
-  f_verbose = 4,
-  f_check = 8,
-  f_files = 16,
-  f_raw = 32,
-  f_oddhash = 64,
-  f_escape = 128
-};
+#define f_binary 1u
+#define f_bogus 2u
+#define f_verbose 4u
+#define f_check 8u
+#define f_files 16u
+#define f_raw 32u
+#define f_oddhash 64u
+#define f_escape 128u
 
 /*----- Support functions -------------------------------------------------*/
 
 
 /*----- Support functions -------------------------------------------------*/
 
diff --git a/key.h b/key.h
index 4ce7b7c..980c561 100644 (file)
--- a/key.h
+++ b/key.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: key.h,v 1.6 2000/06/17 11:27:43 mdw Exp $
+ * $Id: key.h,v 1.7 2000/12/06 20:33:27 mdw Exp $
  *
  * Simple key management
  *
  *
  * Simple key management
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: key.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: key.h,v $
+ * Revision 1.7  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.6  2000/06/17 11:27:43  mdw
  * Add key fetching interface.
  *
  * Revision 1.6  2000/06/17 11:27:43  mdw
  * Add key fetching interface.
  *
@@ -141,10 +145,8 @@ typedef struct key_file {
 
 /* --- Key file flags --- */
 
 
 /* --- Key file flags --- */
 
-enum {
-  KF_WRITE = 1,                                /* File opened for writing */
-  KF_MODIFIED = 2                      /* File has been modified */
-};
+#define KF_WRITE 1u                    /* File opened for writing */
+#define KF_MODIFIED 2u                 /* File has been modified */
 
 /* --- Iterating over keys --- *
  *
 
 /* --- Iterating over keys --- *
  *
index 174bbfe..fac8813 100644 (file)
--- a/keyutil.c
+++ b/keyutil.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: keyutil.c,v 1.10 2000/10/08 12:02:21 mdw Exp $
+ * $Id: keyutil.c,v 1.11 2000/12/06 20:33:27 mdw Exp $
  *
  * Simple key manager program
  *
  *
  * Simple key manager program
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: keyutil.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: keyutil.c,v $
+ * Revision 1.11  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.10  2000/10/08 12:02:21  mdw
  * Use @MP_EQ@ instead of @MP_CMP@.
  *
  * Revision 1.10  2000/10/08 12:02:21  mdw
  * Use @MP_EQ@ instead of @MP_CMP@.
  *
@@ -182,13 +186,11 @@ typedef struct keyopts {
   key *p;                              /* Parameters key-data */
 } keyopts;
 
   key *p;                              /* Parameters key-data */
 } keyopts;
 
-enum {
-  f_bogus = 1,                         /* Error in parsing */
-  f_lock = 2,                          /* Passphrase-lock private key */
-  f_quiet = 4,                         /* Don't show a progress indicator */
-  f_limlee = 8,                                /* Generate Lim-Lee primes */
-  f_subgroup = 16                      /* Generate a subgroup */
-};
+#define f_bogus 1u                     /* Error in parsing */
+#define f_lock 2u                      /* Passphrase-lock private key */
+#define f_quiet 4u                     /* Don't show a progress indicator */
+#define f_limlee 8u                    /* Generate Lim-Lee primes */
+#define f_subgroup 16u                 /* Generate a subgroup */
 
 /* --- @dolock@ --- *
  *
 
 /* --- @dolock@ --- *
  *
@@ -912,11 +914,9 @@ typedef struct listopts {
 
 /* --- Listing flags --- */
 
 
 /* --- Listing flags --- */
 
-enum {
-  f_newline = 2,                       /* Write newline before next entry */
-  f_attr = 4,                          /* Written at least one attribute */
-  f_utc = 8                            /* Emit UTC time, not local time */
-};
+#define f_newline 2u                   /* Write newline before next entry */
+#define f_attr 4u                      /* Written at least one attribute */
+#define f_utc 8u                       /* Emit UTC time, not local time */
 
 /* --- @showkeydata@ --- *
  *
 
 /* --- @showkeydata@ --- *
  *
@@ -1627,9 +1627,7 @@ int main(int argc, char *argv[])
 {
   unsigned f = 0;
 
 {
   unsigned f = 0;
 
-  enum {
-    f_bogus = 1
-  };
+#define f_bogus 1u
 
   /* --- Initialization --- */
 
 
   /* --- Initialization --- */
 
index bccfccb..2802585 100644 (file)
--- a/limlee.h
+++ b/limlee.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: limlee.h,v 1.2 2000/08/18 19:16:51 mdw Exp $
+ * $Id: limlee.h,v 1.3 2000/12/06 20:33:27 mdw Exp $
  *
  * Generate Lim-Lee primes
  *
  *
  * Generate Lim-Lee primes
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: limlee.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: limlee.h,v $
+ * Revision 1.3  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.2  2000/08/18 19:16:51  mdw
  * New stepper interface for constructing Lim-Lee primes.
  *
  * Revision 1.2  2000/08/18 19:16:51  mdw
  * New stepper interface for constructing Lim-Lee primes.
  *
@@ -102,9 +106,7 @@ typedef struct limlee_primeops {
 
 /* --- Flags --- */
 
 
 /* --- Flags --- */
 
-enum {
-  LIMLEE_KEEPFACTORS = 1
-};
+#define LIMLEE_KEEPFACTORS 1u
 
 /*----- The Lim-Lee stepper function --------------------------------------*/
 
 
 /*----- The Lim-Lee stepper function --------------------------------------*/
 
diff --git a/lmem.h b/lmem.h
index 36204c6..3f84c6e 100644 (file)
--- a/lmem.h
+++ b/lmem.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: lmem.h,v 1.3 2000/07/29 21:58:15 mdw Exp $
+ * $Id: lmem.h,v 1.4 2000/12/06 20:33:27 mdw Exp $
  *
  * Locked memory allocation
  *
  *
  * Locked memory allocation
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: lmem.h,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: lmem.h,v $
+ * Revision 1.4  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.3  2000/07/29 21:58:15  mdw
  * (l_destroy): New function for destroying locked memory blocks.
  *
  * Revision 1.3  2000/07/29 21:58:15  mdw
  * (l_destroy): New function for destroying locked memory blocks.
  *
@@ -72,9 +76,7 @@ typedef struct l_node {
   unsigned f;                          /* Various flags */
 } l_node;
 
   unsigned f;                          /* Various flags */
 } l_node;
 
-enum {
-  LF_ALLOC = 1
-};
+#define LF_ALLOC 1u
 
 /* --- Locked memory buffer state --- */
 
 
 /* --- Locked memory buffer state --- */
 
@@ -88,9 +90,7 @@ typedef struct lmem {
   int err; char *emsg;                 /* Error indicators */
 } lmem;
 
   int err; char *emsg;                 /* Error indicators */
 } lmem;
 
-enum {
-  LF_LOCKED = 1
-};
+#define LF_LOCKED 1u
 
 /*----- Functions provided ------------------------------------------------*/
 
 
 /*----- Functions provided ------------------------------------------------*/
 
index f315108..2d1ea1b 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: mkphrase.c,v 1.1 2000/08/06 10:50:55 mdw Exp $
+ * $Id: mkphrase.c,v 1.2 2000/12/06 20:33:27 mdw Exp $
  *
  * Generate passphrases from word lists
  *
  *
  * Generate passphrases from word lists
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mkphrase.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: mkphrase.c,v $
+ * Revision 1.2  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.1  2000/08/06 10:50:55  mdw
  * (mkphrase): New program for generating random passphrases with measured
  * strength.
  * Revision 1.1  2000/08/06 10:50:55  mdw
  * (mkphrase): New program for generating random passphrases with measured
  * strength.
@@ -321,10 +325,8 @@ int main(int argc, char *argv[])
   dstr dd = DSTR_INIT;
   unsigned i;
 
   dstr dd = DSTR_INIT;
   unsigned i;
 
-  enum {
-    f_bogus = 1,
-    f_showp = 2
-  };
+#define f_bogus 1u
+#define f_showp 2u
 
   ego(argv[0]);
   for (;;) {
 
   ego(argv[0]);
   for (;;) {
index e19aed4..b0268d3 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: passphrase.c,v 1.2 2000/06/17 11:49:37 mdw Exp $
+ * $Id: passphrase.c,v 1.3 2000/12/06 20:33:27 mdw Exp $
  *
  * Reading of passphrases (Unix-specific)
  *
  *
  * Reading of passphrases (Unix-specific)
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: passphrase.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: passphrase.c,v $
+ * Revision 1.3  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.2  2000/06/17 11:49:37  mdw
  * New pixie protocol allowing application to request passphrases and send
  * them to the pixie.
  * Revision 1.2  2000/06/17 11:49:37  mdw
  * New pixie protocol allowing application to request passphrases and send
  * them to the pixie.
@@ -58,9 +62,7 @@
 static int fd = -1;
 static unsigned flags = 0;
 
 static int fd = -1;
 static unsigned flags = 0;
 
-enum {
-  f_fail = 1
-};
+#define f_fail 1u
 
 /*----- Main code ---------------------------------------------------------*/
 
 
 /*----- Main code ---------------------------------------------------------*/
 
diff --git a/pixie.c b/pixie.c
index 300a2f7..d4aefdf 100644 (file)
--- a/pixie.c
+++ b/pixie.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: pixie.c,v 1.6 2000/10/08 12:06:46 mdw Exp $
+ * $Id: pixie.c,v 1.7 2000/12/06 20:33:27 mdw Exp $
  *
  * Passphrase pixie for Catacomb
  *
  *
  * Passphrase pixie for Catacomb
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pixie.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pixie.c,v $
+ * Revision 1.7  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.6  2000/10/08 12:06:46  mdw
  * Change size passed to socket function to be a @size_t@.  Insert missing
  * type name for flag declaration.
  * Revision 1.6  2000/10/08 12:06:46  mdw
  * Change size passed to socket function to be a @size_t@.  Insert missing
  * type name for flag declaration.
@@ -128,10 +132,8 @@ static const char *command = 0;
 static lmem lm;
 static unsigned flags = 0;
 
 static lmem lm;
 static unsigned flags = 0;
 
-enum {
-  F_SYSLOG = 1,
-  F_FETCH = 2
-};
+#define F_SYSLOG 1u
+#define F_FETCH 2u
 
 /*----- Event logging -----------------------------------------------------*/
 
 
 /*----- Event logging -----------------------------------------------------*/
 
@@ -1228,13 +1230,11 @@ int main(int argc, char *argv[])
   size_t sz;
   unsigned f = 0;
 
   size_t sz;
   unsigned f = 0;
 
-  enum {
-    f_bogus = 1,
-    f_client = 2,
-    f_stdin = 4,
-    f_daemon = 8,
-    f_syslog = 16
-  };
+#define f_bogus 1u
+#define f_client 2u
+#define f_stdin 4u
+#define f_daemon 8u
+#define f_syslog 16u
 
   /* --- Initialize libraries --- */
 
 
   /* --- Initialize libraries --- */
 
diff --git a/rspit.c b/rspit.c
index f4f177d..b9c8e72 100644 (file)
--- a/rspit.c
+++ b/rspit.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
 /* -*-c-*-
  *
- * $Id: rspit.c,v 1.12 2000/10/08 15:49:18 mdw Exp $
+ * $Id: rspit.c,v 1.13 2000/12/06 20:33:27 mdw Exp $
  *
  * Spit out random numbers
  *
  *
  * Spit out random numbers
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rspit.c,v $
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rspit.c,v $
+ * Revision 1.13  2000/12/06 20:33:27  mdw
+ * Make flags be macros rather than enumerations, to ensure that they're
+ * unsigned.
+ *
  * Revision 1.12  2000/10/08 15:49:18  mdw
  * Remove failed kludge for shutting up a warning.
  *
  * Revision 1.12  2000/10/08 15:49:18  mdw
  * Remove failed kludge for shutting up a warning.
  *
@@ -237,14 +241,12 @@ static char **argv;
 
 static unsigned flags = 0;
 
 
 static unsigned flags = 0;
 
-enum {
-  f_progress = 1,
-  f_file = 2,
-  f_fips = 4,
-  f_maurer = 8,
-  f_timer = 16,
-  f_discard = 32
-};
+#define f_progress 1u
+#define f_file 2u
+#define f_fips 4u
+#define f_maurer 8u
+#define f_timer 16u
+#define f_discard 32u
 
 /*----- Help options ------------------------------------------------------*/
 
 
 /*----- Help options ------------------------------------------------------*/