[svn] gcry - r1135 - in trunk: . cipher src tests

svn author mo cvs at cvs.gnupg.org
Wed Nov 2 17:41:35 CET 2005


Author: mo
Date: 2005-11-02 17:41:33 +0100 (Wed, 02 Nov 2005)
New Revision: 1135

Modified:
   trunk/TODO
   trunk/cipher/ChangeLog
   trunk/cipher/cipher.c
   trunk/cipher/pubkey.c
   trunk/cipher/random.c
   trunk/src/ChangeLog
   trunk/src/gcrypt.h
   trunk/tests/Makefile.am
Log:
src/ChangeLog
src/gcrypt.h
TODO
cipher/pubkey.c
cipher/cipher.c
cipher/ChangeLog


Modified: trunk/TODO
===================================================================
--- trunk/TODO	2005-11-01 11:21:54 UTC (rev 1134)
+++ trunk/TODO	2005-11-02 16:41:33 UTC (rev 1135)
@@ -33,3 +33,6 @@
   Don't rely on the secure memory based wiping function but add an
   extra wiping.
   
+* update/improve documentation
+  - it's outdated for e.g. gcry_pk_algo_info.
+  - document algorithm capabilities

Modified: trunk/cipher/ChangeLog
===================================================================
--- trunk/cipher/ChangeLog	2005-11-01 11:21:54 UTC (rev 1134)
+++ trunk/cipher/ChangeLog	2005-11-02 16:41:33 UTC (rev 1135)
@@ -1,3 +1,9 @@
+2005-11-02  Moritz Schulte  <moritz at g10code.com>
+
+	* pubkey.c (gcry_pk_algo_name): Return "?" instead of NULL for
+	unknown algorithm IDs.
+	* cipher.c (cipher_algo_to_string): Likewise.
+
 2005-11-01  Moritz Schulte  <moritz at g10code.com>
 
 	* pubkey.c (gcry_pk_algo_info): Don't forget to break after switch

Modified: trunk/cipher/cipher.c
===================================================================
--- trunk/cipher/cipher.c	2005-11-01 11:21:54 UTC (rev 1134)
+++ trunk/cipher/cipher.c	2005-11-02 16:41:33 UTC (rev 1135)
@@ -1,5 +1,6 @@
 /* cipher.c  -	cipher dispatcher
- * Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ *               2005, Free Software Foundation, Inc.
  *
  * This file is part of Libgcrypt.
  *
@@ -378,14 +379,14 @@
 }
 
 
-/* Map the cipher algorithm identifier ALGORITHM to a string
-   representing this algorithm.  This string is the default name as
-   used by Libgcrypt.  NULL is returned for an unknown algorithm.  */
+/* Map the cipher algorithm whose ID is contained in ALGORITHM to a
+   string representation of the algorithm name.  For unknown algorithm
+   IDs this function returns "?".  */
 static const char *
 cipher_algo_to_string (int algorithm)
 {
   gcry_module_t cipher;
-  const char *name = NULL;
+  const char *name;
 
   REGISTER_DEFAULT_CIPHERS;
 
@@ -396,6 +397,8 @@
       name = ((gcry_cipher_spec_t *) cipher->spec)->name;
       _gcry_module_release (cipher);
     }
+  else
+    name = "?";
   ath_mutex_unlock (&ciphers_registered_lock);
 
   return name;

Modified: trunk/cipher/pubkey.c
===================================================================
--- trunk/cipher/pubkey.c	2005-11-01 11:21:54 UTC (rev 1134)
+++ trunk/cipher/pubkey.c	2005-11-02 16:41:33 UTC (rev 1135)
@@ -1,5 +1,6 @@
 /* pubkey.c  -	pubkey dispatcher
- * Copyright (C) 1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2002, 2003,
+ *               2005 Free Software Foundation, Inc.
  *
  * This file is part of Libgcrypt.
  *
@@ -266,14 +267,14 @@
 }
 
 
-/****************
- * Map a pubkey algo to a string
- */
+/* Map the public key algorithm whose ID is contained in ALGORITHM to
+   a string representation of the algorithm name.  For unknown
+   algorithm IDs this functions returns "?". */
 const char *
 gcry_pk_algo_name (int algorithm)
 {
-  const char *name = NULL;
   gcry_module_t pubkey;
+  const char *name;
 
   REGISTER_DEFAULT_PUBKEYS;
 
@@ -284,6 +285,8 @@
       name = ((gcry_pk_spec_t *) pubkey->spec)->name;
       _gcry_module_release (pubkey);
     }
