From 8859f6e73d1361c065ac11d938a2100bdc6ee45d Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Thu, 23 Dec 2010 19:57:56 +0100 Subject: [PATCH] fixed wrong return value interpretation of register_crypt/hash/prng function calls --- src/misc/crypt/crypt_fsa.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/misc/crypt/crypt_fsa.c b/src/misc/crypt/crypt_fsa.c index 3d6d86d..9960ec9 100644 --- a/src/misc/crypt/crypt_fsa.c +++ b/src/misc/crypt/crypt_fsa.c @@ -19,7 +19,6 @@ /* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */ int crypt_fsa(void *mp, ...) { - int err; va_list args; void *p; @@ -29,23 +28,23 @@ int crypt_fsa(void *mp, ...) } while ((p = va_arg(args, void*)) != NULL) { - if ((err = register_cipher(p)) != CRYPT_OK) { + if (register_cipher(p) == -1) { va_end(args); - return err; + return CRYPT_INVALID_CIPHER; } } while ((p = va_arg(args, void*)) != NULL) { - if ((err = register_hash(p)) != CRYPT_OK) { + if (register_hash(p) == -1) { va_end(args); - return err; + return CRYPT_INVALID_HASH; } } while ((p = va_arg(args, void*)) != NULL) { - if ((err = register_prng(p)) != CRYPT_OK) { + if (register_prng(p) == -1) { va_end(args); - return err; + return CRYPT_INVALID_PRNG; } }