Forráskód Böngészése

DRBG: add check for XOF so these can be disallowed by the DRBGs

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10321)
Pauli 4 éve
szülő
commit
5d0cf102e0
2 módosított fájl, 5 hozzáadás és 0 törlés
  1. 2 0
      crypto/rand/drbg_hash.c
  2. 3 0
      crypto/rand/drbg_hmac.c

+ 2 - 0
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;
 

+ 3 - 0
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) {