LIBGCRYPT-1-2-BRANCH libgcrypt (12 files)

cvs user wk cvs at cvs.gnupg.org
Thu Jun 16 09:50:41 CEST 2005


    Date: Thursday, June 16, 2005 @ 10:13:14
  Author: wk
    Path: /cvs/libgcrypt/libgcrypt
     Tag: LIBGCRYPT-1-2-BRANCH

Modified: NEWS cipher/ChangeLog cipher/cipher.c cipher/md.c
          cipher/random.c doc/ChangeLog doc/gcrypt.texi mpi/ChangeLog
          mpi/mpicoder.c src/ChangeLog src/gcrypt.h src/sexp.c

* gcrypt.texi: Adjusted function prototypes.

* mpicoder.c (gcry_mpi_scan): Changed arg BUFFER to void*.

* gcrypt.h (gcry_mpi_scan): Changed arg BUFFER from unsigned char*
to void*.


------------------+
 NEWS             |   14 ++++++++++++++
 cipher/ChangeLog |    9 +++++++++
 cipher/cipher.c  |    8 ++++----
 cipher/md.c      |    7 ++++---
 cipher/random.c  |    4 ++--
 doc/ChangeLog    |    4 ++++
 doc/gcrypt.texi  |   12 ++++++------
 mpi/ChangeLog    |    4 ++++
 mpi/mpicoder.c   |    3 ++-
 src/ChangeLog    |   16 ++++++++++++++++
 src/gcrypt.h     |   20 ++++++++++----------
 src/sexp.c       |    8 ++++----
 12 files changed, 79 insertions(+), 30 deletions(-)


Index: libgcrypt/NEWS
diff -u libgcrypt/NEWS:1.69.2.3 libgcrypt/NEWS:1.69.2.4
--- libgcrypt/NEWS:1.69.2.3	Wed Jan  5 17:44:35 2005
+++ libgcrypt/NEWS	Thu Jun 16 10:13:13 2005
@@ -1,6 +1,20 @@
 Noteworthy changes in version 1.2.2
 ------------------------------------------------
 
+ * Minor changes to some function declarations.  Buffer arguments are
+   now typed as void pointer.  This should not affect any compilation.
+
+ * Interface changes relative to the 1.2.1 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ gcry_cipher_encrypt    CHANGED: Arguments IN and OUT are now void*.
+ gcry_cipher_decrypt    CHANGED: Arguments IN and OUT are now void*.
+ gcry_create_nonce      CHANGED: Argument BUFFER is now void*.
+ gcry_md_ctl            CHANGED: Argument BUFFER is now void*.
+ gcry_sexp_sprint       CHANGED: Argument BUFFER is now void*.
+ gcry_mpi_scan          CHANGED: Argument BUFFER is now void*.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
 Noteworthy changes in version 1.2.1 (2005-01-05)
 ------------------------------------------------
 
Index: libgcrypt/cipher/ChangeLog
diff -u libgcrypt/cipher/ChangeLog:1.211.2.12 libgcrypt/cipher/ChangeLog:1.211.2.13
--- libgcrypt/cipher/ChangeLog:1.211.2.12	Sat Apr 16 19:32:43 2005
+++ libgcrypt/cipher/ChangeLog	Thu Jun 16 10:13:13 2005
@@ -1,3 +1,12 @@
+2005-06-15  Werner Koch  <wk at g10code.com>
+
+	* cipher.c (gcry_cipher_encrypt, gcry_cipher_decrypt): Changed OUT
+	and IN to void*.
+
+	* md.c (gcry_md_ctl): Changed arg BUFFER to void*.
+	* random.c (gcry_randomize): Ditto.
+	(gcry_create_nonce): Ditto.
+
 2005-04-16  Moritz Schulte  <moritz at g10code.com>
 
 	* ac.c (_gcry_ac_init): New function.
Index: libgcrypt/cipher/cipher.c
diff -u libgcrypt/cipher/cipher.c:1.69.2.1 libgcrypt/cipher/cipher.c:1.69.2.2
--- libgcrypt/cipher/cipher.c:1.69.2.1	Sat Mar 19 18:58:13 2005
+++ libgcrypt/cipher/cipher.c	Thu Jun 16 10:13:13 2005
@@ -1069,8 +1069,8 @@
  * 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;
 
@@ -1151,8 +1151,8 @@
 
 
 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;
 
