]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
crypto: check gnutls & gcrypt support the requested pbkdf hash
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 29 Aug 2024 13:47:42 +0000 (14:47 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Mon, 9 Sep 2024 14:13:38 +0000 (15:13 +0100)
Both gnutls and gcrypt can be configured to exclude support for certain
algorithms via a runtime check against system crypto policies. Thus it
is not sufficient to have a compile time test for hash support in their
pbkdf implementations.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
crypto/pbkdf-gcrypt.c
crypto/pbkdf-gnutls.c

index a8d8e64f4d46bbb65f8d0ef71cbe20c08bca31ed..bc0719c831d1875919a8af422ce041d33045e1c1 100644 (file)
@@ -33,7 +33,7 @@ bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash)
     case QCRYPTO_HASH_ALG_SHA384:
     case QCRYPTO_HASH_ALG_SHA512:
     case QCRYPTO_HASH_ALG_RIPEMD160:
-        return true;
+        return qcrypto_hash_supports(hash);
     default:
         return false;
     }
index 2dfbbd382c2e5fb95b6e0f000c243a983794f6ff..911b565beac22433c0eb2c858f3886177870adff 100644 (file)
@@ -33,7 +33,7 @@ bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash)
     case QCRYPTO_HASH_ALG_SHA384:
     case QCRYPTO_HASH_ALG_SHA512:
     case QCRYPTO_HASH_ALG_RIPEMD160:
-        return true;
+        return qcrypto_hash_supports(hash);
     default:
         return false;
     }