From: Richard Levitte Date: Mon, 26 Oct 2020 12:59:09 +0000 (+0100) Subject: DH: Move the code to set the DH sub-type X-Git-Tag: openssl-3.0.0-alpha9~138 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb2f1b81a3e55aba2c81bd8b7cfd11309049cf58;p=thirdparty%2Fopenssl.git DH: Move the code to set the DH sub-type It's been moved so the type is set by d2i_DHparams() and d2i_DHxparams() Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/13248) --- diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c index 49e65e4d6c8..1efbb403cbe 100644 --- a/crypto/dh/dh_ameth.c +++ b/crypto/dh/dh_ameth.c @@ -42,10 +42,6 @@ static DH *d2i_dhp(const EVP_PKEY *pkey, const unsigned char **pp, else dh = d2i_DHparams(NULL, pp, length); - if (dh != NULL) { - DH_clear_flags(dh, DH_FLAG_TYPE_MASK); - DH_set_flags(dh, is_dhx ? DH_FLAG_TYPE_DHX : DH_FLAG_TYPE_DH); - } return dh; } diff --git a/crypto/dh/dh_asn1.c b/crypto/dh/dh_asn1.c index cf5c735a6ad..81899de5d65 100644 --- a/crypto/dh/dh_asn1.c +++ b/crypto/dh/dh_asn1.c @@ -34,7 +34,11 @@ static int dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, *pval = NULL; return 2; } else if (operation == ASN1_OP_D2I_POST) { - ((DH *)*pval)->dirty_cnt++; + DH *dh = (DH *)*pval; + + DH_clear_flags(dh, DH_FLAG_TYPE_MASK); + DH_set_flags(dh, DH_FLAG_TYPE_DH); + dh->dirty_cnt++; } return 1; } @@ -123,6 +127,8 @@ DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length) } OPENSSL_free(dhx); + DH_clear_flags(dh, DH_FLAG_TYPE_MASK); + DH_set_flags(dh, DH_FLAG_TYPE_DHX); return dh; }