Index: libgcrypt/cipher/md.c
diff -u libgcrypt/cipher/md.c:1.82 libgcrypt/cipher/md.c:1.82.2.1
--- libgcrypt/cipher/md.c:1.82	Fri Dec 19 20:49:35 2003
+++ libgcrypt/cipher/md.c	Thu Jun 16 10:13:13 2005
@@ -798,8 +798,9 @@
 }
 
 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)
 {
+  unsigned char *buf = (unsigned char *)buffer;
   gcry_err_code_t rc = 0;
   
   switch (cmd)
@@ -808,10 +809,10 @@
       md_final (hd);
       break;
     case GCRYCTL_SET_KEY:
-      rc = gcry_err_code (gcry_md_setkey (hd, buffer, buflen));
+      rc = gcry_err_code (gcry_md_setkey (hd, buf, buflen));
       break;
     case GCRYCTL_START_DUMP:
-      md_start_debug (hd, buffer);
+      md_start_debug (hd, buf);
       break;
     case GCRYCTL_STOP_DUMP:
       md_stop_debug( hd );
Index: libgcrypt/cipher/random.c
diff -u libgcrypt/cipher/random.c:1.69.2.3 libgcrypt/cipher/random.c:1.69.2.4
--- libgcrypt/cipher/random.c:1.69.2.3	Wed Sep 15 12:23:04 2004
+++ libgcrypt/cipher/random.c	Thu Jun 16 10:13:13 2005
@@ -358,7 +358,7 @@
    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;
   int err;
@@ -1098,7 +1098,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;
Index: libgcrypt/doc/ChangeLog
diff -u libgcrypt/doc/ChangeLog:1.38.2.5 libgcrypt/doc/ChangeLog:1.38.2.6
--- libgcrypt/doc/ChangeLog:1.38.2.5	Tue Feb 22 18:59:21 2005
+++ libgcrypt/doc/ChangeLog	Thu Jun 16 10:13:13 2005
@@ -1,3 +1,7 @@
+2005-06-16  Werner Koch  <wk at g10code.com>
+
+	* gcrypt.texi: Adjusted function prototypes.
+
 2005-02-08  Werner Koch  <wk at g10code.com>
 
 	* gcrypt.texi: Fixed direntry.
Index: libgcrypt/doc/gcrypt.texi
diff -u libgcrypt/doc/gcrypt.texi:1.38.2.5 libgcrypt/doc/gcrypt.texi:1.38.2.6
--- libgcrypt/doc/gcrypt.texi:1.38.2.5	Tue Feb 22 18:59:21 2005
+++ libgcrypt/doc/gcrypt.texi	Thu Jun 16 10:13:13 2005
@@ -1352,7 +1352,7 @@
 following functions.  They may be used as often as required to process
 all the data.
 
- at deftypefun gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t @var{h}, unsigned char *{out}, size_t @var{outsize}, const unsigned char *@var{in}, size_t @var{inlen})
+ at deftypefun gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t @var{h}, void *{out}, size_t @var{outsize}, const void *@var{in}, size_t @var{inlen})
 
 @code{gcry_cipher_encrypt} is used to encrypt the data.  This function
 can either work in place or with two buffers.  It uses the cipher
@@ -1372,7 +1372,7 @@
 @end deftypefun
 
 
- at deftypefun gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t @var{h}, unsigned char *{out}, size_t @var{outsize}, const unsigned char *@var{in}, size_t @var{inlen})
+ at deftypefun gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t @var{h}, void *{out}, size_t @var{outsize}, const void *@var{in}, size_t @var{inlen})
 
 @code{gcry_cipher_decrypt} is used to decrypt the data.  This function
 can either work in place or with two buffers.  It uses the cipher
@@ -3003,7 +3003,7 @@
 allocated in a ``secure'' area of the memory.
 @end deftypefun
 
- at deftypefun void gcry_create_nonce (unsigned char *@var{buffer}, size_t @var{length})
+ at deftypefun void gcry_create_nonce (void *@var{buffer}, size_t @var{length})
 
 Fill @var{buffer} with @var{length} unpredictable bytes.  This is
 commonly called a nonce and may also be used for initialization
@@ -3129,7 +3129,7 @@
 back into a regular external S-expression format and to show the
 structure for debugging.
 
- at deftypefun size_t gcry_sexp_sprint (@w{gcry_sexp_t @var{sexp}}, @w{int @var{mode}}, @w{char *@var{buffer}}, @w{size_t @var{maxlength}})
+ at deftypefun size_t gcry_sexp_sprint (@w{gcry_sexp_t @var{sexp}}, @w{int @var{mode}}, @w{void *@var{buffer}}, @w{size_t @var{maxlength}})
 
 Copies the S-expression object @var{sexp} into @var{buffer} using the
 format specified in @var{mode}.  @var{maxlength} must be set to the
@@ -3231,7 +3231,7 @@
 actual data with index @var{number} is returned and the length of this
 data will be stored to @var{datalen}.  If there is no data at the given
 index or the index represents another list, @code{NULL} is returned.
- at strong{Note:} The returned pointer is valid as long as @var{list} is
+ at strong{Take care:} The returned pointer is valid as long as @var{list} is
 not modified or released.
 
 @noindent
@@ -3362,7 +3362,7 @@
 The following functions are used to convert between an external
 representation of an MPI and the internal one of @acronym{Libgcrypt}.
 
