Browse Source

fixed wrong return value interpretation of register_crypt/hash/prng function calls

Steffen Jaeckel 15 years ago
parent
commit
8859f6e73d
1 changed files with 6 additions and 7 deletions
  1. 6 7
      src/misc/crypt/crypt_fsa.c

+ 6 - 7
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;
       }
    }