aboutsummaryrefslogtreecommitdiff
path: root/providers
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-03-23 13:19:40 +0100
committerRichard Levitte <levitte@openssl.org>2020-04-08 15:30:25 +0200
commite3be0f4389fe1680e1fd547a8575ea71b4518b57 (patch)
treedf72b50c45d468179eb24a797bcb34f5de349f18 /providers
parentc2041da8c15027ddde5afcf9809d8d3a975eb25b (diff)
downloadopenssl-e3be0f4389fe1680e1fd547a8575ea71b4518b57.zip
openssl-e3be0f4389fe1680e1fd547a8575ea71b4518b57.tar.gz
openssl-e3be0f4389fe1680e1fd547a8575ea71b4518b57.tar.bz2
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 <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11358)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/keymgmt/ec_kmgmt.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
index 77d4753..661aa2d 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;