* gc.h, gc-gnulib.c, gc-libgcrypt.c: Use Gc_rc for return types,
authorSimon Josefsson <simon@josefsson.org>
Wed, 12 Oct 2005 11:57:13 +0000 (11:57 +0000)
committerSimon Josefsson <simon@josefsson.org>
Wed, 12 Oct 2005 11:57:13 +0000 (11:57 +0000)
suggested by Bruno Haible <bruno@clisp.org>.

lib/ChangeLog
lib/gc-gnulib.c
lib/gc-libgcrypt.c
lib/gc.h

index bf2ead8..a6d902a 100644 (file)
@@ -1,5 +1,10 @@
 2005-10-12  Simon Josefsson  <jas@extundo.com>
 
+       * gc.h, gc-gnulib.c, gc-libgcrypt.c: Use Gc_rc for return types,
+       suggested by Bruno Haible <bruno@clisp.org>.
+
+2005-10-12  Simon Josefsson  <jas@extundo.com>
+
        * gc-libgcrypt.c (gc_hmac_sha1): New function.
 
        * gc-gnulib.c (gc_hmac_sha1): New function.
index e0e37b0..9bdb813 100644 (file)
 # include "hmac.h"
 #endif
 
-int
+Gc_rc
 gc_init (void)
 {
-  return 0;
+  return GC_OK;
 }
 
 void
@@ -61,7 +61,7 @@ gc_done (void)
 
 /* Randomness. */
 
-static int
+static Gc_rc
 randomize (int level, char *data, size_t datalen)
 {
   int fd;
@@ -113,19 +113,19 @@ randomize (int level, char *data, size_t datalen)
   return GC_OK;
 }
 
-int
+Gc_rc
 gc_nonce (char *data, size_t datalen)
 {
   return randomize (0, data, datalen);
 }
 
-int
+Gc_rc
 gc_pseudo_random (char *data, size_t datalen)
 {
   return randomize (1, data, datalen);
 }
 
-int
+Gc_rc
 gc_random (char *data, size_t datalen)
 {
   return randomize (2, data, datalen);
@@ -144,7 +144,7 @@ gc_set_allocators (gc_malloc_t func_malloc,
 
 /* Hashes. */
 
-int
+Gc_rc
 gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *resbuf)
 {
   switch (hash)
@@ -169,39 +169,39 @@ gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *resbuf)
 }
 
 #ifdef GC_USE_MD5
-int
+Gc_rc
 gc_md5 (const void *in, size_t inlen, void *resbuf)
 {
   md5_buffer (in, inlen, resbuf);
-  return 0;
+  return GC_OK;
 }
 #endif
 
 #ifdef GC_USE_SHA1
-int
+Gc_rc
 gc_sha1 (const void *in, size_t inlen, void *resbuf)
 {
   sha1_buffer (in, inlen, resbuf);
-  return 0;
+  return GC_OK;
 }
 #endif
 
 #ifdef GC_USE_HMAC_MD5
-int
+Gc_rc
 gc_hmac_md5 (const void *key, size_t keylen,
             const void *in, size_t inlen, char *resbuf)
 {
   hmac_md5 (key, keylen, in, inlen, resbuf);
-  return 0;
+  return GC_OK;
 }
 #endif
 
 #ifdef GC_USE_HMAC_SHA1
-int
+Gc_rc
 gc_hmac_sha1 (const void *key, size_t keylen,
              const void *in, size_t inlen, char *resbuf)
 {
   hmac_sha1 (key, keylen, in, inlen, resbuf);
-  return 0;
+  return GC_OK;
 }
 #endif
index 7652356..349d561 100644 (file)
@@ -34,7 +34,7 @@
 
 /* Initialization. */
 