+  else
+    name = "?";
   ath_mutex_unlock (&pubkeys_registered_lock);
 
   return name;

Modified: trunk/cipher/random.c
===================================================================
--- trunk/cipher/random.c	2005-11-01 11:21:54 UTC (rev 1134)
+++ trunk/cipher/random.c	2005-11-02 16:41:33 UTC (rev 1135)
@@ -208,6 +208,8 @@
 void
 _gcry_random_dump_stats()
 {
+  /* FIXME: don't we need proper locking here? -mo */
+
     log_info (
 	    "random usage: poolsize=%d mixed=%lu polls=%lu/%lu added=%lu/%lu\n"
 	    "              outmix=%lu getlvl1=%lu/%lu getlvl2=%lu/%lu\n",

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2005-11-01 11:21:54 UTC (rev 1134)
+++ trunk/src/ChangeLog	2005-11-02 16:41:33 UTC (rev 1135)
@@ -1,3 +1,8 @@
+2005-11-02  Moritz Schulte  <moritz at g10code.com>
+
+	* gcrypt.h: Update comments for functions: gcry_cipher_algo_name,
+	gcry_pk_algo_name.
+
 2005-10-31  Moritz Schulte  <moritz at g10code.com>
 
 	* global.c: Added documentation.

Modified: trunk/src/gcrypt.h
===================================================================
--- trunk/src/gcrypt.h	2005-11-01 11:21:54 UTC (rev 1134)
+++ trunk/src/gcrypt.h	2005-11-02 16:41:33 UTC (rev 1135)
@@ -780,10 +780,10 @@
 gcry_error_t gcry_cipher_algo_info (int algo, int what, void *buffer,
                                    size_t *nbytes);
 
-/* Map the cipher algorithm id ALGO to a string representation of that
-   algorithm name.  For unknown algorithms this functions returns an
-   empty string. */
-const char *gcry_cipher_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
+/* Map the cipher algorithm whose ID is contained in ALGORITHM to a
+   string representation of the algorithm name.  For unknown algorithm
+   IDs this function returns "?".  */
+const char *gcry_cipher_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
 
 /* Map the algorithm name NAME to an cipher algorithm ID.  Return 0 if
    the algorithm name is not known. */
@@ -908,10 +908,10 @@
 gcry_error_t gcry_pk_algo_info (int algo, int what,
                                 void *buffer, size_t *nbytes);
 
-/* Map the public key algorithm id ALGO to a string representation of the
-   algorithm name.  For unknown algorithms this functions returns an
-   empty string. */
-const char *gcry_pk_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
+/* Map the public key algorithm whose ID is contained in ALGORITHM to
+   a string representation of the algorithm name.  For unknown
+   algorithm IDs this functions returns "?". */
+const char *gcry_pk_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
 
 /* Map the algorithm NAME to a public key algorithm Id.  Return 0 if
    the algorithm name is not known. */

Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am	2005-11-01 11:21:54 UTC (rev 1134)
+++ trunk/tests/Makefile.am	2005-11-02 16:41:33 UTC (rev 1135)
@@ -19,7 +19,8 @@
 ## Process this file with automake to produce Makefile.in
 
 TESTS = prime register ac ac-schemes ac-data basic \
-        tsexp keygen pubkey benchmark pkbench hmac keygrip
+        tsexp keygen pubkey benchmark pkbench hmac keygrip full \
+	mpi-zero mpi-cmp
 
 INCLUDES = -I$(top_srcdir)/src
 LDADD = ../src/libgcrypt.la




More information about the Gnupg-commits mailing list