[svn] gcry - r1213 - in trunk: . cipher doc m4 mpi src tests

svn author wk cvs at cvs.gnupg.org
Wed Feb 21 14:26:44 CET 2007


Author: wk
Date: 2007-02-21 14:26:38 +0100 (Wed, 21 Feb 2007)
New Revision: 1213

Added:
   trunk/m4/Makefile.am
   trunk/m4/noexecstack.m4
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/NEWS
   trunk/README
   trunk/autogen.sh
   trunk/cipher/
   trunk/cipher/ChangeLog
   trunk/cipher/ac.c
   trunk/cipher/blowfish.c
   trunk/cipher/cast5.c
   trunk/cipher/cipher.c
   trunk/cipher/crc.c
   trunk/cipher/dsa.c
   trunk/cipher/elgamal.c
   trunk/cipher/md.c
   trunk/cipher/md4.c
   trunk/cipher/md5.c
   trunk/cipher/primegen.c
   trunk/cipher/pubkey.c
   trunk/cipher/random-daemon.c
   trunk/cipher/random.c
   trunk/cipher/random.h
   trunk/cipher/rijndael.c
   trunk/cipher/rmd.h
   trunk/cipher/rmd160.c
   trunk/cipher/rndlinux.c
   trunk/cipher/rsa.c
   trunk/cipher/serpent.c
   trunk/cipher/sha1.c
   trunk/cipher/sha256.c
   trunk/cipher/sha512.c
   trunk/cipher/tiger.c
   trunk/cipher/twofish.c
   trunk/cipher/whirlpool.c
   trunk/configure.ac
   trunk/doc/
   trunk/doc/gcrypt.texi
   trunk/m4/ChangeLog
   trunk/mpi/
   trunk/mpi/ChangeLog
   trunk/mpi/mpicoder.c
   trunk/mpi/mpiutil.c
   trunk/src/
   trunk/src/ChangeLog
   trunk/src/cipher.h
   trunk/src/gcrypt-module.h
   trunk/src/gcrypt.h.in
   trunk/src/gcryptrnd.c
   trunk/src/getrandom.c
   trunk/src/global.c
   trunk/src/libgcrypt.vers
   trunk/src/mpi.h
   trunk/src/sexp.c
   trunk/tests/
   trunk/tests/ChangeLog
   trunk/tests/basic.c
   trunk/tests/hmac.c
   trunk/tests/keygen.c
   trunk/tests/keygrip.c
   trunk/tests/register.c
   trunk/tests/tsexp.c
Log:
A lot of cleanups as well as minor API changes.
Ported some changes from 1.2 to here.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/ChangeLog	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1,7 +1,13 @@
 2007-02-20  Werner Koch  <wk at g10code.com>
 
-	* configure.ac: New option --disable-endian-check. 
+	* configure.ac: Bump LT version to C14/A3/R0 in preparation for a
+	release.
 	
+	* autogen.sh: Add option --force.
+	* configure.ac: New option --disable-endian-check.  Use a real
+	noexecstack test instead of requiring an option.  Add SVN version
+	magic.
+
 2007-02-02  Werner Koch  <wk at g10code.com>
 
 	* configure.ac (FALLBACK_SOCKLEN_T): Special case for mingw32.

Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/Makefile.am	2007-02-21 13:26:38 UTC (rev 1213)
@@ -20,7 +20,7 @@
 ACLOCAL_AMFLAGS = -I m4
 AUTOMAKE_OPTIONS = dist-bzip2
 
-DIST_SUBDIRS = mpi cipher src doc tests w32-dll
+DIST_SUBDIRS = m4 mpi cipher src doc tests w32-dll
 SUBDIRS = mpi cipher src doc tests
 EXTRA_DIST = BUGS autogen.sh README.apichanges README.SVN
 DISTCLEANFILES = 

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/NEWS	2007-02-21 13:26:38 UTC (rev 1213)
@@ -14,12 +14,17 @@
 
  * Support for the SEED cipher.
 
+ * Support for OFB encryption mode.
+
  * gcry_mpi_rshift does not anymore truncate the shift count.
 
  * Reserved algorithm ranges for use by applications.
 
  * Support for DSA2.
 
+ * The new function gcry_md_debug should be used instead of the
+   gcry_md_start_debug and gcry_md_stop_debug macros.
+
  * Interface changes relative to the 1.2.0 release:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  gcry_fast_random_poll	 NEW
@@ -32,6 +37,13 @@
  GCRY_PK_USAGE_UNKN      NEW
  gcry_mpi_scan           CHANGED: Argument BUFFER is now void*.
  GCR_CIPHER_SEED         NEW
+ gcry_pk_spec_t          CHANGED (minor change, bug fix)
+ gcry_md_write_t         CHANGED (minor change, bug fix)
+ gcry_md_debug           NEW
+ gcry_cipher_encrypt     CHANGED (minor change)
+ gcry_cipher_decrypt     CHANGED (minor change)
+ gcry_randomize          CHANGED (minor change)
+ gcry_cipher_register    CHANGED (minor change)
 
  FIXME: Please add API changes immediatley so that we don't
         forget about them.

Modified: trunk/README
===================================================================
--- trunk/README	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/README	2007-02-21 13:26:38 UTC (rev 1213)
@@ -6,7 +6,7 @@
     version is 1.2.x.
     
 
-    Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+    Copyright 2000, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
 
     This file is free software; as a special exception the author gives
     unlimited permission to copy and/or distribute it, with or without

Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/autogen.sh	2007-02-21 13:26:38 UTC (rev 1213)
@@ -30,6 +30,11 @@
 
 
 DIE=no
+FORCE=
+if test "$1" == "--force"; then
+  FORCE=" --force"
+  shift
+fi
 
 # ***** W32 build script *******
 # Used to cross-compile for Windows.
@@ -189,7 +194,8 @@
 $AUTOHEADER
 echo "Running automake --gnu ..."
 $AUTOMAKE --gnu;
-echo "Running autoconf..."
-$AUTOCONF
+echo "Running autoconf${FORCE} ..."
+$AUTOCONF${FORCE}
 
 echo "You may now run \"./configure --enable-maintainer-mode && make\"."
+echo "(gcc users may want to add the option \"--enable-gcc-warnings\")"


Property changes on: trunk/cipher
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
Makefile


Modified: trunk/cipher/ChangeLog
===================================================================
--- trunk/cipher/ChangeLog	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/ChangeLog	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1,3 +1,45 @@
+2007-02-21  Werner Koch  <wk at g10code.com>
+
+	* random.c (rndpool, keypool): Make unsigned.
+	(mix_pool): Change char* variables to unsigned char*.
+	(gcry_randomize): Make arg BUFFER a void*.
+	(gcry_create_nonce): Ditto.
+
+	* rmd160.c (gcry_rmd160_mixblock): Make BUFFER a void*.
+	(_gcry_rmd160_hash_buffer): Make OUTBUF and BUFFER void*.
+	* sha1.c (_gcry_sha1_hash_buffer): Ditto.
+
+	* cipher.c (gcry_cipher_encrypt, cry_cipher_decrypt): Change
+	buffer args to void*.
+	(gcry_cipher_register): Make ALGORITHM_ID a int *.
+
+	* md.c (md_start_debug): Make SUFFIX a const char*.  Use snprintf.
+	(gcry_md_debug): New.
+	(gcry_md_ctl): Changed arg BUFFER from unsigned char*.
+
+	* md.c (md_write): Make INBUF a const void*.
+	(gcry_md_write): Remove needless cast.
+	* crc.c (crc32_write): Make INBUF a const void*
+	(update_crc32, crc24rfc2440_write): Ditto.
+	* sha512.c (sha512_write, transform): Ditto.
+	* sha256.c (sha256_write, transform): Ditto.
+	* rmd160.c (rmd160_write, transform): Ditto.
+	* md5.c (md5_write, transform): Ditto.
+	* md4.c (md4_write, transform): Ditto.
+	* sha1.c (sha1_write, transform): Ditto.
+
+	* tiger.c (tiger_write, transform): Ditto.
+	* whirlpool.c (whirlpool_write, whirlpool_add, transform): Ditto.
+
+	* elgamal.c (elg_names): Change to a const*.
+	* dsa.c (dsa_names): Ditto.
+	* rsa.c (rsa_names): Ditto.
+	* pubkey.c (gcry_pk_lookup_func_name): Make ALIASES a const.
+
+2007-02-20  Werner Koch  <wk at g10code.com>
+
+	* rndlinux.c (open_device): Remove unsused arg MINOR.
+
 2007-01-30  Werner Koch  <wk at g10code.com>
 
 	* sha256.c (oid_spec_sha256): Add alias from pkcs#1.

Modified: trunk/cipher/ac.c
===================================================================
--- trunk/cipher/ac.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/ac.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -71,7 +71,7 @@
 } ac_key_generate_specs[] =
   {
     { GCRY_AC_RSA, "rsa-use-e", offsetof (gcry_ac_key_spec_rsa_t, e) },
-    { 0 },
+    { 0 }
   };
 
 /* Handle structure.  */
@@ -1373,10 +1373,12 @@
   /* Fill list with MPIs.  */
   for (i = 0; i < data_length; i++)
     {
-      /* FIXME!! */
-      arg_list[(i * 2) + 0] = (data->data[i].name
-			       ? (void **) &data->data[i].name
-			       : (void **) &data->data[i].name_provided);
+      /* FIXME!!  name_provided is a const char* whereas  name is char. */
+      char **nameaddr  = (data->data[i].name
+                          ? &data->data[i].name
+                          : &data->data[i].name_provided);
+
+      arg_list[(i * 2) + 0] = nameaddr;
       arg_list[(i * 2) + 1] = &data->data[i].mpi;
     }
 
@@ -1552,6 +1554,8 @@
   gcry_ac_key_t key_new;
   gcry_error_t err;
 
+  (void)handle;
+
   /* Allocate.  */
   key_new = gcry_malloc (sizeof (*key_new));
   if (! key_new)
@@ -1617,6 +1621,8 @@
   unsigned int i;
   unsigned int j;
 
+  (void)misc_data;
+
   key_data_secret = NULL;
   key_data_public = NULL;
   key_secret = NULL;
@@ -2415,6 +2421,8 @@
   unsigned int ps_n;
   unsigned int k;
 
+  (void)flags;
+
   options = opts;
   buffer = NULL;
   m = NULL;
@@ -2487,6 +2495,8 @@
   unsigned int i;
   unsigned int k;
 
+  (void)flags;
+
   options = opts;
   buffer = NULL;
   em = NULL;
@@ -2567,6 +2577,8 @@
   unsigned char asn[100];	/* FIXME, always enough?  */
   size_t asn_n;
   unsigned int i;
+
+  (void)flags;
   
   options = opts;
   buffer = NULL;
@@ -2948,6 +2960,8 @@
   unsigned int nbits;
   gcry_error_t err;
 
+  (void)opts;
+
   err = _gcry_ac_key_get_nbits (handle, key, &nbits);
   if (err)
     goto out;
@@ -3112,6 +3126,8 @@
   void *opts_em;
   ac_scheme_t *scheme;
 
+  (void)flags;
+
   data_encrypted = NULL;
   mpi_encrypted = NULL;
   mpi_plain = NULL;
