Browse Source

Be less strict in `register_all_hashes()`

Allow using all hashes in case we didn't register our ciphers.
Nobody should really use CHC, so we shouldn't make it mandatory.

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 3 months ago
parent
commit
8d44e48d46
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/misc/crypt/crypt_register_all_hashes.c

+ 7 - 2
src/misc/crypt/crypt_register_all_hashes.c

@@ -89,8 +89,13 @@ int register_all_hashes(void)
    REGISTER_HASH(&blake2b_512_desc);
 #endif
 #ifdef LTC_CHC_HASH
-   REGISTER_HASH(&chc_desc);
-   LTC_ARGCHK(chc_register(find_cipher_any("aes", 8, 16)) == CRYPT_OK);
+   {
+      int aes_index = find_cipher_any("aes", 8, 16);
+      if (aes_index != -1) {
+         REGISTER_HASH(&chc_desc);
+         LTC_ARGCHK(chc_register(aes_index) == CRYPT_OK);
+      }
+   }
 #endif
    return CRYPT_OK;
 }