From: Viktor Dukhovni Date: Wed, 27 Apr 2016 19:08:33 +0000 (-0400) Subject: Fix set0 reuse test X-Git-Tag: OpenSSL_1_1_0-pre6~1040 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=4a397f5168d41ef4417f1430f2f5133b92f145b8 Fix set0 reuse test We must test for new object == current object, not !=. Reviewed-by: Richard Levitte --- diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 644508d784..9db45763fa 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -303,7 +303,7 @@ int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) * as input parameters. */ if (dh->pub_key == pub_key - || (dh->priv_key != NULL && priv_key != dh->priv_key)) + || (dh->priv_key != NULL && priv_key == dh->priv_key)) return 0; if (pub_key != NULL) { diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c index 383b48ba46..7b751a961d 100644 --- a/crypto/dsa/dsa_lib.c +++ b/crypto/dsa/dsa_lib.c @@ -358,7 +358,7 @@ int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) * as input parameters. */ if (d->pub_key == pub_key - || (d->priv_key != NULL && priv_key != d->priv_key)) + || (d->priv_key != NULL && priv_key == d->priv_key)) return 0; if (pub_key != NULL) {