@@ -3217,6 +3233,8 @@
   unsigned char *c;
   size_t c_n;
 
+  (void)flags;
+
   data_encrypted = NULL;
   mpi_encrypted = NULL;
   mpi_decrypted = NULL;
@@ -3341,6 +3359,8 @@
   gcry_mpi_t mpi_signed;
   ac_scheme_t *scheme;
 
+  (void)flags;
+
   data_signed = NULL;
   mpi_signed = NULL;
   opts_em = NULL;
@@ -3448,6 +3468,8 @@
   unsigned char *s;
   size_t s_n;
 
+  (void)flags;
+
   mpi_signature = NULL;
   elements_sig = NULL;
   data_signed = NULL;

Modified: trunk/cipher/blowfish.c
===================================================================
--- trunk/cipher/blowfish.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/blowfish.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -601,5 +601,5 @@
   {
     "BLOWFISH", NULL, NULL, BLOWFISH_BLOCKSIZE, 128,
     sizeof (BLOWFISH_context),
-    bf_setkey, encrypt_block, decrypt_block,
+    bf_setkey, encrypt_block, decrypt_block
   };

Modified: trunk/cipher/cast5.c
===================================================================
--- trunk/cipher/cast5.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/cast5.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -616,5 +616,5 @@
 gcry_cipher_spec_t _gcry_cipher_spec_cast5 =
   {
     "CAST5", NULL, NULL, CAST5_BLOCKSIZE, 128, sizeof (CAST5_context),
-    cast_setkey, encrypt_block, decrypt_block,
+    cast_setkey, encrypt_block, decrypt_block
   };

Modified: trunk/cipher/cipher.c
===================================================================
--- trunk/cipher/cipher.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/cipher.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -75,7 +75,7 @@
 #ifdef USE_SEED
     { &_gcry_cipher_spec_seed,       GCRY_CIPHER_SEED },
 #endif
-    { NULL                    },
+    { NULL                    }
   };
 
 /* List of registered ciphers.  */
@@ -123,8 +123,11 @@
    refuses to provide it's own functions.  */
 
 static gcry_err_code_t
-dummy_setkey (void *c, const unsigned char *key, unsigned keylen)
+dummy_setkey (void *c, const unsigned char *key, unsigned int keylen)
 {
+  (void)c; 
+  (void)key;
+  (void)keylen;
   return GPG_ERR_NO_ERROR;
 }
 
@@ -132,6 +135,9 @@
 dummy_encrypt_block (void *c,
 		     unsigned char *outbuf, const unsigned char *inbuf)
 {
+  (void)c;
+  (void)outbuf;
+  (void)inbuf;
   BUG();
 }
 
@@ -139,6 +145,9 @@
 dummy_decrypt_block (void *c,
 		     unsigned char *outbuf, const unsigned char *inbuf)
 {
+  (void)c;
+  (void)outbuf;
+  (void)inbuf;
   BUG();
 }
 
@@ -147,6 +156,10 @@
 		      unsigned char *outbuf, const unsigned char *inbuf,
 		      unsigned int n)
 {
+  (void)c;
+  (void)outbuf;
+  (void)inbuf;
+  (void)n;
   BUG();
 }
 
@@ -155,6 +168,10 @@
 		      unsigned char *outbuf, const unsigned char *inbuf,
 		      unsigned int n)
 {
+  (void)c;
+  (void)outbuf;
+  (void)inbuf;
+  (void)n;
   BUG();
 }
 