- at deftypefun int gcry_mpi_scan (@w{gcry_mpi_t *@var{r_mpi}}, @w{enum gcry_mpi_format @var{format}}, @w{const unsigned char *@var{buffer}}, @w{size_t @var{buflen}}, @w{size_t *@var{nscanned}})
+ at deftypefun int gcry_mpi_scan (@w{gcry_mpi_t *@var{r_mpi}}, @w{enum gcry_mpi_format @var{format}}, @w{const void *@var{buffer}}, @w{size_t @var{buflen}}, @w{size_t *@var{nscanned}})
 
 Convert the external representation of an integer stored in @var{buffer}
 with a length of @var{buflen} into a newly created MPI returned which
Index: libgcrypt/mpi/ChangeLog
diff -u libgcrypt/mpi/ChangeLog:1.89.2.4 libgcrypt/mpi/ChangeLog:1.89.2.5
--- libgcrypt/mpi/ChangeLog:1.89.2.4	Sun May 29 11:32:24 2005
+++ libgcrypt/mpi/ChangeLog	Thu Jun 16 10:13:13 2005
@@ -1,3 +1,7 @@
+2005-06-16  Werner Koch  <wk at g10code.com>
+
+	* mpicoder.c (gcry_mpi_scan): Changed arg BUFFER to void*.
+
 2005-05-29  Moritz Schulte  <moritz at g10code.com>
 
 	* mpiutil.c (gcry_mpi_randomize): Store random data in secure
Index: libgcrypt/mpi/mpicoder.c
diff -u libgcrypt/mpi/mpicoder.c:1.38 libgcrypt/mpi/mpicoder.c:1.38.4.1
--- libgcrypt/mpi/mpicoder.c:1.38	Mon Jul 28 14:06:40 2003
+++ libgcrypt/mpi/mpicoder.c	Thu Jun 16 10:13:13 2005
@@ -333,8 +333,9 @@
    bytes actually scanned after a successful operation. */
 gcry_error_t
 gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
-		const unsigned char *buffer, size_t buflen, size_t *nscanned )
+	       const void *buffer_arg, size_t buflen, size_t *nscanned )
 {
+    const unsigned char *buffer = (const unsigned char*)buffer_arg;
     struct gcry_mpi *a = NULL;
     unsigned int len;
     int secure = (buffer && gcry_is_secure (buffer));
Index: libgcrypt/src/ChangeLog
diff -u libgcrypt/src/ChangeLog:1.151.2.14 libgcrypt/src/ChangeLog:1.151.2.15
--- libgcrypt/src/ChangeLog:1.151.2.14	Sat Apr 16 19:33:40 2005
+++ libgcrypt/src/ChangeLog	Thu Jun 16 10:13:13 2005
@@ -1,3 +1,19 @@
+2005-06-16  Werner Koch  <wk at g10code.com>
+
+	* gcrypt.h (gcry_mpi_scan): Changed arg BUFFER from unsigned char*
+	to void*.
+
+2005-06-15  Werner Koch  <wk at g10code.com>
+
+	* gcrypt.h, sexp.c (gcry_sexp_sprint): Changed arg BUFFER from
+	char* to void*.
+	* gcrypt.h (gcry_md_ctl): Changed arg BUFFER from unsigned char*
+	to void*.
+	(gcry_randomize): Ditto.
+	(gcry_create_nonce): Ditto.
+	(gcry_cipher_encrypt, gcry_cipher_decrypt): Changed args IN and
+	OUT from unsigned char* to void*.
+
 2005-04-16  Moritz Schulte  <moritz at g10code.com>
 
 	* g10lib.h (_gcry_ac_init): Declare.
Index: libgcrypt/src/gcrypt.h
diff -u libgcrypt/src/gcrypt.h:1.125.2.7 libgcrypt/src/gcrypt.h:1.125.2.8
--- libgcrypt/src/gcrypt.h:1.125.2.7	Thu Apr 14 19:42:07 2005
+++ libgcrypt/src/gcrypt.h	Thu Jun 16 10:13:13 2005
@@ -411,7 +411,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
@@ -537,7 +537,7 @@
    RET_MPI.  If NSCANNED is not NULL, it will receive the number of
    bytes actually scanned after a successful operation. */
 gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format,
-                            const unsigned char *buffer, size_t buflen, 
+                            const void *buffer, size_t buflen, 
                             size_t *nscanned);
 
 /* Convert the big integer A into the external representation
@@ -819,13 +819,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
@@ -1210,8 +1210,8 @@
 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);
+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
@@ -1332,7 +1332,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
@@ -1366,7 +1366,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);
 
 
 
Index: libgcrypt/src/sexp.c
diff -u libgcrypt/src/sexp.c:1.40.2.3 libgcrypt/src/sexp.c:1.40.2.4
--- libgcrypt/src/sexp.c:1.40.2.3	Thu Apr 14 19:51:42 2005
+++ libgcrypt/src/sexp.c	Thu Jun 16 10:13:13 2005
@@ -1537,11 +1537,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];




More information about the Gnupg-commits mailing list