Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openssl/experimental.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-01-13 21:00:13 +0300
committerTomas Mraz <tomas@openssl.org>2022-01-17 18:20:57 +0300
commitf58bb2dd00c3004552c5c1e8d0f2c1390c004cf8 (patch)
tree96932d87ac2b4397f5f30d23b11e341fa208b6e0
parent144316d276adf5b8172316f7bc20b372b8e31ac8 (diff)
Properly return error on EVP_PKEY_CTX_set_dh_nid and EVP_PKEY_CTX_set_dhx_rfc5114
Fixes #17485 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17498)
-rw-r--r--crypto/evp/ctrl_params_translate.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c
index c4589f1416..2deb1d9b47 100644
--- a/crypto/evp/ctrl_params_translate.c
+++ b/crypto/evp/ctrl_params_translate.c
@@ -1004,8 +1004,11 @@ static int fix_dh_nid(enum state state,
return 0;
if (state == PRE_CTRL_TO_PARAMS) {
- ctx->p2 = (char *)ossl_ffc_named_group_get_name
- (ossl_ffc_uid_to_dh_named_group(ctx->p1));
+ if ((ctx->p2 = (char *)ossl_ffc_named_group_get_name
+ (ossl_ffc_uid_to_dh_named_group(ctx->p1))) == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_VALUE);
+ return 0;
+ }
ctx->p1 = 0;
}
@@ -1028,16 +1031,24 @@ static int fix_dh_nid5114(enum state state,
switch (state) {
case PRE_CTRL_TO_PARAMS:
- ctx->p2 = (char *)ossl_ffc_named_group_get_name
- (ossl_ffc_uid_to_dh_named_group(ctx->p1));
+ if ((ctx->p2 = (char *)ossl_ffc_named_group_get_name
+ (ossl_ffc_uid_to_dh_named_group(ctx->p1))) == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_VALUE);
+ return 0;
+ }
+
ctx->p1 = 0;
break;
case PRE_CTRL_STR_TO_PARAMS:
if (ctx->p2 == NULL)
return 0;
- ctx->p2 = (char *)ossl_ffc_named_group_get_name
- (ossl_ffc_uid_to_dh_named_group(atoi(ctx->p2)));
+ if ((ctx->p2 = (char *)ossl_ffc_named_group_get_name
+ (ossl_ffc_uid_to_dh_named_group(atoi(ctx->p2)))) == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_VALUE);
+ return 0;
+ }
+
ctx->p1 = 0;
break;