Do not call ossl_ffc_name_to_dh_named_group with NULL argument
authorTomas Mraz <tomas@openssl.org>
Thu, 13 Jan 2022 18:01:33 +0000 (19:01 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 17 Jan 2022 15:20:57 +0000 (16:20 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17498)

crypto/ffc/ffc_backend.c
providers/implementations/keymgmt/dh_kmgmt.c

index b22718693427f3290a84d5ba45cb9399518b355c..b387f966ccfbadcce3ebdfdd8f963c97ad4d28fe 100644 (file)
@@ -37,6 +37,7 @@ int ossl_ffc_params_fromdata(FFC_PARAMS *ffc, const OSSL_PARAM params[])
         const DH_NAMED_GROUP *group = NULL;
 
         if (prm->data_type != OSSL_PARAM_UTF8_STRING
+            || prm->data == NULL
             || (group = ossl_ffc_name_to_dh_named_group(prm->data)) == NULL
             || !ossl_ffc_named_group_set_pqg(ffc, group))
 #endif
index 98eb882e3fa0a09928bea626ef0093be0ef93827..ab8ef3ac525dbb8040ef314e49a506f0d7caec4f 100644 (file)
@@ -532,6 +532,7 @@ static int dh_gen_common_set_params(void *genctx, const OSSL_PARAM params[])
         const DH_NAMED_GROUP *group = NULL;
 
         if (p->data_type != OSSL_PARAM_UTF8_STRING
+            || p->data == NULL
             || (group = ossl_ffc_name_to_dh_named_group(p->data)) == NULL
             || ((gctx->group_nid =
                  ossl_ffc_named_group_get_uid(group)) == NID_undef)) {