-int
+Gc_rc
 gc_init (void)
 {
   gcry_error_t err;
@@ -61,21 +61,21 @@ gc_done (void)
 
 /* Randomness. */
 
-int
+Gc_rc
 gc_nonce (char *data, size_t datalen)
 {
   gcry_create_nonce ((unsigned char *) data, datalen);
   return GC_OK;
 }
 
-int
+Gc_rc
 gc_pseudo_random (char *data, size_t datalen)
 {
   gcry_randomize ((unsigned char *) data, datalen, GCRY_STRONG_RANDOM);
   return GC_OK;
 }
 
-int
+Gc_rc
 gc_random (char *data, size_t datalen)
 {
   gcry_randomize ((unsigned char *) data, datalen, GCRY_VERY_STRONG_RANDOM);
@@ -96,7 +96,7 @@ gc_set_allocators (gc_malloc_t func_malloc,
 
 /* Hashes. */
 
-int
+Gc_rc
 gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *resbuf)
 {
   int gcryalg;
@@ -127,7 +127,7 @@ gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *resbuf)
 /* One-call interface. */
 
 #ifdef GC_USE_MD5
-int
+Gc_rc
 gc_md5 (const void *in, size_t inlen, void *resbuf)
 {
   size_t outlen = gcry_md_get_algo_dlen (GCRY_MD_MD5);
@@ -159,7 +159,7 @@ gc_md5 (const void *in, size_t inlen, void *resbuf)
 #endif
 
 #ifdef GC_USE_SHA1
-int
+Gc_rc
 gc_sha1 (const void *in, size_t inlen, void *resbuf)
 {
   size_t outlen = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
@@ -191,7 +191,7 @@ gc_sha1 (const void *in, size_t inlen, void *resbuf)
 #endif
 
 #ifdef GC_USE_HMAC_MD5
-int
+Gc_rc
 gc_hmac_md5 (const void *key, size_t keylen,
             const void *in, size_t inlen, char *resbuf)
 {
@@ -231,7 +231,7 @@ gc_hmac_md5 (const void *key, size_t keylen,
 #endif
 
 #ifdef GC_USE_HMAC_SHA1
-int
+Gc_rc
 gc_hmac_sha1 (const void *key, size_t keylen,
              const void *in, size_t inlen, char *resbuf)
 {
index c66d31a..43a7ff6 100644 (file)
--- a/lib/gc.h
+++ b/lib/gc.h
@@ -50,7 +50,7 @@ typedef enum Gc_hash Gc_hash;
 #define GC_SHA1_DIGEST_SIZE 20
 
 /* Call before respectively after any other functions. */
-extern int gc_init (void);
+extern Gc_rc gc_init (void);
 extern void gc_done (void);
 
 /* Memory allocation (avoid). */
@@ -72,18 +72,18 @@ extern void gc_set_allocators (gc_malloc_t func_malloc,
    GC_<HASH>_DIGEST_SIZE.  For example, for GC_MD5 the output buffer
    must be 16 bytes.  The return value is 0 (GC_OK) on success, or
    another Gc_rc error code. */
-extern int
+extern Gc_rc
 gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *out);
 
 /* One-call interface. */
-extern int gc_md5 (const void *in, size_t inlen, void *resbuf);
-extern int gc_sha1 (const void *in, size_t inlen, void *resbuf);
-extern int gc_hmac_md5 (const void *key, size_t keylen,
-                       const void *in, size_t inlen,
-                       char *resbuf);
-extern int gc_hmac_sha1 (const void *key, size_t keylen,
-                        const void *in, size_t inlen,
-                        char *resbuf);
+extern Gc_rc gc_md5 (const void *in, size_t inlen, void *resbuf);
+extern Gc_rc gc_sha1 (const void *in, size_t inlen, void *resbuf);
+extern Gc_rc gc_hmac_md5 (const void *key, size_t keylen,
+                         const void *in, size_t inlen,
+                         char *resbuf);
+extern Gc_rc gc_hmac_sha1 (const void *key, size_t keylen,
+                          const void *in, size_t inlen,
+                          char *resbuf);
 
 /*
   TODO: