summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ecx_backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ec/ecx_backend.c')
-rw-r--r--crypto/ec/ecx_backend.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/crypto/ec/ecx_backend.c b/crypto/ec/ecx_backend.c
index 2ab7611be9..7a43274d51 100644
--- a/crypto/ec/ecx_backend.c
+++ b/crypto/ec/ecx_backend.c
@@ -110,10 +110,8 @@ ECX_KEY *ossl_ecx_key_dup(const ECX_KEY *key, int selection)
{
ECX_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
- if (ret == NULL) {
- ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
+ if (ret == NULL)
return NULL;
- }
ret->lock = CRYPTO_THREAD_lock_new();
if (ret->lock == NULL) {
@@ -138,8 +136,10 @@ ECX_KEY *ossl_ecx_key_dup(const ECX_KEY *key, int selection)
if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0
&& key->privkey != NULL) {
- if (ossl_ecx_key_allocate_privkey(ret) == NULL)
+ if (ossl_ecx_key_allocate_privkey(ret) == NULL) {
+ ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
goto err;
+ }
memcpy(ret->privkey, key->privkey, ret->keylen);
}
@@ -147,7 +147,6 @@ ECX_KEY *ossl_ecx_key_dup(const ECX_KEY *key, int selection)
err:
ossl_ecx_key_free(ret);
- ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
return NULL;
}
@@ -186,7 +185,7 @@ ECX_KEY *ossl_ecx_key_op(const X509_ALGOR *palg,
key = ossl_ecx_key_new(libctx, KEYNID2TYPE(id), 1, propq);
if (key == NULL) {
- ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
return 0;
}
pubkey = key->pubkey;
@@ -196,7 +195,7 @@ ECX_KEY *ossl_ecx_key_op(const X509_ALGOR *palg,
} else {
privkey = ossl_ecx_key_allocate_privkey(key);
if (privkey == NULL) {
- ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
goto err;
}
if (op == KEY_OP_KEYGEN) {