Miscellaneous constification.
authormdw <mdw>
Fri, 2 Apr 2004 01:03:49 +0000 (01:03 +0000)
committermdw <mdw>
Fri, 2 Apr 2004 01:03:49 +0000 (01:03 +0000)
29 files changed:
blkc.h
blowfish.c
cast-base.h
cast-s.c
cast-sk.c
cbc-def.h
cfb-def.h
counter-def.h
des-base.c
des-base.h
desx.c
ec-test.c
f-binpoly.c
f-niceprime.c
f-prime.c
genprimes.c
gfshare.c
gfx-sqr.c
key-flags.c
lmem.c
md2.c
noise.c
noise.h
ofb-def.h
rabin.c
rho.c
rho.h
skipjack.c
twofish.c

diff --git a/blkc.h b/blkc.h
index 54f883d..5a7d3ec 100644 (file)
--- a/blkc.h
+++ b/blkc.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: blkc.h,v 1.5 2001/05/07 17:28:42 mdw Exp $
+ * $Id: blkc.h,v 1.6 2004/04/02 01:03:49 mdw Exp $
  *
  * Common definitions for block ciphers
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: blkc.h,v $
+ * Revision 1.6  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.5  2001/05/07 17:28:42  mdw
  * Support block ciphers with larger blocks.
  *
@@ -330,7 +333,7 @@ static int pre##_verify(dstr *v)                                    \
                                                                        \
 BLKC_VERIFY(PRE, pre)                                                  \
                                                                        \