@@ -253,7 +270,7 @@
    and a pointer representhing this module is stored in MODULE.  */
 gcry_error_t
 gcry_cipher_register (gcry_cipher_spec_t *cipher,
-		      unsigned int *algorithm_id,
+		      int *algorithm_id,
 		      gcry_module_t *module)
 {
   gcry_err_code_t err = 0;
@@ -1172,15 +1189,15 @@
  * been requested.
  */
 gcry_error_t
-gcry_cipher_encrypt (gcry_cipher_hd_t h, byte *out, size_t outsize,
-                     const byte *in, size_t inlen)
+gcry_cipher_encrypt (gcry_cipher_hd_t h, void *out, size_t outsize,
+                     const void *in, size_t inlen)
 {
   gcry_err_code_t err;
 
   if (!in)
     /* Caller requested in-place encryption. */
-    /* Actullay cipher_encrypt() does not need to know about it, but
-     * we may change this to get better performance. */
+    /* Actually cipher_encrypt() does not need to know about it, but
+     * we may change it in the future to get better performance.  */
     err = cipher_encrypt (h, out, out, outsize);
   else if (outsize < ((h->flags & GCRY_CIPHER_CBC_MAC) ?
                       h->cipher->blocksize : inlen))
@@ -1257,15 +1274,15 @@
 
 
 gcry_error_t
-gcry_cipher_decrypt (gcry_cipher_hd_t h, byte *out, size_t outsize,
-		     const byte  *in, size_t inlen)
+gcry_cipher_decrypt (gcry_cipher_hd_t h, void *out, size_t outsize,
+		     const void *in, size_t inlen)
 {
-  gcry_err_code_t err = GPG_ERR_NO_ERROR;
+  gcry_err_code_t err = 0;
 
-  if (! in)
+  if (!in)
     /* Caller requested in-place encryption. */
-    /* Actullay cipher_encrypt() does not need to know about it, but
-     * we may chnage this to get better performance. */
+    /* Actually cipher_encrypt() does not need to know about it, but
+     * we may change it in the future to get better performance.  */
     err = cipher_decrypt (h, out, out, outsize);
   else if (outsize < inlen)
     err = GPG_ERR_TOO_SHORT;
@@ -1368,6 +1385,10 @@
 {
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
 
+  (void)h;
+  (void)buffer;
+  (void)nbytes;
+
   switch (cmd)
     {
     default:

Modified: trunk/cipher/crc.c
===================================================================
--- trunk/cipher/crc.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/crc.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -129,8 +129,9 @@
  *
  */
 static u32
-update_crc32 (u32 crc, char *buf, size_t len)
+update_crc32 (u32 crc, const void *buf_arg, size_t len)
 {
+  const char *buf = buf_arg;
   size_t n;
 
   for (n = 0; n < len; n++)
@@ -156,7 +157,7 @@
 }
 
 static void
-crc32_write (void *context, byte * inbuf, size_t inlen)
+crc32_write (void *context, const void *inbuf, size_t inlen)
 {
   CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
   if (!inbuf)
@@ -244,8 +245,9 @@
 }
 
 static void
-crc24rfc2440_write (void *context, byte * inbuf, size_t inlen)
+crc24rfc2440_write (void *context, const void *inbuf_arg, size_t inlen)
 {
+  const unsigned char *inbuf = inbuf_arg;
   int i;
   CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
 

Modified: trunk/cipher/dsa.c
===================================================================
--- trunk/cipher/dsa.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/dsa.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -398,6 +398,9 @@
   gpg_err_code_t err;
   DSA_secret_key sk;
 
+  (void)algo;
+  (void)dummy;
+
   err = generate (&sk, nbits, 0, retfactors);
   if (!err)
     {
@@ -425,6 +428,9 @@
   gpg_err_code_t err;
   DSA_secret_key sk;
 
+  (void)algo;
+  (void)dummy;
+
   err = generate (&sk, nbits, qbits, retfactors);
   if (!err)
     {
@@ -445,6 +451,8 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   DSA_secret_key sk;
 
+  (void)algo;
+
   if ((! skey[0]) || (! skey[1]) || (! skey[2]) || (! skey[3]) || (! skey[4]))
     err = GPG_ERR_BAD_MPI;
   else
@@ -468,6 +476,8 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   DSA_secret_key sk;
 
+  (void)algo;
+
   if ((! data)
       || (! skey[0]) || (! skey[1]) || (! skey[2])
       || (! skey[3]) || (! skey[4]))
@@ -493,6 +503,10 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   DSA_public_key pk;
 
+  (void)algo;
+  (void)cmp;
+  (void)opaquev;
+
   if ((! data[0]) || (! data[1]) || (! hash)
       || (! pkey[0]) || (! pkey[1]) || (! pkey[2]) || (! pkey[3]))
     err = GPG_ERR_BAD_MPI;
@@ -512,10 +526,12 @@
 unsigned int
 _gcry_dsa_get_nbits (int algo, gcry_mpi_t *pkey)
 {
+  (void)algo;
+
   return mpi_get_nbits (pkey[0]);
 }
 
-static char *dsa_names[] =
+static const char *dsa_names[] =
   {
     "dsa",
     "openpgp-dsa",

Modified: trunk/cipher/elgamal.c
===================================================================
--- trunk/cipher/elgamal.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/elgamal.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -528,6 +528,9 @@
 {
   ELG_secret_key sk;
 
+  (void)algo;
+  (void)dummy;
+
   generate (&sk, nbits, retfactors);
   skey[0] = sk.p;
   skey[1] = sk.g;
@@ -544,6 +547,8 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   ELG_secret_key sk;
 
+  (void)algo;
+
   if ((! skey[0]) || (! skey[1]) || (! skey[2]) || (! skey[3]))
     err = GPG_ERR_BAD_MPI;
   else
@@ -568,6 +573,9 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   ELG_public_key pk;
 
+  (void)algo;
+  (void)flags;
+
   if ((! data) || (! pkey[0]) || (! pkey[1]) || (! pkey[2]))
     err = GPG_ERR_BAD_MPI;
   else
@@ -590,6 +598,9 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   ELG_secret_key sk;
 
+  (void)algo;
+  (void)flags;
+
   if ((! data[0]) || (! data[1])
       || (! skey[0]) || (! skey[1]) || (! skey[2]) || (! skey[3]))
     err = GPG_ERR_BAD_MPI;
@@ -612,6 +623,8 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   ELG_secret_key sk;
 
+  (void)algo;
+
   if ((! data)
       || (! skey[0]) || (! skey[1]) || (! skey[2]) || (! skey[3]))
     err = GPG_ERR_BAD_MPI;
@@ -636,6 +649,10 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   ELG_public_key pk;
 
+  (void)algo;
+  (void)cmp;
+  (void)opaquev;
+
   if ((! data[0]) || (! data[1]) || (! hash)
       || (! pkey[0]) || (! pkey[1]) || (! pkey[2]))
     err = GPG_ERR_BAD_MPI;
@@ -655,10 +672,12 @@
 unsigned int
 _gcry_elg_get_nbits (int algo, gcry_mpi_t *pkey)
 {
+  (void)algo;
+
   return mpi_get_nbits (pkey[0]);
 }
 
-static char *elg_names[] =
+static const char *elg_names[] =
   {
     "elg",
     "openpgp-elg",

Modified: trunk/cipher/md.c
===================================================================
--- trunk/cipher/md.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/md.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -130,14 +130,14 @@
 static gcry_err_code_t md_enable (gcry_md_hd_t hd, int algo);
 static gcry_err_code_t md_copy (gcry_md_hd_t a, gcry_md_hd_t *b);
 static void md_close (gcry_md_hd_t a);
-static void md_write (gcry_md_hd_t a, byte *inbuf, size_t inlen);
+static void md_write (gcry_md_hd_t a, const void *inbuf, size_t inlen);
 static void md_final(gcry_md_hd_t a);
 static byte *md_read( gcry_md_hd_t a, int algo );
 static int md_get_algo( gcry_md_hd_t a );
 static int md_digest_length( int algo );
 static const byte *md_asn_oid( int algo, size_t *asnlen, size_t *mdlen );
-static void md_start_debug( gcry_md_hd_t a, char *suffix );
-static void md_stop_debug( gcry_md_hd_t a );
+static void md_start_debug ( gcry_md_hd_t a, const char *suffix );
+static void md_stop_debug ( gcry_md_hd_t a );
 
 
 
@@ -717,7 +717,7 @@
 }
 
 static void
-md_write (gcry_md_hd_t a, byte *inbuf, size_t inlen)
+md_write (gcry_md_hd_t a, const void *inbuf, size_t inlen)
 {
   GcryDigestEntry *r;
   
@@ -741,7 +741,7 @@
 void
 gcry_md_write (gcry_md_hd_t hd, const void *inbuf, size_t inlen)
 {
-  md_write (hd, (unsigned char *) inbuf, inlen);
+  md_write (hd, inbuf, inlen);
 }
 
 static void
@@ -818,7 +818,7 @@
 }
 
 gcry_error_t
-gcry_md_ctl (gcry_md_hd_t hd, int cmd, byte *buffer, size_t buflen)
+gcry_md_ctl (gcry_md_hd_t hd, int cmd, void *buffer, size_t buflen)
 {
   gcry_err_code_t rc = 0;
   
@@ -831,10 +831,10 @@
       rc = gcry_err_code (gcry_md_setkey (hd, buffer, buflen));
       break;
     case GCRYCTL_START_DUMP:
-      md_start_debug (hd, (char*)buffer);
+      md_start_debug (hd, buffer);
       break;
     case GCRYCTL_STOP_DUMP:
-      md_stop_debug( hd );
+      md_stop_debug ( hd );
       break;
     default:
       rc = GPG_ERR_INV_OP;
@@ -859,7 +859,20 @@
   return gcry_error (rc);
 }
 
+/* The new debug interface.  If SUFFIX is a string it creates an debug
+   file for the context HD.  IF suffix is NULL, the file is closed and
+   debugging is stopped.  */
+void
+gcry_md_debug (gcry_md_hd_t hd, const char *suffix)
+{
+  if (suffix)
+    md_start_debug (hd, suffix);
+  else
+    md_stop_debug (hd);
+}
 
+
+
 /****************
  * if ALGO is null get the digest for the used algo (which should be only one)
  */
@@ -954,6 +967,11 @@
 gcry_err_code_t
 gcry_md_get (gcry_md_hd_t hd, int algo, byte *buffer, int buflen)
 {
+  (void)hd;
+  (void)algo;
+  (void)buffer;
+  (void)buflen;
+
   /*md_digest ... */
   return GPG_ERR_INTERNAL;
 }
@@ -1136,31 +1154,34 @@
 
 
 static void
-md_start_debug( gcry_md_hd_t md, char *suffix )
+md_start_debug ( gcry_md_hd_t md, const char *suffix )
 {
   static int idx=0;
   char buf[50];
-
-  if( md->ctx->debug ) {
-    log_debug("Oops: md debug already started\n");
-    return;
-  }
+  
+  if ( md->ctx->debug )
+    {
+      log_debug("Oops: md debug already started\n");
+      return;
+    }
   idx++;
-  sprintf(buf, "dbgmd-%05d.%.10s", idx, suffix );
+  snprintf (buf, DIM(buf)-1, "dbgmd-%05d.%.10s", idx, suffix );
   md->ctx->debug = fopen(buf, "w");
-  if( !md->ctx->debug )
+  if ( !md->ctx->debug )
     log_debug("md debug: can't open %s\n", buf );
 }
 
 static void
 md_stop_debug( gcry_md_hd_t md )
 {
-  if( md->ctx->debug ) {
-    if( md->bufpos )
-      md_write( md, NULL, 0 );
-    fclose(md->ctx->debug);
-    md->ctx->debug = NULL;
-  }
+  if ( md->ctx->debug )
+    {
+      if ( md->bufpos )
+        md_write ( md, NULL, 0 );
+      fclose (md->ctx->debug);
+      md->ctx->debug = NULL;
+    }
+
 #ifdef HAVE_U64_TYPEDEF
   {  /* a kludge to pull in the __muldi3 for Solaris */
     volatile u32 a = (u32)(ulong)md;

Modified: trunk/cipher/md4.c
===================================================================
--- trunk/cipher/md4.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/md4.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -90,7 +90,7 @@
  * transform 64 bytes
  */
 static void
-transform( MD4_CONTEXT *ctx, byte *data )
+transform ( MD4_CONTEXT *ctx, const unsigned char *data )
 {
   u32 in[16];
   register u32 A = ctx->A;
@@ -192,8 +192,9 @@
  * in the message whose digest is being computed.
  */
 static void
-md4_write( void *context, byte *inbuf, size_t inlen)
+md4_write ( void *context, const void *inbuf_arg, size_t inlen)
 {
+  const unsigned char *inbuf = inbuf_arg;
   MD4_CONTEXT *hd = context;
 
   if( hd->count == 64 ) /* flush the buffer */

Modified: trunk/cipher/md5.c
===================================================================
--- trunk/cipher/md5.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/md5.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -80,7 +80,7 @@
  * transform n*64 bytes
  */
 static void
-transform( MD5_CONTEXT *ctx, byte *data )
+transform ( MD5_CONTEXT *ctx, const unsigned char *data )
 {
   u32 correct_words[16];
   register u32 A = ctx->A;
@@ -217,8 +217,9 @@
  * in the message whose digest is being computed.
  */
 static void
-md5_write( void *context, byte *inbuf, size_t inlen)
+md5_write( void *context, const void *inbuf_arg , size_t inlen)
 {
+  const unsigned char *inbuf = inbuf_arg;
   MD5_CONTEXT *hd = context;
   
   if( hd->count == 64 )  /* flush the buffer */

Modified: trunk/cipher/primegen.c
===================================================================
--- trunk/cipher/primegen.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/primegen.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1172,6 +1172,8 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   gcry_mpi_t val_2 = mpi_alloc_set_ui (2); /* Used by the Fermat test. */
 
+  (void)flags;
+
   /* We use 64 rounds because the prime we are going to test is not
      guaranteed to be a random one. */
   if (! check_prime (x, val_2, 64, NULL, NULL))

Modified: trunk/cipher/pubkey.c
===================================================================
--- trunk/cipher/pubkey.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/pubkey.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -93,12 +93,19 @@
 dummy_generate (int algorithm, unsigned int nbits, unsigned long dummy,
                 gcry_mpi_t *skey, gcry_mpi_t **retfactors)
 {
+  (void)algorithm;
+  (void)nbits;
+  (void)dummy;
+  (void)skey;
+  (void)retfactors;
   return GPG_ERR_NOT_IMPLEMENTED;
 }
 
 static gcry_err_code_t
 dummy_check_secret_key (int algorithm, gcry_mpi_t *skey)
 {
+  (void)algorithm;
+  (void)skey;
   return GPG_ERR_NOT_IMPLEMENTED;
 }
 
@@ -106,6 +113,11 @@
 dummy_encrypt (int algorithm, gcry_mpi_t *resarr, gcry_mpi_t data,
                gcry_mpi_t *pkey, int flags)
 {
+  (void)algorithm;
+  (void)resarr;
+  (void)data;
+  (void)pkey;
+  (void)flags;
   return GPG_ERR_NOT_IMPLEMENTED;
 }
 
@@ -113,6 +125,11 @@
 dummy_decrypt (int algorithm, gcry_mpi_t *result, gcry_mpi_t *data,
                gcry_mpi_t *skey, int flags)
 {
+  (void)algorithm;
+  (void)result;
+  (void)data;
+  (void)skey;
+  (void)flags;
   return GPG_ERR_NOT_IMPLEMENTED;
 }
 
@@ -120,6 +137,10 @@
 dummy_sign (int algorithm, gcry_mpi_t *resarr, gcry_mpi_t data,
             gcry_mpi_t *skey)
 {
+  (void)algorithm;
+  (void)resarr;
+  (void)data;
+  (void)skey;
   return GPG_ERR_NOT_IMPLEMENTED;
 }
 
@@ -128,12 +149,20 @@
               gcry_mpi_t *pkey,
 	      int (*cmp) (void *, gcry_mpi_t), void *opaquev)
 {
+  (void)algorithm;
+  (void)hash;
+  (void)data;
+  (void)pkey;
+  (void)cmp;
+  (void)opaquev;
   return GPG_ERR_NOT_IMPLEMENTED;
 }
 
 static unsigned
 dummy_get_nbits (int algorithm, gcry_mpi_t *pkey)
 {
+  (void)algorithm;
+  (void)pkey;
   return 0;
 }
 
@@ -174,7 +203,7 @@
 {
   gcry_pk_spec_t *pubkey = (gcry_pk_spec_t *) spec;
   char *name = (char *) data;
-  char **aliases = pubkey->aliases;
+  const char **aliases = pubkey->aliases;
   int ret = stricmp (name, pubkey->name);
 
   while (ret && *aliases)
@@ -1280,7 +1309,7 @@
             { "md4",    GCRY_MD_MD4 },
             { "tiger",  GCRY_MD_TIGER },
             { "haval",  GCRY_MD_HAVAL },
-            { NULL }
+            { NULL, 0 }
           };
           int algo;
           byte asn[100];

Modified: trunk/cipher/random-daemon.c
===================================================================
--- trunk/cipher/random-daemon.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/random-daemon.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -160,7 +160,7 @@
            return -1; /* write error */
          }
       length -= n;
-      buffer += n;
+      buffer = (const char*)buffer + n;
     }
   return 0;  /* Okay */
 }

Modified: trunk/cipher/random.c
===================================================================
--- trunk/cipher/random.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/random.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -96,8 +96,8 @@
 static int is_initialized;
 static int allow_daemon; /* If true, try to use the daemon first. */
 #define MASK_LEVEL(a) do { (a) &= 3; } while(0)
-static char *rndpool;	/* allocated size is POOLSIZE+BLOCKLEN */
-static char *keypool;	/* allocated size is POOLSIZE+BLOCKLEN */
+static unsigned char *rndpool;	/* Allocated size is POOLSIZE+BLOCKLEN.  */
+static unsigned char *keypool;	/* Allocated size is POOLSIZE+BLOCKLEN.  */
 static size_t pool_readpos;
 static size_t pool_writepos;
 static int pool_filled;
@@ -404,9 +404,9 @@
    1 is strong enough for most usage, 2 is good for key generation
    stuff but may be very slow.  */
 void
-gcry_randomize (byte *buffer, size_t length, enum gcry_random_level level)
+gcry_randomize (void *buffer, size_t length, enum gcry_random_level level)
 {
-  byte *p;
+  unsigned char *p;
   int err;
 
   /* Make sure we are initialized. */
@@ -500,16 +500,16 @@
    To better protect against implementation errors in this code, we
    xor a digest of the entire pool into the pool before mixing.
 
-   Note, that this function muts only be called with a locked pool.
+   Note: this function must only be called with a locked pool.
  */
 static void
-mix_pool(byte *pool)
+mix_pool(unsigned char *pool)
 {
   static unsigned char failsafe_digest[DIGESTLEN];
   static int failsafe_digest_valid;
 
-  char *hashbuf = pool + POOLSIZE;
-  char *p, *pend;
+  unsigned char *hashbuf = pool + POOLSIZE;
+  unsigned char *p, *pend;
   int i, n;
   RMD160_CONTEXT md;
 
@@ -520,14 +520,14 @@
   assert (pool_is_locked);
   _gcry_rmd160_init( &md );
 
-  /* loop over the pool */
+  /* Loop over the pool.  */
   pend = pool + POOLSIZE;
   memcpy(hashbuf, pend - DIGESTLEN, DIGESTLEN );
   memcpy(hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN);
   _gcry_rmd160_mixblock( &md, hashbuf);
   memcpy(pool, hashbuf, 20 );
 
-  if (failsafe_digest_valid && (char *)pool == rndpool)
+  if (failsafe_digest_valid && pool == rndpool)
     {
       for (i=0; i < 20; i++)
         pool[i] ^= failsafe_digest[i];
@@ -543,7 +543,7 @@
         memcpy (hashbuf+DIGESTLEN, p+DIGESTLEN, BLOCKLEN-DIGESTLEN);
       else 
         {
-          char *pp = p + DIGESTLEN;
+          unsigned char *pp = p + DIGESTLEN;
           
           for (i=DIGESTLEN; i < BLOCKLEN; i++ )
             {
@@ -553,7 +553,7 @@
 	    }
 	}
       
-      _gcry_rmd160_mixblock( &md, hashbuf);
+      _gcry_rmd160_mixblock ( &md, hashbuf);
       memcpy(p, hashbuf, 20 );
     }
 
@@ -561,7 +561,7 @@
        of the pool on the stack, so it is okay not to require secure
        memory here.  Before we use this pool, it will be copied to the
        help buffer anyway. */
-    if ( (char*)pool == rndpool)
+    if ( pool == rndpool)
       {
         _gcry_rmd160_hash_buffer (failsafe_digest, pool, POOLSIZE);
         failsafe_digest_valid = 1;
@@ -1186,6 +1186,9 @@
     size_t n;
     char *buffer, *p;
 
+    (void)add;
+    (void)level;
+
     if( !initialized ) {
 	log_info(_("WARNING: using insecure random number generator!!\n"));
 	/* we can't use tty_printf here - do we need this function at
@@ -1221,7 +1224,7 @@
 
 /* Create an unpredicable nonce of LENGTH bytes in BUFFER. */
 void
-gcry_create_nonce (unsigned char *buffer, size_t length)
+gcry_create_nonce (void *buffer, size_t length)
 {
   static unsigned char nonce_buffer[20+8];
   static int nonce_buffer_initialized = 0;

Modified: trunk/cipher/random.h
===================================================================
--- trunk/cipher/random.h	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/random.h	2007-02-21 13:26:38 UTC (rev 1213)
@@ -29,6 +29,7 @@
 void _gcry_secure_random_alloc(void);
 int  _gcry_quick_random_gen( int onoff );
 int  _gcry_random_is_faked(void);
+void _gcry_set_random_daemon_socket (const char *socketname);
 int  _gcry_use_random_daemon (int onoff);
 void _gcry_set_random_seed_file (const char *name);
 void _gcry_update_random_seed_file (void);

Modified: trunk/cipher/rijndael.c
===================================================================
--- trunk/cipher/rijndael.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/rijndael.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -2213,7 +2213,7 @@
 static const char *rijndael_names[] =
   {
     "RIJNDAEL",
-    NULL,
+    NULL
   };
 
 static gcry_cipher_oid_spec_t rijndael_oids[] =
@@ -2228,13 +2228,13 @@
 gcry_cipher_spec_t _gcry_cipher_spec_aes =
   {
     "AES", rijndael_names, rijndael_oids, 16, 128, sizeof (RIJNDAEL_context),
-    rijndael_setkey, rijndael_encrypt, rijndael_decrypt,
+    rijndael_setkey, rijndael_encrypt, rijndael_decrypt
   };
 
 static const char *rijndael192_names[] =
   {
     "RIJNDAEL192",
-    NULL,
+    NULL
   };
 
 static gcry_cipher_oid_spec_t rijndael192_oids[] =
@@ -2249,13 +2249,13 @@
 gcry_cipher_spec_t _gcry_cipher_spec_aes192 =
   {
     "AES192", rijndael192_names, rijndael192_oids, 16, 192, sizeof (RIJNDAEL_context),
-    rijndael_setkey, rijndael_encrypt, rijndael_decrypt,
+    rijndael_setkey, rijndael_encrypt, rijndael_decrypt
   };
 
 static const char *rijndael256_names[] =
   {
     "RIJNDAEL256",
-    NULL,
+    NULL
   };
 
 static gcry_cipher_oid_spec_t rijndael256_oids[] =
@@ -2271,5 +2271,5 @@
   {
     "AES256", rijndael256_names, rijndael256_oids, 16, 256,
     sizeof (RIJNDAEL_context),
-    rijndael_setkey, rijndael_encrypt, rijndael_decrypt,
+    rijndael_setkey, rijndael_encrypt, rijndael_decrypt
   };

Modified: trunk/cipher/rmd.h
===================================================================
--- trunk/cipher/rmd.h	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/rmd.h	2007-02-21 13:26:38 UTC (rev 1213)
@@ -21,16 +21,17 @@
 #define G10_RMD_H
 
 
-/* we need this here because random.c must have direct access */
-typedef struct {
-    u32  h0,h1,h2,h3,h4;
-    u32  nblocks;
-    byte buf[64];
-    int  count;
+/* We need this here because random.c must have direct access. */
+typedef struct 
+{
+  u32  h0,h1,h2,h3,h4;
+  u32  nblocks;
+  byte buf[64];
+  int  count;
 } RMD160_CONTEXT;
 
-void _gcry_rmd160_init( void *context );
-void _gcry_rmd160_mixblock( RMD160_CONTEXT *hd, char *buffer );
+void _gcry_rmd160_init ( void *context );
+void _gcry_rmd160_mixblock ( RMD160_CONTEXT *hd, void *blockof64byte );
 
 #endif /*G10_RMD_H*/
 

Modified: trunk/cipher/rmd160.c
===================================================================
--- trunk/cipher/rmd160.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/rmd160.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -26,7 +26,7 @@
 #include "g10lib.h"
 #include "memory.h"
 #include "rmd.h"
-#include "cipher.h" /* only used for the rmd160_hash_buffer() prototype */
+#include "cipher.h" /* Only used for the rmd160_hash_buffer() prototype. */
 
 #include "bithelp.h"
 
@@ -161,7 +161,7 @@
  * Transform the message X which consists of 16 32-bit-words
  */
 static void
-transform( RMD160_CONTEXT *hd, byte *data )
+transform ( RMD160_CONTEXT *hd, const unsigned char *data )
 {
   register u32 a,b,c,d,e;
   u32 aa,bb,cc,dd,ee,t;
@@ -401,8 +401,9 @@
  * of INBUF with length INLEN.
  */
 static void
-rmd160_write( void *context, byte *inbuf, size_t inlen)
+rmd160_write ( void *context, const void *inbuf_arg, size_t inlen)
 {
+  const unsigned char *inbuf = inbuf_arg;
   RMD160_CONTEXT *hd = context;
 
   if( hd->count == 64 )  /* flush the buffer */
@@ -443,11 +444,11 @@
  * Returns: 16 bytes in buffer with the mixed contentes of buffer.
  */
 void
-_gcry_rmd160_mixblock( RMD160_CONTEXT *hd, char *buffer )
+_gcry_rmd160_mixblock ( RMD160_CONTEXT *hd, void *blockof64byte )
 {
-  char *p = buffer;
+  char *p = blockof64byte;
 
-  transform( hd, (unsigned char *)buffer );
+  transform ( hd, blockof64byte );
 #define X(a) do { *(u32*)p = hd->h##a ; p += 4; } while(0)
   X(0);
   X(1);
@@ -540,14 +541,14 @@
  * into outbuf which must have a size of 20 bytes.
  */
 void
-_gcry_rmd160_hash_buffer( char *outbuf, const char *buffer, size_t length )
+_gcry_rmd160_hash_buffer (void *outbuf, const void *buffer, size_t length )
 {
   RMD160_CONTEXT hd;
 
-  _gcry_rmd160_init( &hd );
-  rmd160_write( &hd, (byte*)buffer, length );
-  rmd160_final( &hd );
-  memcpy( outbuf, hd.buf, 20 );
+  _gcry_rmd160_init ( &hd );
+  rmd160_write ( &hd, buffer, length );
+  rmd160_final ( &hd );
+  memcpy ( outbuf, hd.buf, 20 );
 }
 
 static byte asn[15] = /* Object ID is 1.3.36.3.2.1 */

Modified: trunk/cipher/rndlinux.c
===================================================================
--- trunk/cipher/rndlinux.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/rndlinux.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -36,7 +36,7 @@
 #include "g10lib.h"
 #include "rand-internal.h"
 
-static int open_device( const char *name, int minor );
+static int open_device ( const char *name );
 int _gcry_rndlinux_gather_random (void (*add)(const void*, size_t, int),
                                   int requester,
                                   size_t length, int level );
@@ -60,7 +60,7 @@
  * Used to open the /dev/random devices (Linux, xBSD, Solaris (if it exists)).
  */
 static int
-open_device( const char *name, int minor )
+open_device ( const char *name )
 {
   int fd;
 
@@ -72,9 +72,9 @@
     log_error ("error setting FD_CLOEXEC on fd %d: %s\n",
                fd, strerror (errno));
 
-  /* We used to do the follwing check, however it turned out that this
+  /* We used to do the following check, however it turned out that this
      is not portable since more OSes provide a random device which is
-     sometimes implemented as anoteher device type. 
+     sometimes implemented as another device type. 
      
      struct stat sb;
 
@@ -102,13 +102,13 @@
   if( level >= 2 )
     {
       if( fd_random == -1 )
-        fd_random = open_device( NAME_OF_DEV_RANDOM, 8 );
+        fd_random = open_device ( NAME_OF_DEV_RANDOM );
       fd = fd_random;
     }
   else
     {
       if( fd_urandom == -1 )
-        fd_urandom = open_device( NAME_OF_DEV_URANDOM, 9 );
+        fd_urandom = open_device ( NAME_OF_DEV_URANDOM );
       fd = fd_urandom;
     }
 

Modified: trunk/cipher/rsa.c
===================================================================
--- trunk/cipher/rsa.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/rsa.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -445,6 +445,8 @@
   gpg_err_code_t rc;
   int i;
 
+  (void)algo;
+
   generate (&sk, nbits, use_e);
   skey[0] = sk.n;
   skey[1] = sk.e;
@@ -477,6 +479,8 @@
   gcry_err_code_t err = GPG_ERR_NO_ERROR;
   RSA_secret_key sk;
 
+  (void)algo;
+
   sk.n = skey[0];
   sk.e = skey[1];
   sk.d = skey[2];
@@ -496,6 +500,9 @@
                    gcry_mpi_t *pkey, int flags)
 {
   RSA_public_key pk;
+
+  (void)algo;
+  (void)flags;
   
   pk.n = pkey[0];
   pk.e = pkey[1];
@@ -516,6 +523,8 @@
   gcry_mpi_t x = MPI_NULL;	/* Data to decrypt.  */
   gcry_mpi_t y;			/* Result.  */
 
+  (void)algo;
+
   /* Extract private key.  */
   sk.n = skey[0];
   sk.e = skey[1];
@@ -584,6 +593,8 @@
 _gcry_rsa_sign (int algo, gcry_mpi_t *resarr, gcry_mpi_t data, gcry_mpi_t *skey)
 {
   RSA_secret_key sk;
+
+  (void)algo;
   
   sk.n = skey[0];
   sk.e = skey[1];
@@ -606,6 +617,10 @@
   gcry_mpi_t result;
   gcry_err_code_t rc;
 
+  (void)algo;
+  (void)cmp;
+  (void)opaquev;
+
   pk.n = pkey[0];
   pk.e = pkey[1];
   result = gcry_mpi_new ( 160 );
@@ -621,10 +636,12 @@
 unsigned int
 _gcry_rsa_get_nbits (int algo, gcry_mpi_t *pkey)
 {
+  (void)algo;
+
   return mpi_get_nbits (pkey[0]);
 }
 
-static char *rsa_names[] =
+static const char *rsa_names[] =
   {
     "rsa",
     "openpgp-rsa",

Modified: trunk/cipher/serpent.c
===================================================================
--- trunk/cipher/serpent.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/serpent.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -953,26 +953,26 @@
 static const char *cipher_spec_serpent128_aliases[] =
   {
     "SERPENT",
-    NULL,
+    NULL
   };
 
 gcry_cipher_spec_t _gcry_cipher_spec_serpent128 =
   {
     "SERPENT128", cipher_spec_serpent128_aliases, NULL, 16, 128,
     sizeof (serpent_context_t),
-    serpent_setkey, serpent_encrypt, serpent_decrypt,
+    serpent_setkey, serpent_encrypt, serpent_decrypt
   };
 
 gcry_cipher_spec_t _gcry_cipher_spec_serpent192 =
   {
     "SERPENT192", NULL, NULL, 16, 192,
     sizeof (serpent_context_t),
-    serpent_setkey, serpent_encrypt, serpent_decrypt,
+    serpent_setkey, serpent_encrypt, serpent_decrypt
   };
 
 gcry_cipher_spec_t _gcry_cipher_spec_serpent256 =
   {
     "SERPENT256", NULL, NULL, 16, 256,
     sizeof (serpent_context_t),
-    serpent_setkey, serpent_encrypt, serpent_decrypt,
+    serpent_setkey, serpent_encrypt, serpent_decrypt
   };

Modified: trunk/cipher/sha1.c
===================================================================
--- trunk/cipher/sha1.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/sha1.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -66,7 +66,7 @@
  * Transform the message X which consists of 16 32-bit-words
  */
 static void
-transform( SHA1_CONTEXT *hd, byte *data )
+transform ( SHA1_CONTEXT *hd, const unsigned char *data )
 {
   register u32 a,b,c,d,e,tm;
   u32 x[16];
@@ -209,8 +209,9 @@
  * of INBUF with length INLEN.
  */
 static void
-sha1_write( void *context, byte *inbuf, size_t inlen)
+sha1_write( void *context, const void *inbuf_arg, size_t inlen)
 {
+  const unsigned char *inbuf = inbuf_arg;
   SHA1_CONTEXT *hd = context;
 
   if( hd->count == 64 )  /* flush the buffer */
@@ -332,12 +333,12 @@
  * into outbuf which must have a size of 20 bytes.
  */
 void
-_gcry_sha1_hash_buffer (char *outbuf, const char *buffer, size_t length)
+_gcry_sha1_hash_buffer (void *outbuf, const void *buffer, size_t length)
 {
   SHA1_CONTEXT hd;
 
   sha1_init (&hd);
-  sha1_write (&hd, (byte*)buffer, length);
+  sha1_write (&hd, buffer, length);
   sha1_final (&hd);
   memcpy (outbuf, hd.buf, 20);
 }

Modified: trunk/cipher/sha256.c
===================================================================
--- trunk/cipher/sha256.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/sha256.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -116,7 +116,7 @@
           } while (0)
  
 static void
-transform (SHA256_CONTEXT *hd, byte *data)
+transform (SHA256_CONTEXT *hd, const unsigned char *data)
 {
   static const u32 K[64] = {
     0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
@@ -196,8 +196,9 @@
 /* Update the message digest with the contents of INBUF with length
   INLEN.  */
 static void
-sha256_write (void *context, byte *inbuf, size_t inlen)
+sha256_write (void *context, const void *inbuf_arg, size_t inlen)
 {
+  const unsigned char *inbuf = inbuf_arg;
   SHA256_CONTEXT *hd = context;
 
   if (hd->count == 64)

Modified: trunk/cipher/sha512.c
===================================================================
--- trunk/cipher/sha512.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/sha512.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -104,7 +104,7 @@
  * Transform the message W which consists of 16 64-bit-words
  */
 static void
-transform (SHA512_CONTEXT *hd, byte *data)
+transform (SHA512_CONTEXT *hd, const unsigned char *data)
 {
   u64 a, b, c, d, e, f, g, h;
   u64 w[80];
@@ -230,8 +230,9 @@
  * of INBUF with length INLEN.
  */
 static void
-sha512_write (void *context, byte *inbuf, size_t inlen)
+sha512_write (void *context, const void *inbuf_arg, size_t inlen)
 {
+  const unsigned char *inbuf = inbuf_arg;
   SHA512_CONTEXT *hd = context;
 
   if (hd->count == 128)

Modified: trunk/cipher/tiger.c
===================================================================
--- trunk/cipher/tiger.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/tiger.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -667,7 +667,7 @@
  * Transform the message DATA which consists of 512 bytes (8 words)
  */
 static void
-transform( TIGER_CONTEXT *hd, byte *data )
+transform ( TIGER_CONTEXT *hd, const unsigned char *data )
 {
   u64 a,b,c,aa,bb,cc;
   u64 x[8];
@@ -717,8 +717,9 @@
  * of INBUF with length INLEN.
  */
 static void
-tiger_write( void *context, byte *inbuf, size_t inlen)
+tiger_write ( void *context, const void *inbuf_arg, size_t inlen)
 {
+  const unsigned char *inbuf = inbuf_arg;
   TIGER_CONTEXT *hd = context;
 
   if( hd->count == 64 ) /* flush the buffer */

Modified: trunk/cipher/twofish.c
===================================================================
--- trunk/cipher/twofish.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/twofish.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1030,11 +1030,11 @@
 gcry_cipher_spec_t _gcry_cipher_spec_twofish =
   {
     "TWOFISH", NULL, NULL, 16, 256, sizeof (TWOFISH_context),
-    twofish_setkey, twofish_encrypt, twofish_decrypt,
+    twofish_setkey, twofish_encrypt, twofish_decrypt
   };
 
 gcry_cipher_spec_t _gcry_cipher_spec_twofish128 =
   {
     "TWOFISH128", NULL, NULL, 16, 128, sizeof (TWOFISH_context),
-    twofish_setkey, twofish_encrypt, twofish_decrypt,
+    twofish_setkey, twofish_encrypt, twofish_decrypt
   };

Modified: trunk/cipher/whirlpool.c
===================================================================
--- trunk/cipher/whirlpool.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/cipher/whirlpool.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1194,7 +1194,7 @@
  * Transform block.
  */
 static void
-whirlpool_transform (whirlpool_context_t *context, unsigned char *data)
+whirlpool_transform (whirlpool_context_t *context, const unsigned char *data)
 {
   whirlpool_block_t data_block;
   whirlpool_block_t key;
@@ -1291,8 +1291,9 @@
 
 static void
 whirlpool_add (whirlpool_context_t *context,
-	       unsigned char *buffer, size_t buffer_n)
+	       const void *buffer_arg, size_t buffer_n)
 {
+  const unsigned char *buffer = buffer_arg;
   u64 buffer_size;
   unsigned int carry;
   unsigned int i;
@@ -1303,12 +1304,11 @@
     {
       /* Flush the buffer.  */
       whirlpool_transform (context, context->buffer);
-      //_gcry_burn_stack (80+6*sizeof(void*)); /* FIXME */
+      /*_gcry_burn_stack (80+6*sizeof(void*));*/ /* FIXME */
       context->count = 0;
     }
   if (! buffer)
-    /* Nothing to add.  */
-    return;
+    return; /* Nothing to add.  */
 
   if (context->count)
     {
@@ -1322,7 +1322,7 @@
 	/* Done.  */
         return;
     }
-  //_gcry_burn_stack (80+6*sizeof(void*)); /* FIXME */
+  /*_gcry_burn_stack (80+6*sizeof(void*));*/ /* FIXME */
 
   while (buffer_n >= BLOCK_SIZE) 
     {
@@ -1354,7 +1354,7 @@
 }
 
 static void
-whirlpool_write (void *ctx, unsigned char *buffer, size_t buffer_n)
+whirlpool_write (void *ctx, const void *buffer, size_t buffer_n)
 {
   whirlpool_context_t *context = ctx;
 

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/configure.ac	2007-02-21 13:26:38 UTC (rev 1213)
@@ -23,20 +23,26 @@
 AC_PREREQ(2.59)
 min_automake_version="1.9.3"
 
-# Version number: Remember to change it immediately *after* a release
-# but remove a "-cvs" prefix right *before* a release and append it
-# soon later.
 
-AC_INIT(libgcrypt, 1.3.0-cvs, bug-libgcrypt at gnupg.org)
+# Remember to change the version number immediately *after* a release.
+# Set my_issvn to "yes" for non-released code.  Remember to run an
+# "svn up" and "autogen.sh" right before creating a distribution.
+m4_define([my_version], [1.3.0])
+m4_define([my_issvn], [yes])
 
+m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \
+            || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
+AC_INIT([libgcrypt], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
+        [bug-libgcrypt at gnupg.org])
 # LT Version numbers, remember to change them just *before* a release.
 #   (Interfaces removed:    CURRENT++, AGE=0, REVISION=0)
 #   (Interfaces added:      CURRENT++, AGE++, REVISION=0)
 #   (No interfaces changed:                   REVISION++)
-LIBGCRYPT_LT_CURRENT=12
-LIBGCRYPT_LT_AGE=1
-LIBGCRYPT_LT_REVISION=1
+LIBGCRYPT_LT_CURRENT=14
+LIBGCRYPT_LT_AGE=3
+LIBGCRYPT_LT_REVISION=0
 
+
 # If the API is changed in an incompatible way: increment the next counter.
 LIBGCRYPT_CONFIG_API_VERSION=1
 
@@ -422,16 +428,6 @@
 [use_capabilities="$withval"],[use_capabilities=no])
 AC_MSG_RESULT($use_capabilities)
 
-# We don't have a test to check whether as(1) knows about the
-# non executable stack option.  Thus we provide an option to enable it.
-AC_MSG_CHECKING([whether non excutable stack support is requested])
-AC_ARG_ENABLE(noexecstack,
-              AC_HELP_STRING([--enable-noexecstack],
-                             [enable non executable stack support (gcc only)]),
-              noexecstack_support=$enableval, noexecstack_support=no)
-AC_MSG_RESULT($noexecstack_support)
-
-
 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
                    [A human readable text with the name of the OS])
 
@@ -710,23 +706,25 @@
        test "$more_gcc_warnings" = "yes"; then
         CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
         if test "$more_gcc_warnings" = "yes"; then
-            CFLAGS="$CFLAGS -W -Wpointer-arith -Wbad-function-cast"
-            CFLAGS="$CFLAGS -Wwrite-strings -Wunreachable-code"
+            CFLAGS="$CFLAGS -W -Wextra -Wpointer-arith -Wbad-function-cast"
+            CFLAGS="$CFLAGS -Wwrite-strings"
+            CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+            CFLAGS="$CFLAGS -Wno-missing-field-initializers"
             CFLAGS="$CFLAGS -Wno-sign-compare"
+            # Note: We don't use -Wunreachable-code because this gives
+            # warnings for all asserts and many inline functions like
+            # gpg_error (gcc 4.1.2 20060928).
         fi
     else
         CFLAGS="$CFLAGS -Wall"
     fi
-
-    # Non exec stack hack.  Fixme: Write a test to check whether as
-    # can cope with it and use the enable-noexecstack option only to
-    # disable it in case it is required on some platforms.
-    if test "$noexecstack_support" = yes; then
-        NOEXECSTACK_FLAGS="-Wa,--noexecstack"
-    fi
 fi
-AC_SUBST(NOEXECSTACK_FLAGS)
 
+# Check whether as(1) supports a noeexecstack feature.  This test
+# includes an override option.
+CL_AS_NOEXECSTACK
+
+
 AC_SUBST(LIBGCRYPT_CONFIG_API_VERSION)
 AC_SUBST(LIBGCRYPT_CONFIG_LIBS)
 AC_SUBST(LIBGCRYPT_CONFIG_CFLAGS)
@@ -886,6 +884,7 @@
 
 AC_CONFIG_FILES([
 Makefile
+m4/Makefile
 mpi/Makefile
 cipher/Makefile
 doc/Makefile


Property changes on: trunk/doc
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
Makefile
gcrypt.info
stamp-vti
version.texi


Modified: trunk/doc/gcrypt.texi
===================================================================
--- trunk/doc/gcrypt.texi	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/doc/gcrypt.texi	2007-02-21 13:26:38 UTC (rev 1213)
@@ -2033,11 +2033,26 @@
 
 
 Tracking bugs related to hashing is often a cumbersome task which
-requires to add a lot of printf statements into the code.  @acronym{Libgcrypt}
-provides an easy way to avoid this.  The actual data hashed can be
-written to files on request.  The following 2 macros should be used to
-implement such a debugging facility:
+requires to add a lot of printf statements into the code.
+ at acronym{Libgcrypt} provides an easy way to avoid this.  The actual data
+hashed can be written to files on request.
 
+ at deftypefun void gcry_md_debug (gcry_md_hd_t @var{h}, const char *@var{suffix})
+
+Enable debugging for the digest object with handle @var{h}.  This
+creates create files named @file{dbgmd-<n>.<string>} while doing the
+actual hashing.  @var{suffix} is the string part in the filename.  The
+number is a counter incremented for each new hashing.  The data in the
+file is the raw data as passed to @code{gcry_md_write} or
+ at code{gcry_md_putc}.  If @code{NULL} is used for @var{suffix}, the
+debugging is stopped and the file closed.  This is only rarely required
+because @code{gcry_md_close} implicitly stops debugging.
+ at end deftypefun
+
+
+The following two deprecated macros are used for debugging by old code.
+They shopuld be replaced by @code{gcry_md_debug}.
+
 @deftypefun void gcry_md_start_debug (gcry_md_hd_t @var{h}, const char *@var{suffix})
 
 Enable debugging for the digest object with handle @var{h}.  This

Modified: trunk/m4/ChangeLog
===================================================================
--- trunk/m4/ChangeLog	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/m4/ChangeLog	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1,3 +1,9 @@
+2007-02-20  Werner Koch  <wk at g10code.com>
+
+	* Makefile.am: New.
+
+	* noexecstack.m4:  New.  Taken from gnupg 1.4
+
 2006-10-11  Marcus Brinkmann  <marcus at g10code.de>
 
 	* fallback.m4: Removed again.

Added: trunk/m4/Makefile.am
===================================================================
--- trunk/m4/Makefile.am	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/m4/Makefile.am	2007-02-21 13:26:38 UTC (rev 1213)
@@ -0,0 +1 @@
+EXTRA_DIST = libtool.m4 onceonly.m4 socklen.m4 sys_socket_h.m4 noexecstack.m4

Added: trunk/m4/noexecstack.m4
===================================================================
--- trunk/m4/noexecstack.m4	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/m4/noexecstack.m4	2007-02-21 13:26:38 UTC (rev 1213)
@@ -0,0 +1,55 @@
+# noexecstack.m4
+dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+
+dnl Checks whether the stack can be marked nonexecutable by passing an
+dnl option to the C-compiler when acting on .s files.  Returns that
+dnl option in NOEXECSTACK_FLAGS.
+dnl This macro is adapted from one found in GLIBC-2.3.5.
+AC_DEFUN([CL_AS_NOEXECSTACK],[
+AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AM_PROG_AS])
+
+AC_MSG_CHECKING([whether non excutable stack support is requested])
+AC_ARG_ENABLE(noexecstack,
+              AC_HELP_STRING([--enable-noexecstack],
+                             [enable non executable stack support (gcc only)]),
+              noexecstack_support=$enableval, noexecstack_support=no)
+AC_MSG_RESULT($noexecstack_support)
+
+AC_CACHE_CHECK([whether assembler supports --noexecstack option],
+cl_cv_as_noexecstack, [dnl
+  cat > conftest.c <<EOF
+void foo() {}
+EOF
+  if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS
+                     -S -o conftest.s conftest.c >/dev/null]) \
+     && grep -q .note.GNU-stack conftest.s \
+     && AC_TRY_COMMAND([${CCAS} $CCASFLAGS $CPPFLAGS -Wa,--noexecstack
+                       -c -o conftest.o conftest.s >/dev/null])
+  then
+    cl_cv_as_noexecstack=yes
+  else
+    cl_cv_as_noexecstack=no
+  fi
+  rm -f conftest*])
+  if test "$noexecstack_support" = yes -a "$cl_cv_as_noexecstack" = yes; then
+	NOEXECSTACK_FLAGS="-Wa,--noexecstack"
+  else
+        NOEXECSTACK_FLAGS=
+  fi
+  AC_SUBST(NOEXECSTACK_FLAGS)
+])


Property changes on: trunk/mpi
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
Makefile
asm-syntax.h
mpi-asm-defs.h
mpih-add1.S
mpih-lshift.S
mpih-mul1.S
mpih-mul2.S
mpih-mul3.S
mpih-rshift.S
mpih-sub1.S
sysdep.h


Modified: trunk/mpi/ChangeLog
===================================================================
--- trunk/mpi/ChangeLog	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/mpi/ChangeLog	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1,3 +1,7 @@
+2007-02-21  Werner Koch  <wk at g10code.com>
+
+	* mpicoder.c (_gcry_mpi_set_buffer): Made BUFFER a void*.
+
 2006-11-15  Werner Koch  <wk at g10code.com>
 
 	* Makefile.am (.S.o): Check for srcdir also in in CPP pass.

Modified: trunk/mpi/mpicoder.c
===================================================================
--- trunk/mpi/mpicoder.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/mpi/mpicoder.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -274,8 +274,10 @@
  * Use BUFFER to update MPI.
  */
 void
-_gcry_mpi_set_buffer( gcry_mpi_t a, const byte *buffer, unsigned nbytes, int sign )
+_gcry_mpi_set_buffer ( gcry_mpi_t a, const void *buffer_arg,
+                       unsigned int nbytes, int sign )
 {
+    const unsigned char *buffer = (const unsigned char*)buffer_arg;
     const byte *p;
     mpi_limb_t alimb;
     int nlimbs;

Modified: trunk/mpi/mpiutil.c
===================================================================
--- trunk/mpi/mpiutil.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/mpi/mpiutil.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -450,10 +450,13 @@
 void
 gcry_mpi_clear_flag( gcry_mpi_t a, enum gcry_mpi_flag flag )
 {
-    switch( flag ) {
-      case GCRYMPI_FLAG_SECURE:
-      case GCRYMPI_FLAG_OPAQUE:
-      default: log_bug("invalid flag value\n");
+  (void)a; /* Not yet used. */
+
+  switch (flag)
+    {
+    case GCRYMPI_FLAG_SECURE:
+    case GCRYMPI_FLAG_OPAQUE:
+    default: log_bug("invalid flag value\n");
     }
 }
 


Property changes on: trunk/src
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
Makefile
gcrypt.h
gcryptrnd
getrandom
libgcrypt-config


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/ChangeLog	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1,3 +1,29 @@
+2007-02-21  Werner Koch  <wk at g10code.com>
+
+	* gcrypt.h.in (gcry_sexp_sprint): Change BUFFER from char* to void*.
+	(gcry_md_ctl): Change BUFFER from unsigned char* to void*.
+	(gcry_md_debug): New.
+	(gcry_cipher_encrypt, gcry_cipher_decrypt): Change buffer args to
+	void*.
+	(gcry_randomize): Change BUFFER to void.
+	(gcry_create_nonce): Ditto.
+
+	* libgcrypt.vers (gcry_md_debug): New.
+
+	* sexp.c (gcry_sexp_sprint): Ditto.
+	(normalize): Make P unsigned.
+	(gcry_sexp_nth_data): Cast return value to char*.
+	(sexp_sscan): Fix sign/unsigned conflicts.
+	(whitespacep): Change P to char*.
+	(unquote_string): Change STRING to char*.
+	(convert_to_hex): Change DEST to char*.
+	(convert_to_string): Change DEST and P to char*.
+	(convert_to_token): Chnage DEST to char*.
+	(gcry_sexp_canon_len): Change DISPHINT to unsigned char*.
+
+	* gcrypt-module.h (gcry_pk_spec): Made ALIASES a const.
+	(gcry_md_write_t): Changed BUF to a const void*.
+
 2007-02-12  Werner Koch  <wk at g10code.com>
 
 	* gcrypt.h.in: Include stdlib.h for the sake fo the trheading

Modified: trunk/src/cipher.h
===================================================================
--- trunk/src/cipher.h	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/cipher.h	2007-02-21 13:26:38 UTC (rev 1213)
@@ -29,9 +29,11 @@
 #define PUBKEY_FLAG_NO_BLINDING (1 << 0)
 
 /*-- rmd160.c --*/
-void _gcry_rmd160_hash_buffer (char *outbuf, const char *buffer, size_t length);
+void _gcry_rmd160_hash_buffer (void *outbuf,
+                               const void *buffer, size_t length);
 /*-- sha1.c --*/
-void _gcry_sha1_hash_buffer (char *outbuf, const char *buffer, size_t length);
+void _gcry_sha1_hash_buffer (void *outbuf,
+                             const void *buffer, size_t length);
 
 /*-- dsa.c --*/
 void _gcry_register_pk_dsa_progress (gcry_handler_progress_t cbc, void *cb_data);

Modified: trunk/src/gcrypt-module.h
===================================================================
--- trunk/src/gcrypt-module.h	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/gcrypt-module.h	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1,26 +1,28 @@
-/* gcrypt-module.h - GNU cryptographic library interface
- * Copyright (C) 2003 Free Software Foundation, Inc.
- *
- * This file is part of Libgcrypt.
- *
- * Libgcrypt is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * Libgcrypt is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+/* gcrypt-module.h - GNU Cryptographic Library Interface
+   Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+  
+   This file is part of Libgcrypt.
+  
+   Libgcrypt is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of
+   the License, or (at your option) any later version.
+  
+   Libgcrypt is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+  
+   You should have received a copy of the GNU Lesser General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+/*
+   This file contains the necessary declarations/definitions for
+   working with Libgcrypt modules.  
  */
 
-/* This file contains the necessary declarations/definitions for
-   working with Libgcrypt modules.  */
-
 #ifndef _GCRYPT_MODULE_H
 #define _GCRYPT_MODULE_H
 
@@ -89,7 +91,7 @@
    CIPHER.  On success, a new algorithm ID is stored in ALGORITHM_ID
    and a pointer representhing this module is stored in MODULE.  */
 gcry_error_t gcry_cipher_register (gcry_cipher_spec_t *cipher,
-				   unsigned int *algorithm_id,
+				   int *algorithm_id,
 				   gcry_module_t *module);
 
 /* Unregister the cipher identified by MODULE, which must have been
@@ -144,7 +146,7 @@
 typedef struct gcry_pk_spec
 {
   const char *name;
-  char **aliases;
+  const char **aliases;
   const char *elements_pkey;
   const char *elements_skey;
   const char *elements_enc;
@@ -177,7 +179,7 @@
 typedef void (*gcry_md_init_t) (void *c);
 
 /* Type for the md_write function.  */
-typedef void (*gcry_md_write_t) (void *c, unsigned char *buf, size_t nbytes);
+typedef void (*gcry_md_write_t) (void *c, const void *buf, size_t nbytes);
 
 /* Type for the md_final function.  */
 typedef void (*gcry_md_final_t) (void *c);

Modified: trunk/src/gcrypt.h.in
===================================================================
--- trunk/src/gcrypt.h.in	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/gcrypt.h.in	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1,24 +1,26 @@
-/* gcrypt.h -  GNU cryptographic library interface              -*- c -*-
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
- *               2004, 2006  Free Software Foundation, Inc.
- *
- * This file is part of Libgcrypt.
- *
- * Libgcrypt is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * Libgcrypt is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+/* gcrypt.h -  GNU Cryptographic Library Interface              -*- c -*-
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
+                 2004, 2006, 2007  Free Software Foundation, Inc.
+  
+   This file is part of Libgcrypt.
+  
+   Libgcrypt is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of
+   the License, or (at your option) any later version.
+  
+   Libgcrypt is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+  
+   You should have received a copy of the GNU Lesser General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA. 
 
+   File: @configure_input@ */
+
 #ifndef _GCRYPT_H
 #define _GCRYPT_H
 
@@ -417,7 +419,7 @@
 
 /* Copies the S-expression object SEXP into BUFFER using the format
    specified in MODE.  */
-size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, char *buffer,
+size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer,
                          size_t maxlength);
 
 /* Dumps the S-expression object A in a aformat suitable for debugging
@@ -826,13 +828,13 @@
    most algorithms it is possible to pass NULL for in and 0 for INLEN
    and do a in-place decryption of the data provided in OUT.  */
 gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t h,
-                                 unsigned char *out, size_t outsize,
-                                 const unsigned char *in, size_t inlen);
+                                  void *out, size_t outsize,
+                                  const void *in, size_t inlen);
 
 /* The counterpart to gcry_cipher_encrypt.  */
 gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t h,
-                                 unsigned char *out, size_t outsize,
-                                 const unsigned char *in, size_t inlen);
+                                  void *out, size_t outsize,
+                                  const void *in, size_t inlen);
 
 /* Set key K of length L for the cipher handle H.  (We have to cast
    away a const char* here - this catch-all ctl function was probably
@@ -1045,9 +1047,9 @@
 /* Reset the digest object HD to its initial state.  */
 void gcry_md_reset (gcry_md_hd_t hd);
 
-/* Perform various operations on the digets object HD. */
-gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd, unsigned char *buffer,
-                         size_t buflen);
+/* Perform various operations on the digest object HD. */
+gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd,
+                          void *buffer, size_t buflen);
 
 /* Pass LENGTH bytes of data in BUFFER to the digest object HD so that
    it can update the digest values.  This is the actual hash
@@ -1102,6 +1104,12 @@
    KEYLEN. */
 gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen);
 
+/* Start or stop debugging for digest handle HD; i.e. create a file
+   named dbgmd-<n>.<suffix> while hashing.  If SUFFIX is NULL,
+   debugging stops and the file will be closed. */
+void gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
+
+
 /* Update the hash(s) of H with the character C.  This is a buffered
    version of the gcry_md_write function. */
 #define gcry_md_putc(h,c)  \
@@ -1128,13 +1136,14 @@
 #define gcry_md_get_asnoid(a,b,n) \
             gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n))
 
-/* Enable debugging for digets object A; i.e. create files named
+/* Enable debugging for digest object A; i.e. create files named
    dbgmd-<n>.<string> while hashing.  B is a string used as the suffix
-   for the filename. */
+   for the filename.  This macro is deprecated, use gcry_md_debug. */
 #define gcry_md_start_debug(a,b) \
             gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
 
-/* Disable the debugging of A. */
+/* Disable the debugging of A.  This macro is deprecated, use
+   gcry_md_debug.  */
 #define gcry_md_stop_debug(a,b) \
             gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
 
@@ -1537,7 +1546,7 @@
 
 /* Fill BUFFER with LENGTH bytes of random, using random numbers of
    quality LEVEL. */
-void gcry_randomize (unsigned char *buffer, size_t length,
+void gcry_randomize (void *buffer, size_t length,
                      enum gcry_random_level level);
 
 /* Add the external random from BUFFER with LENGTH bytes into the
@@ -1571,7 +1580,7 @@
 
 
 /* Create an unpredicable nonce of LENGTH bytes in BUFFER. */
-void gcry_create_nonce (unsigned char *buffer, size_t length);
+void gcry_create_nonce (void *buffer, size_t length);
 
 
 

Modified: trunk/src/gcryptrnd.c
===================================================================
--- trunk/src/gcryptrnd.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/gcryptrnd.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -106,6 +106,8 @@
 static void
 my_gcry_logger (void *dummy, int level, const char *format, va_list arg_ptr)
 {
+  (void)dummy;
+
   /* Map the log levels. */
   switch (level)
     {
@@ -391,7 +393,7 @@
            return -1; /* write error */
          }
       length -= n;
-      buffer += n;
+      buffer = (const char*)buffer + n;
     }
   return 0;  /* Okay */
 }

Modified: trunk/src/getrandom.c
===================================================================
--- trunk/src/getrandom.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/getrandom.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -66,7 +66,7 @@
            return -1; /* write error */
          }
       length -= n;
-      buffer += n;
+      buffer = (const char *)buffer + n;
     }
   return 0;  /* Okay */
 }

Modified: trunk/src/global.c
===================================================================
--- trunk/src/global.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/global.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -525,6 +525,8 @@
 void
 _gcry_check_heap( const void *a )
 {
+  (void)a;
+  
     /* FIXME: implement this*/
 #if 0
     if( some_handler )

Modified: trunk/src/libgcrypt.vers
===================================================================
--- trunk/src/libgcrypt.vers	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/libgcrypt.vers	2007-02-21 13:26:38 UTC (rev 1213)
@@ -39,7 +39,7 @@
     gcry_md_info; gcry_md_is_enabled; gcry_md_is_secure;
     gcry_md_list; gcry_md_map_name; gcry_md_open; gcry_md_read;
     gcry_md_register; gcry_md_reset; gcry_md_setkey; 
-    gcry_md_unregister; gcry_md_write;
+    gcry_md_unregister; gcry_md_write; gcry_md_debug;
     
     gcry_cipher_algo_info; gcry_cipher_algo_name; gcry_cipher_close;
     gcry_cipher_ctl; gcry_cipher_decrypt; gcry_cipher_encrypt;

Modified: trunk/src/mpi.h
===================================================================
--- trunk/src/mpi.h	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/mpi.h	2007-02-21 13:26:38 UTC (rev 1213)
@@ -126,7 +126,8 @@
 u32   _gcry_mpi_get_keyid( gcry_mpi_t a, u32 *keyid );
 byte *_gcry_mpi_get_buffer( gcry_mpi_t a, unsigned *nbytes, int *sign );
 byte *_gcry_mpi_get_secure_buffer( gcry_mpi_t a, unsigned *nbytes, int *sign );
-void  _gcry_mpi_set_buffer( gcry_mpi_t a, const byte *buffer, unsigned nbytes, int sign );
+void  _gcry_mpi_set_buffer ( gcry_mpi_t a, const void *buffer, 
+                             unsigned int nbytes, int sign );
 
 #define log_mpidump _gcry_log_mpidump
 

Modified: trunk/src/sexp.c
===================================================================
--- trunk/src/sexp.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/src/sexp.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -63,7 +63,7 @@
    to the S-expressions definition. */
 #undef whitespacep
 static GPG_ERR_INLINE int
-whitespacep (const unsigned char *p)
+whitespacep (const char *p)
 { 
   switch (*p)
     {
@@ -169,22 +169,25 @@
 static gcry_sexp_t
 normalize ( gcry_sexp_t list )
 {
-    char *p;
-    if ( !list )
-	return NULL;
-    p = list->d;
-    if ( *p == ST_STOP ) {
-	/* this is "" */
-	gcry_sexp_release ( list );
-	return NULL;
+  unsigned char *p;
+
+  if ( !list )
+    return NULL;
+  p = list->d;
+  if ( *p == ST_STOP ) 
+    {
+      /* this is "" */
+      gcry_sexp_release ( list );
+      return NULL;
     }
-    if( *p == ST_OPEN && p[1] == ST_CLOSE ) {
-	/* this is "()" */
-	gcry_sexp_release ( list );
-	return NULL;
+  if ( *p == ST_OPEN && p[1] == ST_CLOSE )
+    {
+      /* this is "()" */
+      gcry_sexp_release ( list );
+      return NULL;
     }
-
-    return list;
+  
+  return list;
 }
 
 /* Create a new S-expression object by reading LENGTH bytes from
@@ -304,6 +307,9 @@
 gcry_sexp_t
 gcry_sexp_cons( const gcry_sexp_t a, const gcry_sexp_t b )
 {
+  (void)a;
+  (void)b;
+
   /* NYI: Implementation should be quite easy with our new data
      representation */
   BUG ();
@@ -318,6 +324,8 @@
 gcry_sexp_t
 gcry_sexp_alist( const gcry_sexp_t *array )
 {
+  (void)array;
+
   /* NYI: Implementation should be quite easy with our new data
      representation. */
   BUG ();
@@ -330,6 +338,7 @@
 gcry_sexp_t
 gcry_sexp_vlist( const gcry_sexp_t a, ... )
 {
+  (void)a;
   /* NYI: Implementation should be quite easy with our new data
      representation. */
   BUG ();
@@ -344,6 +353,8 @@
 gcry_sexp_t
 gcry_sexp_append( const gcry_sexp_t a, const gcry_sexp_t n )
 {
+  (void)a;
+  (void)n;
   /* NYI: Implementation should be quite easy with our new data
      representation. */
   BUG ();
@@ -353,6 +364,8 @@
 gcry_sexp_t
 gcry_sexp_prepend( const gcry_sexp_t a, const gcry_sexp_t n )
 {
+  (void)a;
+  (void)n;
   /* NYI: Implementation should be quite easy with our new data
      representation. */
   BUG ();
@@ -617,7 +630,7 @@
     if ( *p == ST_DATA ) {
 	memcpy ( &n, ++p, sizeof n );
 	*datalen = n;
-	return p + sizeof n;
+	return (const char*)p + sizeof n;
     }
 
     return NULL;
@@ -828,10 +841,10 @@
    quotes are must already be removed from STRING.  We assume that the
    quoted string is syntacillay correct.  */
 static size_t
-unquote_string (const unsigned char *string, size_t length, unsigned char *buf)
+unquote_string (const char *string, size_t length, unsigned char *buf)
 {
   int esc = 0;
-  const unsigned char *s = string;
+  const unsigned char *s = (const unsigned char*)string;
   unsigned char *d = buf;
   size_t n = length;
 
@@ -1088,7 +1101,7 @@
 	    {
 	      /* Keep it easy - we know that the unquoted string will
 		 never be larger. */
-	      char *save;
+	      unsigned char *save;
 	      size_t len;
 	      
 	      quoted++; /* Skip leading quote.  */
@@ -1123,7 +1136,7 @@
 		{
 		  if (whitespacep (hexfmt))
 		    continue;
-		  *c.pos++ = hextobyte (hexfmt);
+		  *c.pos++ = hextobyte ((const unsigned char*)hexfmt);
 		  hexfmt++;
 		}
 	      hexfmt = NULL;
@@ -1517,7 +1530,7 @@
 
 
 static int
-convert_to_hex (const unsigned char *src, size_t len, unsigned char *dest)
+convert_to_hex (const unsigned char *src, size_t len, char *dest)
 {
   int i;
 
@@ -1532,11 +1545,11 @@
 }
 
 static int
-convert_to_string (const unsigned char *s, size_t len, unsigned char *dest)
+convert_to_string (const unsigned char *s, size_t len, char *dest)
 {
   if (dest)
     {
-      unsigned char *p = dest;
+      char *p = dest;
       *p++ = '\"';
       for (; len; len--, s++ )
         {
@@ -1594,7 +1607,7 @@
 
 
 static int
-convert_to_token (const unsigned char *src, size_t len, unsigned char *dest)
+convert_to_token (const unsigned char *src, size_t len, char *dest)
 {
   if (dest)
     memcpy (dest, src, len);
@@ -1609,11 +1622,11 @@
  * the required length is returned.
  */
 size_t
-gcry_sexp_sprint( const gcry_sexp_t list, int mode,
-					char *buffer, size_t maxlength )
+gcry_sexp_sprint (const gcry_sexp_t list, int mode,
+                  void *buffer, size_t maxlength )
 {
-  static byte empty[3] = { ST_OPEN, ST_CLOSE, ST_STOP };
-  const byte *s;
+  static unsigned char empty[3] = { ST_OPEN, ST_CLOSE, ST_STOP };
+  const unsigned char *s;
   char *d;
   DATALEN n;
   char numbuf[20];
@@ -1764,7 +1777,7 @@
                      size_t *erroff, gcry_error_t *errcode)
 {
   const unsigned char *p;
-  const char *disphint=NULL;
+  const unsigned char *disphint = NULL;
   unsigned int datalen = 0;
   size_t dummy_erroff;
   gcry_error_t dummy_errcode;
@@ -1857,7 +1870,7 @@
 	}
       else if (*p == ']')
         {
-          if( !disphint ) 
+          if ( !disphint ) 
             {
               *erroff = count;
               *errcode = gcry_error (GPG_ERR_SEXP_UNMATCHED_DH);


Property changes on: trunk/tests
___________________________________________________________________
Name: svn:ignore
   + ac-data
ac-schemes
ac
basic
benchmark
hmac
keygen
keygrip
pkbench
prime
pubkey
register
t-mpi-bit
tsexp


Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/tests/ChangeLog	2007-02-21 13:26:38 UTC (rev 1213)
@@ -1,3 +1,12 @@
+2007-02-21  Werner Koch  <wk at g10code.com>
+
+	* hmac.c (check_one_mac): Make pointer args const.
+	* basic.c (check_one_md): Ditto.
+	(check_one_hmac): Ditto.
+
+	* keygen.c (progress_cb): Filter out line feeds.
+	* basic.c (progress_handler): Ditto.
+
 2006-12-18  Werner Koch  <wk at g10code.com>
 
 	* Makefile.am (AM_CFLAGS, AM_CPPFLAGS): Splitted and merged with

Modified: trunk/tests/basic.c
===================================================================
--- trunk/tests/basic.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/tests/basic.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -79,7 +79,16 @@
 progress_handler (void *cb_data, const char *what, int printchar,
 		  int current, int total)
 {
-  putchar (printchar);
+  (void)cb_data;
+  (void)what;
+  (void)current;
+  (void)total;
+  
+  if (printchar == '\n')
+    fputs ( "<LF>", stdout);
+  else
+    putchar (printchar);
+  fflush (stdout);
 }
 
 static void
@@ -1004,7 +1013,7 @@
 
 
 static void
-check_one_md (int algo, char *data, int len, char *expect)
+check_one_md (int algo, const char *data, int len, const char *expect)
 {
   gcry_md_hd_t hd, hd2;
   unsigned char *p;
@@ -1069,8 +1078,8 @@
   static struct algos
   {
     int md;
-    char *data;
-    char *expect;
+    const char *data;
+    const char *expect;
   } algos[] =
     {
       { GCRY_MD_MD4, "",
@@ -1245,8 +1254,8 @@
 }
 
 static void
-check_one_hmac (int algo, char *data, int datalen, 
-		char *key, int keylen, char *expect)
+check_one_hmac (int algo, const char *data, int datalen, 
+		const char *key, int keylen, const char *expect)
 {
   gcry_md_hd_t hd, hd2;
   unsigned char *p;
@@ -1306,9 +1315,9 @@
   static struct algos
   {
     int md;
-    char *data;
-    char *key;
-    char *expect;
+    const char *data;
+    const char *key;
+    const char *expect;
   } algos[] =
     {
       { GCRY_MD_MD5, "what do ya want for nothing?", "Jefe",
@@ -1666,6 +1675,8 @@
       { NULL }
     };
 
+  (void)n;
+
   rc = gcry_sexp_sscan (&badhash, NULL, baddata, strlen (baddata));
   if (rc)
     die ("converting data failed: %s\n", gpg_strerror (rc));
@@ -1736,7 +1747,8 @@
   if (err)
     die ("converting sample key failed: %s\n", gpg_strerror (err));
 
-  do_check_one_pubkey (n, skey, pkey, spec.key.grip, spec.flags);
+  do_check_one_pubkey (n, skey, pkey,
+                       (const unsigned char*)spec.key.grip, spec.flags);
  
   gcry_sexp_release (skey);
   gcry_sexp_release (pkey);

Modified: trunk/tests/hmac.c
===================================================================
--- trunk/tests/hmac.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/tests/hmac.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -57,12 +57,12 @@
 
 static void
 check_one_mac (int algo,
-               void *key, size_t keylen,
-               void *data, size_t datalen,
-               char *expect)
+               const void *key, size_t keylen,
+               const void *data, size_t datalen,
+               const char *expect)
 {
   gcry_md_hd_t hd;
-  char *p;
+  unsigned char *p;
   int mdlen;
   int i;
   gcry_error_t err = 0;

Modified: trunk/tests/keygen.c
===================================================================
--- trunk/tests/keygen.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/tests/keygen.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -271,7 +271,15 @@
 progress_cb (void *cb_data, const char *what, int printchar,
 		  int current, int total)
 {
-  putchar (printchar);
+  (void)cb_data;
+  (void)what;
+  (void)current;
+  (void)total;
+  
+  if (printchar == '\n')
+    fputs ( "<LF>", stdout);
+  else
+    putchar (printchar);
   fflush (stdout);
 }
 

Modified: trunk/tests/keygrip.c
===================================================================
--- trunk/tests/keygrip.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/tests/keygrip.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -113,6 +113,11 @@
 progress_handler (void *cb_data, const char *what, int printchar,
 		  int current, int total)
 {
+  (void)cb_data;
+  (void)what;
+  (void)current;
+  (void)total;
+
   putchar (printchar);
 }
 

Modified: trunk/tests/register.c
===================================================================
--- trunk/tests/register.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/tests/register.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -45,6 +45,10 @@
 gcry_err_code_t
 foo_setkey (void *c, const unsigned char *key, unsigned keylen)
 {
+  (void)c;
+  (void)key;
+  (void)keylen;
+
   return 0;
 }
 
@@ -55,6 +59,8 @@
 {
   int i;
 
+  (void)c;
+
   for (i = 0; i < FOO_BLOCKSIZE; i++)
     outbuf[i] = inbuf[i] ^ 0x42;
 }
@@ -64,6 +70,8 @@
 {
   int i;
 
+  (void)c;
+
   for (i = 0; i < FOO_BLOCKSIZE; i++)
     outbuf[i] = inbuf[i] ^ 0x42;
 }

Modified: trunk/tests/tsexp.c
===================================================================
--- trunk/tests/tsexp.c	2007-02-20 11:28:12 UTC (rev 1212)
+++ trunk/tests/tsexp.c	2007-02-21 13:26:38 UTC (rev 1213)
@@ -222,7 +222,7 @@
     size_t expected;/* expected length or 0 on error and then ... */
     size_t erroff;  /* ... and at this offset */
     gcry_error_t errcode;    /* ... with this error code */
-    unsigned char *text; 
+    const char *text; 
   } values[] = {
     { 14, 13, 0, GPG_ERR_NO_ERROR, "(9:abcdefghi) " },
     { 16, 15, 0, GPG_ERR_NO_ERROR, "(10:abcdefghix)" },
@@ -341,7 +341,7 @@
 static void
 back_and_forth (void)
 {
-  static struct { char *buf; int len; } tests[] = {
+  static struct { const char *buf; int len; } tests[] = {
     { "(7:g34:fgh1::2:())", 0 },
     { "(7:g34:fgh1::2:())", 18 },
     {




More information about the Gnupg-commits mailing list