Browse Source

yarrow: prevent access to NULL pointer

Steffen Jaeckel 13 years ago
parent
commit
77860ba866
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/prngs/yarrow.c

+ 6 - 4
src/prngs/yarrow.c

@@ -343,11 +343,13 @@ int yarrow_test(void)
    }
 
    /* now let's test the hash/cipher that was chosen */
-   if ((err = cipher_descriptor[prng.yarrow.cipher].test()) != CRYPT_OK) {
-      return err; 
+   if (cipher_descriptor[prng.yarrow.cipher].test &&
+       ((err = cipher_descriptor[prng.yarrow.cipher].test()) != CRYPT_OK)) {
+      return err;
    }
-   if ((err = hash_descriptor[prng.yarrow.hash].test()) != CRYPT_OK) {
-      return err; 
+   if (hash_descriptor[prng.yarrow.hash].test &&
+       ((err = hash_descriptor[prng.yarrow.hash].test()) != CRYPT_OK)) {
+      return err;
    }
 
    return CRYPT_OK;