-static test_chunk defs[] = {                                           \
+static const test_chunk defs[] = {                                     \
   { #pre, pre##_verify, { &type_hex, &type_hex, &type_hex, 0 } },      \
   { 0, 0, { 0 } }                                                      \
 };                                                                     \
index 2821a45..c57ebb2 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: blowfish.c,v 1.2 2000/06/17 10:47:56 mdw Exp $
+ * $Id: blowfish.c,v 1.3 2004/04/02 01:03:49 mdw Exp $
  *
  * The Blowfish block cipher
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: blowfish.c,v $
+ * Revision 1.3  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.2  2000/06/17 10:47:56  mdw
  * Tidy round function a little.  Support new key size interface.
  *
@@ -50,7 +53,7 @@
 
 /*----- Global variables --------------------------------------------------*/
 
-static blowfish_ctx ikey = BLOWFISH_IKEY;
+static const blowfish_ctx ikey = BLOWFISH_IKEY;
 
 const octet blowfish_keysz[] = { KSZ_RANGE, BLOWFISH_KEYSZ, 1, 56, 1 };
 
index 841f221..387b95a 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: cast-base.h,v 1.1 2000/06/17 10:48:29 mdw Exp $
+ * $Id: cast-base.h,v 1.2 2004/04/02 01:03:49 mdw Exp $
  *
  * Basic macros and definitions for CAST-128 and CAST-256
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: cast-base.h,v $
+ * Revision 1.2  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.1  2000/06/17 10:48:29  mdw
  * CAST round function macros.
  *
@@ -64,7 +67,7 @@
 
 /*----- Global variables --------------------------------------------------*/
 
-extern uint32 cast_s[4][256], cast_sk[4][256];
+extern const uint32 cast_s[4][256], cast_sk[4][256];
 
 /*----- That's all, folks -------------------------------------------------*/
 
index 040d538..2bd3e28 100644 (file)
--- a/cast-s.c
+++ b/cast-s.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: cast-s.c,v 1.1 2000/06/17 10:48:52 mdw Exp $
+ * $Id: cast-s.c,v 1.2 2004/04/02 01:03:49 mdw Exp $
  *
  * Basic S-boxes for CAST-128 and CAST-256
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: cast-s.c,v $
+ * Revision 1.2  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.1  2000/06/17 10:48:52  mdw
  * CAST S-boxes.
  *
@@ -44,6 +47,6 @@
 
 /*----- Global variables --------------------------------------------------*/
 
-uint32 cast_s[4][256] = CAST_S;
+const uint32 cast_s[4][256] = CAST_S;
 
 /*----- That's all, folks -------------------------------------------------*/
index db8310a..98174a3 100644 (file)
--- a/cast-sk.c
+++ b/cast-sk.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: cast-sk.c,v 1.1 2000/06/17 10:48:52 mdw Exp $
+ * $Id: cast-sk.c,v 1.2 2004/04/02 01:03:49 mdw Exp $
  *
  * Key-schedule S-boxes for CAST-128
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: cast-sk.c,v $
+ * Revision 1.2  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.1  2000/06/17 10:48:52  mdw
  * CAST S-boxes.
  *
@@ -44,6 +47,6 @@
 
 /*----- Global variables --------------------------------------------------*/
 
-uint32 cast_sk[4][256] = CAST_SK;
+const uint32 cast_sk[4][256] = CAST_SK;
 
 /*----- That's all, folks -------------------------------------------------*/
index 1be3549..5b89ab1 100644 (file)
--- a/cbc-def.h
+++ b/cbc-def.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: cbc-def.h,v 1.3 2001/06/17 00:10:51 mdw Exp $
+ * $Id: cbc-def.h,v 1.4 2004/04/02 01:03:49 mdw Exp $
  *
  * Definitions for cipher block chaining mode
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: cbc-def.h,v $
+ * Revision 1.4  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.3  2001/06/17 00:10:51  mdw
  * Typesetting fixes
  *
@@ -148,7 +151,7 @@ void pre##_cbcinit(pre##_cbcctx *ctx,                                       \
                     const void *key, size_t sz,                        \
                     const void *iv)                                    \
 {                                                                      \
-  static octet zero[PRE##_BLKSZ] = { 0 };                              \
+  static const octet zero[PRE##_BLKSZ] = { 0 };                                \
   pre##_init(&ctx->ctx, key, sz);                                      \
   BLKC_LOAD(PRE, ctx->iv, iv ? iv : zero);                             \
 }                                                                      \
index 51ab9e7..1d983f3 100644 (file)
--- a/cfb-def.h
+++ b/cfb-def.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: cfb-def.h,v 1.3 2001/06/17 00:10:51 mdw Exp $
+ * $Id: cfb-def.h,v 1.4 2004/04/02 01:03:49 mdw Exp $
  *
  * Definitions for ciphertext feedback mode
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: cfb-def.h,v $
+ * Revision 1.4  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.3  2001/06/17 00:10:51  mdw
  * Typesetting fixes
  *
@@ -180,7 +183,7 @@ void pre##_cfbinit(pre##_cfbctx *ctx,                                       \
                     const void *key, size_t sz,                        \
                     const void *iv)                                    \
 {                                                                      \
-  static octet zero[PRE##_BLKSZ] = { 0 };                              \
+  static const octet zero[PRE##_BLKSZ] = { 0 };                                \
   pre##_init(&ctx->ctx, key, sz);                                      \
   pre##_cfbsetiv(ctx, iv ? iv : zero);                                 \
 }                                                                      \
index e0336a4..e9ee952 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: counter-def.h,v 1.2 2001/06/17 00:10:51 mdw Exp $
+ * $Id: counter-def.h,v 1.3 2004/04/02 01:03:49 mdw Exp $
  *
  * Block cipher counter mode (or long cycle mode)
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: counter-def.h,v $
+ * Revision 1.3  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.2  2001/06/17 00:10:51  mdw
  * Typesetting fixes
  *
@@ -166,7 +169,7 @@ void pre##_counterinit(pre##_counterctx *ctx,                               \
                       const void *key, size_t sz,                      \
                       const void *iv)                                  \
 {                                                                      \
-  static octet zero[PRE##_BLKSZ] = { 0 };                              \
+  static const octet zero[PRE##_BLKSZ] = { 0 };                                \
   pre##_init(&ctx->ctx, key, sz);                                      \
   pre##_countersetiv(ctx, iv ? iv : zero);                             \
 }                                                                      \
index f91628e..c42d03c 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: des-base.c,v 1.2 2000/06/17 10:52:01 mdw Exp $
+ * $Id: des-base.c,v 1.3 2004/04/02 01:03:49 mdw Exp $
  *
  * Common features for DES implementation
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: des-base.c,v $
+ * Revision 1.3  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.2  2000/06/17 10:52:01  mdw
  * Change name for S-box header file.
  *
@@ -47,6 +50,6 @@
 
 /*----- Global variables --------------------------------------------------*/
 
-uint32 des_sp[8][64] = DES_SP;
+const uint32 des_sp[8][64] = DES_SP;
 
 /*----- That's all, folks -------------------------------------------------*/
index db3391f..2f06754 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: des-base.h,v 1.2 1999/12/10 23:29:48 mdw Exp $
+ * $Id: des-base.h,v 1.3 2004/04/02 01:03:49 mdw Exp $
  *
  * Common features for DES implementation
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: des-base.h,v $
+ * Revision 1.3  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.2  1999/12/10 23:29:48  mdw
  * Change header file guard names.
  *
@@ -51,7 +54,7 @@
 
 /*----- External data -----------------------------------------------------*/
 
-extern uint32 des_sp[8][64];
+extern const uint32 des_sp[8][64];
 
 /*----- Macros ------------------------------------------------------------*/
 
diff --git a/desx.c b/desx.c
index 2d325b4..060815d 100644 (file)
--- a/desx.c
+++ b/desx.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: desx.c,v 1.1 2001/04/03 19:36:50 mdw Exp $
+ * $Id: desx.c,v 1.2 2004/04/02 01:03:49 mdw Exp $
  *
  * Implementation of DESX
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: desx.c,v $
+ * Revision 1.2  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.1  2001/04/03 19:36:50  mdw
  * New block cipher DESX added.
  *
@@ -53,7 +56,7 @@
 
 /*----- Tables ------------------------------------------------------------*/
 
-static octet s[256] = DESX_S;
+static const octet s[256] = DESX_S;
 
 /*----- Global variables --------------------------------------------------*/
 
index 1307e32..de01ad8 100644 (file)
--- a/ec-test.c
+++ b/ec-test.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: ec-test.c,v 1.4 2004/04/01 12:50:09 mdw Exp $
+ * $Id: ec-test.c,v 1.5 2004/04/02 01:03:49 mdw Exp $
  *
  * Code for testing elliptic-curve stuff
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: ec-test.c,v $
+ * Revision 1.5  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.4  2004/04/01 12:50:09  mdw
  * Add cyclic group abstraction, with test code.  Separate off exponentation
  * functions for better static linking.  Fix a buttload of bugs on the way.
@@ -123,7 +126,7 @@ static int ecSAMEP(ec_curve *cc, ec_curve *dd)
   return (ec_samep(c->real, d->real));
 }
 
-static ec_ops ecops = {
+static const ec_ops ecops = {
   ecDESTROY, ecSAMEP, ecIN, ecOUT, ecFIX,
   ecFIND, ecNEG, ecADD, ecSUB, ecDBL, ecCHECK
 };
@@ -173,7 +176,7 @@ static void ecvdump(dstr *d, FILE *fp)
   fprintf(fp, "%s", ec_name(v));
 }
 
-test_type type_ecurve = { ecvcvt, ecvdump };
+const test_type type_ecurve = { ecvcvt, ecvdump };
 
 static void eccvt(const char *p, dstr *d)
 {
index 45e1449..9c09356 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: f-binpoly.c,v 1.7 2004/04/01 21:28:41 mdw Exp $
+ * $Id: f-binpoly.c,v 1.8 2004/04/02 01:03:49 mdw Exp $
  *
  * Binary fields with polynomial basis representation
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: f-binpoly.c,v $
+ * Revision 1.8  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.7  2004/04/01 21:28:41  mdw
  * Normal basis support (translates to poly basis internally).  Rewrite
  * EC and prime group table generators in awk, so that they can reuse data
@@ -112,7 +115,7 @@ static mp *fquadsolve(field *ff, mp *d, mp *x)
 
 /* --- Field operations table --- */
 
-static field_ops fops = {
+static const field_ops fops = {
   FTY_BINARY, "binpoly",
   fdestroy, frand, field_stdsamep,
   freduce, field_id,
@@ -171,7 +174,7 @@ static mp *fnout(field *ff, mp *d, mp *x)
 
 /* --- Field operations table --- */
 
-static field_ops fnops = {
+static const field_ops fnops = {
   FTY_BINARY, "binnorm",
   fndestroy, frand, fnsamep,
   fnin, fnout,
index 2a51352..8f0b43d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: f-niceprime.c,v 1.4 2004/04/01 21:28:41 mdw Exp $
+ * $Id: f-niceprime.c,v 1.5 2004/04/02 01:03:49 mdw Exp $
  *
  * Prime fields with efficient reduction for special-form primes
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: f-niceprime.c,v $
+ * Revision 1.5  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.4  2004/04/01 21:28:41  mdw
  * Normal basis support (translates to poly basis internally).  Rewrite
  * EC and prime group table generators in awk, so that they can reuse data
@@ -139,7 +142,7 @@ static mp *fhlv(field *ff, mp *d, mp *x) {
 
 /* --- Field operations table --- */
 
-static field_ops fops = {
+static const field_ops fops = {
   FTY_PRIME, "niceprime",
   fdestroy, frand, field_stdsamep,
   freduce, field_id,
index 088032b..66db76a 100644 (file)
--- a/f-prime.c
+++ b/f-prime.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: f-prime.c,v 1.9 2004/04/01 21:28:41 mdw Exp $
+ * $Id: f-prime.c,v 1.10 2004/04/02 01:03:49 mdw Exp $
  *
  * Prime fields with Montgomery arithmetic
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: f-prime.c,v $
+ * Revision 1.10  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.9  2004/04/01 21:28:41  mdw
  * Normal basis support (translates to poly basis internally).  Rewrite
  * EC and prime group table generators in awk, so that they can reuse data
@@ -175,7 +178,7 @@ static mp *fhlv(field *ff, mp *d, mp *x) {
 
 /* --- Field operations table --- */
 
-static field_ops fops = {
+static const field_ops fops = {
   FTY_PRIME, "prime",
   fdestroy, frand, field_stdsamep,
   fin, fout,
index 56e388e..2ee4115 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: genprimes.c,v 1.5 2004/04/01 12:50:09 mdw Exp $
+ * $Id: genprimes.c,v 1.6 2004/04/02 01:03:49 mdw Exp $
  *
  * Generate prime number table
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: genprimes.c,v $
+ * Revision 1.6  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.5  2004/04/01 12:50:09  mdw
  * Add cyclic group abstraction, with test code.  Separate off exponentation
  * functions for better static linking.  Fix a buttload of bugs on the way.
@@ -167,7 +170,7 @@ int main(int argc, char *argv[])
 #define MAXPRIME %uu\n\
 \n\
 typedef %s smallprime;\n\
-extern smallprime %s[];\n\
+extern const smallprime %s[];\n\
 \n\
 #endif\n\
 ",
@@ -195,7 +198,7 @@ extern smallprime %s[];\n\
 \n\
 #include \"%s\"\n\
 \n\
-%s %s[] = {",
+const %s %s[] = {",
            header, type, name);
     for (i = 0; i < DA_LEN(&p); i++) {
       if (i % 8 == 0)
index 2bc72c6..841e556 100644 (file)
--- a/gfshare.c
+++ b/gfshare.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: gfshare.c,v 1.7 2001/06/16 23:42:17 mdw Exp $
+ * $Id: gfshare.c,v 1.8 2004/04/02 01:03:49 mdw Exp $
  *
  * Secret sharing over %$\gf{2^8}$%
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: gfshare.c,v $
+ * Revision 1.8  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.7  2001/06/16 23:42:17  mdw
  * Typesetting fixes.
  *
@@ -73,7 +76,7 @@
 
 /*----- Static variables --------------------------------------------------*/
 
-static octet gflog[] = GFSHARE_LOG, gfexp[] = GFSHARE_EXP;
+static const octet gflog[] = GFSHARE_LOG, gfexp[] = GFSHARE_EXP;
 
 /*----- Main code ---------------------------------------------------------*/
 
index 19ec574..60e1b3c 100644 (file)
--- a/gfx-sqr.c
+++ b/gfx-sqr.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: gfx-sqr.c,v 1.2 2004/03/21 22:52:06 mdw Exp $
+ * $Id: gfx-sqr.c,v 1.3 2004/04/02 01:03:49 mdw Exp $
  *
  * Sqaring binary polynomials
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: gfx-sqr.c,v $
+ * Revision 1.3  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.2  2004/03/21 22:52:06  mdw
  * Merge and close elliptic curve branch.
  *
@@ -49,7 +52,7 @@
 
 /*----- Static variables --------------------------------------------------*/
 
-static uint16 tab[256] = GFX_SQRTAB;
+static const uint16 tab[256] = GFX_SQRTAB;
 
 /*----- Main code ---------------------------------------------------------*/
 
index b225ba1..d80da4f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: key-flags.c,v 1.3 2004/03/28 01:58:47 mdw Exp $
+ * $Id: key-flags.c,v 1.4 2004/04/02 01:03:49 mdw Exp $
  *
  * Reading and writing key flag strings
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: key-flags.c,v $
+ * Revision 1.4  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.3  2004/03/28 01:58:47  mdw
  * Generate, store and retreive elliptic curve keys.
  *
@@ -66,7 +69,7 @@ typedef struct flagent {
   unsigned m;
 } flagent;
 
-static flagent flagtab[] = {
+static const flagent flagtab[] = {
 
   /* --- Encoding types --- */
 
@@ -116,7 +119,7 @@ int key_readflags(const char *p, char **pp, unsigned *ff, unsigned *mm)
 
   for (;;) {
     size_t sz = strcspn(p, ",:");
-    flagent *e, *ee = 0;
+    const flagent *e, *ee = 0;
 
     /* --- Look up the string in the flags table --- */
 
@@ -170,7 +173,7 @@ int key_readflags(const char *p, char **pp, unsigned *ff, unsigned *mm)
 void key_writeflags(unsigned f, dstr *d)
 {
   int del = 0;
-  flagent *e;
+  const flagent *e;
   unsigned m = 0;
 
   for (e = flagtab; e->name; e++) {
diff --git a/lmem.c b/lmem.c
index 97e3968..e534d4a 100644 (file)
--- a/lmem.c
+++ b/lmem.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: lmem.c,v 1.4 2002/01/24 22:26:11 mdw Exp $
+ * $Id: lmem.c,v 1.5 2004/04/02 01:03:49 mdw Exp $
  *
  * Locked memory allocation (Unix-specific)
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: lmem.c,v $
+ * Revision 1.5  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.4  2002/01/24 22:26:11  mdw
  * Fix build failure when @mlock@ not available.
  *
@@ -73,7 +76,7 @@ static void *aalloc(arena *a, size_t sz) { return l_alloc((lmem *)a, sz); }
 static void afree(arena *a, void *p) { l_free((lmem *)a, p); }
 static void apurge(arena *a) { l_purge((lmem *)a); }
 
-static arena_ops l_ops = { aalloc, arena_fakerealloc, afree, apurge };
+static const arena_ops l_ops = { aalloc, arena_fakerealloc, afree, apurge };
 
 /*----- Main code ---------------------------------------------------------*/
 
diff --git a/md2.c b/md2.c
index b93a1b2..d374d87 100644 (file)
--- a/md2.c
+++ b/md2.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: md2.c,v 1.1 2001/02/21 20:03:22 mdw Exp $
+ * $Id: md2.c,v 1.2 2004/04/02 01:03:49 mdw Exp $
  *
  * The MD2 message digest function
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: md2.c,v $
+ * Revision 1.2  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.1  2001/02/21 20:03:22  mdw
  * Added support for MD2 hash function.
  *
@@ -47,7 +50,7 @@
 
 /*----- Tables ------------------------------------------------------------*/
 
-static octet s[256] = MD2_S;
+static const octet s[256] = MD2_S;
 
 /*----- Main code ---------------------------------------------------------*/
 
diff --git a/noise.c b/noise.c
index a4648f8..8e5129b 100644 (file)
--- a/noise.c
+++ b/noise.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: noise.c,v 1.6 2000/06/17 12:57:47 mdw Exp $
+ * $Id: noise.c,v 1.7 2004/04/02 01:03:49 mdw Exp $
  *
  * Acquisition of environmental noise (Unix-specific)
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: noise.c,v $
+ * Revision 1.7  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.6  2000/06/17 12:57:47  mdw
  * New free counter noise generator, for use if /dev/random is
  * unavailable.
@@ -85,7 +88,7 @@
 
 /*----- Noise source definition -------------------------------------------*/
 
-rand_source noise_source = { noise_acquire, noise_timer };
+const rand_source noise_source = { noise_acquire, noise_timer };
 
 /*----- Static variables --------------------------------------------------*/
 
diff --git a/noise.h b/noise.h
index 3777a6f..9252809 100644 (file)
--- a/noise.h
+++ b/noise.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: noise.h,v 1.4 2000/06/17 12:57:47 mdw Exp $
+ * $Id: noise.h,v 1.5 2004/04/02 01:03:49 mdw Exp $
  *
  * Acquisition of environmental noise (Unix-specific)
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: noise.h,v $
+ * Revision 1.5  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.4  2000/06/17 12:57:47  mdw
  * New free counter noise generator, for use if /dev/random is
  * unavailable.
@@ -62,7 +65,7 @@
 
 /*----- Noise source definition -------------------------------------------*/
 
-extern rand_source noise_source;
+extern const rand_source noise_source;
 
 /*----- Magic numbers -----------------------------------------------------*/
 
index 9bc69e8..67d3a6a 100644 (file)
--- a/ofb-def.h
+++ b/ofb-def.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: ofb-def.h,v 1.5 2001/06/17 00:10:51 mdw Exp $
+ * $Id: ofb-def.h,v 1.6 2004/04/02 01:03:49 mdw Exp $
  *
  * Definitions for output feedback mode
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: ofb-def.h,v $
+ * Revision 1.6  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.5  2001/06/17 00:10:51  mdw
  * Typesetting fixes
  *
@@ -182,7 +185,7 @@ void pre##_ofbinit(pre##_ofbctx *ctx,                                       \
                     const void *key, size_t sz,                        \
                     const void *iv)                                    \
 {                                                                      \
-  static octet zero[PRE##_BLKSZ] = { 0 };                              \
+  static const octet zero[PRE##_BLKSZ] = { 0 };                                \
   pre##_init(&ctx->ctx, key, sz);                                      \
   pre##_ofbsetiv(ctx, iv ? iv : zero);                                 \
 }                                                                      \
diff --git a/rabin.c b/rabin.c
index 915dc14..200ab0d 100644 (file)
--- a/rabin.c
+++ b/rabin.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: rabin.c,v 1.7 2002/01/13 13:42:53 mdw Exp $
+ * $Id: rabin.c,v 1.8 2004/04/02 01:03:49 mdw Exp $
  *
  * Miller-Rabin primality test
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rabin.c,v $
+ * Revision 1.8  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.7  2002/01/13 13:42:53  mdw
  * More efficient Rabin-Miller test: with random witnesses, skip redundant
  * Montgomerization.  (Being bijective, it can't affect the distribution.)
@@ -182,7 +185,7 @@ int rabin_test(rabin *r, mp *g)
 
 int rabin_iters(unsigned len)
 {
-  static struct {
+  static const struct {
     unsigned b;
     int i;
   } *p, *q, tab[] = {
diff --git a/rho.c b/rho.c
index aae4951..57754d3 100644 (file)
--- a/rho.c
+++ b/rho.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: rho.c,v 1.3 2001/06/16 12:56:38 mdw Exp $
+ * $Id: rho.c,v 1.4 2004/04/02 01:03:49 mdw Exp $
  *
  * Pollard's rho algorithm for discrete logs
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rho.c,v $
+ * Revision 1.4  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.3  2001/06/16 12:56:38  mdw
  * Fixes for interface change to @mpmont_expr@ and @mpmont_mexpr@.
  *
@@ -215,7 +218,7 @@ static void prime_drop(void *x)
   MP_DROP(*(mp **)x);
 }
 
-static rho_ops prime_ops = {
+static const rho_ops prime_ops = {
   prime_sqr, prime_mul, prime_eq, prime_split, prime_drop
 };
 
diff --git a/rho.h b/rho.h
index 6d060b0..2760096 100644 (file)
--- a/rho.h
+++ b/rho.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: rho.h,v 1.1 2000/07/09 21:32:30 mdw Exp $
+ * $Id: rho.h,v 1.2 2004/04/02 01:03:49 mdw Exp $
  *
  * Pollard's rho algorithm for discrete logs
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rho.h,v $
+ * Revision 1.2  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.1  2000/07/09 21:32:30  mdw
  * Pollard's rho algorithm for computing discrete logs.
  *
@@ -63,7 +66,7 @@ typedef struct rho_ops {
 /* --- The Pollard's rho context structure --- */
 
 typedef struct rho_ctx {
-  rho_ops *ops;                                /* Group operations table */
+  const rho_ops *ops;                  /* Group operations table */
   void *c;                             /* Context for group operations */
   void *g, *a;                         /* Generator and argument for log */
   mp *n;                               /* Cyclic group order */
index 98bb48f..f0a3f23 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: skipjack.c,v 1.3 2000/08/01 00:28:34 mdw Exp $
+ * $Id: skipjack.c,v 1.4 2004/04/02 01:03:49 mdw Exp $
  *
  * The Skipjack block cipher
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: skipjack.c,v $
+ * Revision 1.4  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.3  2000/08/01 00:28:34  mdw
  * Performance improvement: read keys in as 32-bit words and deal them out
  * byte-by-byte.
@@ -57,7 +60,7 @@ const octet skipjack_keysz[] = { KSZ_SET, 10, 0 };
 
 /*----- The Skipjack S-box ------------------------------------------------*/
 
-static octet f[256] = SKIPJACK_S;
+static const octet f[256] = SKIPJACK_S;
 
 /*----- Main code ---------------------------------------------------------*/
 
index 566ee1e..6f79963 100644 (file)
--- a/twofish.c
+++ b/twofish.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: twofish.c,v 1.3 2002/01/13 13:37:59 mdw Exp $
+ * $Id: twofish.c,v 1.4 2004/04/02 01:03:49 mdw Exp $
  *
  * Implementation of the Twofish cipher
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: twofish.c,v $
+ * Revision 1.4  2004/04/02 01:03:49  mdw
+ * Miscellaneous constification.
+ *
  * Revision 1.3  2002/01/13 13:37:59  mdw
  * Add support for Twofish family keys.
  *
@@ -286,7 +289,7 @@ void twofish_initfk(twofish_ctx *k, const void *buf, size_t sz,
 
 void twofish_init(twofish_ctx *k, const void *buf, size_t sz)
 {
-  static twofish_fk fk = { { 0 } };
+  static const twofish_fk fk = { { 0 } };
   twofish_initfk(k, buf, sz, &fk);
 }