summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-08-24 12:02:02 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-09-05 15:41:31 +1000
commitd135774e7d4304df90eab0ed37e93ecdfb1b99a9 (patch)
tree82e778beff5ffa43366b7aeb7634e43fae00e64d /crypto/dh
parent33200269110f0ed4a9c96be03b32cd8913f9e426 (diff)
Fix coverity CID #1465967 & #1465968 - fix NULL dereference in dh_ameth.c
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/12708)
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_ameth.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c
index 011bc5ad03..3d4605ae11 100644
--- a/crypto/dh/dh_ameth.c
+++ b/crypto/dh/dh_ameth.c
@@ -564,13 +564,12 @@ static int dh_pkey_import_from_type(const OSSL_PARAM params[], void *vpctx,
EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx);
DH *dh = dh_new_with_libctx(pctx->libctx);
- DH_clear_flags(dh, DH_FLAG_TYPE_MASK);
- DH_set_flags(dh, type == EVP_PKEY_DH ? DH_FLAG_TYPE_DH : DH_FLAG_TYPE_DHX);
-
if (dh == NULL) {
ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
return 0;
}
+ DH_clear_flags(dh, DH_FLAG_TYPE_MASK);
+ DH_set_flags(dh, type == EVP_PKEY_DH ? DH_FLAG_TYPE_DH : DH_FLAG_TYPE_DHX);
if (!dh_ffc_params_fromdata(dh, params)
|| !dh_key_fromdata(dh, params)