From: Richard Levitte Date: Mon, 23 Mar 2020 12:19:40 +0000 (+0100) Subject: Fix export of provided EC keys X-Git-Tag: openssl-3.0.0-alpha1~140 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e3be0f4389fe1680e1fd547a8575ea71b4518b57;p=oweals%2Fopenssl.git Fix export of provided EC keys The exporter freed a buffer too soon, and there were attempts to use its data later, which was overwritten by something else at that point. Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/11358) --- diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index 77d4753723..661aa2de9f 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -352,13 +352,10 @@ int ec_export(void *keydata, int selection, OSSL_CALLBACK *param_cb, if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0) ok = ok && otherparams_to_params(ec, tmpl, NULL); - if (!ok - || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) - goto err; + if (ok && (params = OSSL_PARAM_BLD_to_param(tmpl)) != NULL) + ok = param_cb(params, cbarg); - ok = param_cb(params, cbarg); OSSL_PARAM_BLD_free_params(params); -err: OSSL_PARAM_BLD_free(tmpl); OPENSSL_free(pub_key); return ok;