From 629c72db5f8af3312fd89188298ce464186470d1 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 10 Apr 2020 18:28:24 +0100 Subject: When calling the import_to function pass the libctx too Previously import_to just took an EVP_PKEY as the argument. However we need to some additional context data as well - specifically the libctx. Therefore we pass an EVP_PKEY_CTX instead to hold the combination of both of these things. Reviewed-by: Tomas Mraz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/11536) --- crypto/ec/ec_ameth.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crypto/ec/ec_ameth.c') diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index 33712247ad..545d251e21 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -758,10 +758,11 @@ int ec_pkey_export_to(const EVP_PKEY *from, void *to_keydata, return rv; } -static int ec_pkey_import_from(const OSSL_PARAM params[], void *key) +static int ec_pkey_import_from(const OSSL_PARAM params[], void *vpctx) { - EVP_PKEY *pkey = key; - EC_KEY *ec = EC_KEY_new(); + EVP_PKEY_CTX *pctx = vpctx; + EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx); + EC_KEY *ec = EC_KEY_new_ex(pctx->libctx); if (ec == NULL) { ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE); -- cgit v1.2.3