diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-09-22 15:51:49 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-09-23 17:31:40 +1000 |
commit | 8dbef010e7e6ecc07a9c8142cf26c8768fd55dc2 (patch) | |
tree | a3e5ecfc64eed994b7c1c2e185ce45e182332f69 /crypto/ec/ecx_key.c | |
parent | 7f80980fb7096ab4898e500a054a1bb8cbcaa266 (diff) |
Fix ecx so that is uses a settable propertyquery
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12944)
Diffstat (limited to 'crypto/ec/ecx_key.c')
-rw-r--r-- | crypto/ec/ecx_key.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/crypto/ec/ecx_key.c b/crypto/ec/ecx_key.c index 46abd57a74..dd4b872ab0 100644 --- a/crypto/ec/ecx_key.c +++ b/crypto/ec/ecx_key.c @@ -10,7 +10,8 @@ #include <openssl/err.h> #include "crypto/ecx.h" -ECX_KEY *ecx_key_new(OPENSSL_CTX *libctx, ECX_KEY_TYPE type, int haspubkey) +ECX_KEY *ecx_key_new(OPENSSL_CTX *libctx, ECX_KEY_TYPE type, int haspubkey, + const char *propq) { ECX_KEY *ret = OPENSSL_zalloc(sizeof(*ret)); @@ -36,14 +37,21 @@ ECX_KEY *ecx_key_new(OPENSSL_CTX *libctx, ECX_KEY_TYPE type, int haspubkey) ret->type = type; ret->references = 1; - ret->lock = CRYPTO_THREAD_lock_new(); - if (ret->lock == NULL) { + if (propq != NULL) { + ret->propq = OPENSSL_strdup(propq); ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE); - OPENSSL_free(ret); - return NULL; + if (ret->propq == NULL) + goto err; } + ret->lock = CRYPTO_THREAD_lock_new(); + if (ret->lock == NULL) + goto err; return ret; +err: + ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE); + OPENSSL_free(ret); + return NULL; } void ecx_key_free(ECX_KEY *key) @@ -59,6 +67,7 @@ void ecx_key_free(ECX_KEY *key) return; REF_ASSERT_ISNT(i < 0); + OPENSSL_free(key->propq); OPENSSL_secure_clear_free(key->privkey, key->keylen); CRYPTO_THREAD_lock_free(key->lock); OPENSSL_free(key); |