summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_kmeth.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-06-15 15:21:00 +0200
committerMatt Caswell <matt@openssl.org>2020-06-19 11:34:58 +0200
commit2da8d4eb2812e18cec5c8324a54a4c56b52563ed (patch)
tree83398242047d499554026412f2bd68a51fe7217b /crypto/ec/ec_kmeth.c
parentCreate defines for TLS Group Ids (diff)
downloadopenssl-2da8d4eb2812e18cec5c8324a54a4c56b52563ed.tar.xz
openssl-2da8d4eb2812e18cec5c8324a54a4c56b52563ed.zip
Add more complete support for libctx/propq in the EC code
Renames some "new_ex" functions to "new_with_libctx" and ensures that we pass around the libctx AND the propq everywhere. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12159)
Diffstat (limited to 'crypto/ec/ec_kmeth.c')
-rw-r--r--crypto/ec/ec_kmeth.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/crypto/ec/ec_kmeth.c b/crypto/ec/ec_kmeth.c
index 1f30571089..3fec8a4d81 100644
--- a/crypto/ec/ec_kmeth.c
+++ b/crypto/ec/ec_kmeth.c
@@ -76,7 +76,8 @@ int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth)
return 1;
}
-EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine)
+EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, const char *propq,
+ ENGINE *engine)
{
EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
@@ -86,13 +87,19 @@ EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine)
}
ret->libctx = libctx;
+ if (propq != NULL) {
+ ret->propq = OPENSSL_strdup(propq);
+ if (ret->propq == NULL) {
+ ECerr(EC_F_EC_KEY_NEW_METHOD_INT, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
ret->references = 1;
ret->lock = CRYPTO_THREAD_lock_new();
if (ret->lock == NULL) {
ECerr(EC_F_EC_KEY_NEW_METHOD_INT, ERR_R_MALLOC_FAILURE);
- OPENSSL_free(ret);
- return NULL;
+ goto err;
}
ret->meth = EC_KEY_get_default_method();
@@ -138,7 +145,7 @@ EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, ENGINE *engine)
#ifndef FIPS_MODULE
EC_KEY *EC_KEY_new_method(ENGINE *engine)
{
- return ec_key_new_method_int(NULL, engine);
+ return ec_key_new_method_int(NULL, NULL, engine);
}
#endif