Mercurial > hg > octave-nkf > gnulib-hg
changeset 6367:69cadd43d0f4
* gc.h, gc-gnulib.c, gc-libgcrypt.c: Use Gc_rc for return types,
suggested by Bruno Haible <bruno@clisp.org>.
author | Simon Josefsson <simon@josefsson.org> |
---|---|
date | Wed, 12 Oct 2005 11:57:13 +0000 |
parents | 22f41fec10ee |
children | f3b1ee5ce8f1 |
files | lib/ChangeLog lib/gc-gnulib.c lib/gc-libgcrypt.c lib/gc.h |
diffstat | 4 files changed, 39 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +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.
--- a/lib/gc-gnulib.c +++ b/lib/gc-gnulib.c @@ -47,10 +47,10 @@ # include "hmac.h" #endif -int +Gc_rc gc_init (void) { - return 0; + return GC_OK; } void @@ -61,7 +61,7 @@ /* Randomness. */ -static int +static Gc_rc randomize (int level, char *data, size_t datalen) { int fd; @@ -113,19 +113,19 @@ 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 @@ /* Hashes. */ -int +Gc_rc gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *resbuf) { switch (hash) @@ -169,39 +169,39 @@ } #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
--- a/lib/gc-libgcrypt.c +++ b/lib/gc-libgcrypt.c @@ -34,7 +34,7 @@ /* Initialization. */ -int +Gc_rc gc_init (void) { gcry_error_t err; @@ -61,21 +61,21 @@ /* 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 @@ /* Hashes. */ -int +Gc_rc gc_hash_buffer (Gc_hash hash, const void *in, size_t inlen, char *resbuf) { int gcryalg; @@ -127,7 +127,7 @@ /* 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 @@ #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 @@ #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 @@ #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) {
--- a/lib/gc.h +++ b/lib/gc.h @@ -50,7 +50,7 @@ #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 @@ 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: