From: Pauli Date: Fri, 1 Nov 2019 11:07:08 +0000 (+1000) Subject: DRBG: add check for XOF so these can be disallowed by the DRBGs X-Git-Tag: openssl-3.0.0-alpha1~1051 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d0cf102e038013d6d89ea406562b52f73a67bdd;p=thirdparty%2Fopenssl.git DRBG: add check for XOF so these can be disallowed by the DRBGs Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/10321) --- diff --git a/crypto/rand/drbg_hash.c b/crypto/rand/drbg_hash.c index 5ff1d117c94..f087d889655 100644 --- a/crypto/rand/drbg_hash.c +++ b/crypto/rand/drbg_hash.c @@ -317,6 +317,8 @@ int drbg_hash_init(RAND_DRBG *drbg) if (md == NULL) return 0; + if ((EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0) + return 0; drbg->meth = &drbg_hash_meth; diff --git a/crypto/rand/drbg_hmac.c b/crypto/rand/drbg_hmac.c index 0047d8c0946..3bda6c0d050 100644 --- a/crypto/rand/drbg_hmac.c +++ b/crypto/rand/drbg_hmac.c @@ -211,6 +211,9 @@ int drbg_hmac_init(RAND_DRBG *drbg) if (md == NULL) return 0; + if ((EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0) + return 0; + drbg->meth = &drbg_hmac_meth; if (hmac->ctx == NULL) {