DH_check_pub_key_ex was accidentally calling DH_check,
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 6 Sep 2019 22:58:31 +0000 (00:58 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 9 Sep 2019 12:43:57 +0000 (14:43 +0200)
so results were undefined.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9796)

crypto/dh/dh_check.c

index 373110d263b0cd6a2c3d00f9591517cb724b9a56..2d19a8f120ec456e91b725f46c07f315f1366a33 100644 (file)
@@ -176,7 +176,8 @@ int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key)
 {
     int errflags = 0;
 
-    (void)DH_check(dh, &errflags);
+    if (!DH_check_pub_key(dh, pub_key, &errflags))
+        return 0;
 
     if ((errflags & DH_CHECK_PUBKEY_TOO_SMALL) != 0)
         DHerr(DH_F_DH_CHECK_PUB_KEY_EX, DH_R_CHECK_PUBKEY_TOO_SMALL);