diff options
author | Richard Levitte <levitte@openssl.org> | 2020-10-26 13:59:09 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-11-11 11:42:06 +0100 |
commit | eb2f1b81a3e55aba2c81bd8b7cfd11309049cf58 (patch) | |
tree | a15c55c91c7d62ddf3c5cde347fe39e24cb2e25e | |
parent | 4f2abe4378ce561c60674f3ac0642d3fb22da550 (diff) |
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 <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13248)
-rw-r--r-- | crypto/dh/dh_ameth.c | 4 | ||||
-rw-r--r-- | crypto/dh/dh_asn1.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c index 49e65e4d6c..1efbb403cb 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 cf5c735a6a..81899de5d6 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; } |