chiark / gitweb /
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 54f883d92781d766545fa3a765fa0da0bec9c893..5a7d3ecd7deadab6244595e28058e899562f8beb 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 2821a450bad4a767a0ac2f96409906d8b63c1ee5..c57ebb20daf0e7a322cdfb8639d93100d800c0c3 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 841f221e072d8e9ec3c9d98de6b021310e5c485b..387b95ab6655584ac33fdfccc014b6d6069b6149 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 040d5387779e44cf462d7763588787fe9e862bab..2bd3e28855cb31e46721637203ea1385f78fde8c 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 db8310aa0de58d3c5923d74755d085dd38063241..98174a368723b9ee46f3687460595ee65dd1dd6d 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 1be3549d11e5692082dce68608849b7287341eca..5b89ab19819277d3bd2eb1e22efd15347d7af2f8 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 51ab9e72880af607834b7c7772c2d59187dc6893..1d983f319fd8720a4c08168cef66e2a63a4731b2 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 e0336a44029a0d22f2fbeeda1f5369fa8fd1f61d..e9ee952f026530a6f206adf78ab0f4b0aaea07e6 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 f91628edb10aee2fe7185fd05600e626d5b167d4..c42d03c5d37f2d2021a729f077b11296f8cead96 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 db3391fb9e0410d07afce2e08afc389e8af31f0c..2f0675460327293411420ad11dd3f7bb6f8b8e6c 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 2d325b4d441e80d8108a6884619679d333646f70..060815dace6ed339467bb8f6d75167c60ea7889c 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 1307e32e8cbbaa5445c724a857bd00d93fa343de..de01ad865d949991a24805571c971f66e172d863 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 45e1449afc9149fba28b980f6b23978db2398b24..9c0935627ca9e32c13275956fb8de9165c68ea63 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 2a51352b326ac8030d016c716960cc850ab69124..8f0b43dc25dbcb7cd3549de001d4333db1ae7e8a 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 088032b72a93c134165d9c43b207c8874d42a937..66db76afcb0257aa3ea316ce58191dc283340a2c 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 56e388e80868331c7abefc6674584b63a594180f..2ee41157ee2f5a5cfc9d785a9fb7aef75dfaafec 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 2bc72c69179e1c1d11056bbf56c369388810bc52..841e5563c1fcc1c31c4639b9463cf92a66f7564a 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 19ec5745606a4a327e7d15ba50eaac9bde6390fd..60e1b3c6e8bfbee0278820870c91e82bc7d531b1 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 b225ba1c4bd22de288a9e86505cfdf8c250e4934..d80da4f635ff2c10d7d7b939c45a20ffa833f78f 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 97e39683a4abad7ca9fec9d8b4f3030d68f319f1..e534d4a627bb66c13641098ee38bbb1d75dbf7be 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 b93a1b211c958b0c009eae4951e56d1aed0c5433..d374d87e23a1298c892c5b87799105a7c17ce1a9 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 a4648f8a319e2f03981e324c68e68bc3f06241fc..8e5129b85d7596eb1aa4c38289a6cf0cc6db6c4c 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 3777a6fbe0114fdfc977acfad03ba61685dd5ad5..92528099a549545d68a62fa7d26b5303fded5a10 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 9bc69e8b01611621885ea225245751f94c8e2aa7..67d3a6a3189b1bf1068337da53e71d3259035c2a 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 915dc142949586b38850c9dfbaeabb796393cde6..200ab0d69f28756027b82dcd7f591420e955ac8e 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 aae4951afa909ac08cfae17a5dfa495066a24fbe..57754d3f142780b299dcd016235870fc79cccbc9 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 6d060b07d0b47a4975bfe2035356f0486f9b6e30..27600966095ec872b2ee6826ad6c7a083f6dbe37 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 98bb48f007c15e77d219405b6bdf496ae17cf004..f0a3f234e1c4b2bab7cced1344a56bcff01d75f1 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 566ee1ea68c0be981714788599fdd6ee929df434..6f79963c6b651f76d4969f6726147a622c3383f4 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);
 }