aboutsummaryrefslogtreecommitdiff
path: root/crypto/engine/tb_asnmth.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/engine/tb_asnmth.c')
-rw-r--r--crypto/engine/tb_asnmth.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c
index 72850b9398e3..81f8e7add0e7 100644
--- a/crypto/engine/tb_asnmth.c
+++ b/crypto/engine/tb_asnmth.c
@@ -1,12 +1,15 @@
/*
- * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.
*
- * Licensed under the OpenSSL license (the "License"). You may not use
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
+/* We need to use some engine deprecated APIs */
+#define OPENSSL_SUPPRESS_DEPRECATED
+
#include "e_os.h"
#include "eng_local.h"
#include <openssl/evp.h>
@@ -73,7 +76,8 @@ int ENGINE_set_default_pkey_asn1_meths(ENGINE *e)
*/
ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid)
{
- return engine_table_select(&pkey_asn1_meth_table, nid);
+ return ossl_engine_table_select(&pkey_asn1_meth_table, nid,
+ OPENSSL_FILE, OPENSSL_LINE);
}
/*
@@ -85,8 +89,7 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid)
EVP_PKEY_ASN1_METHOD *ret;
ENGINE_PKEY_ASN1_METHS_PTR fn = ENGINE_get_pkey_asn1_meths(e);
if (!fn || !fn(e, &ret, NULL, nid)) {
- ENGINEerr(ENGINE_F_ENGINE_GET_PKEY_ASN1_METH,
- ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD);
+ ERR_raise(ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD);
return NULL;
}
return ret;
@@ -149,7 +152,7 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
e->pkey_asn1_meths(e, &ameth, NULL, nids[i]);
if (ameth != NULL
&& ((int)strlen(ameth->pem_str) == len)
- && strncasecmp(ameth->pem_str, str, len) == 0)
+ && OPENSSL_strncasecmp(ameth->pem_str, str, len) == 0)
return ameth;
}
return NULL;
@@ -174,7 +177,7 @@ static void look_str_cb(int nid, STACK_OF(ENGINE) *sk, ENGINE *def, void *arg)
e->pkey_asn1_meths(e, &ameth, NULL, nid);
if (ameth != NULL
&& ((int)strlen(ameth->pem_str) == lk->len)
- && strncasecmp(ameth->pem_str, lk->str, lk->len) == 0) {
+ && OPENSSL_strncasecmp(ameth->pem_str, lk->str, lk->len) == 0) {
lk->e = e;
lk->ameth = ameth;
return;
@@ -193,16 +196,17 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
fstr.len = len;
if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
- ENGINEerr(ENGINE_F_ENGINE_PKEY_ASN1_FIND_STR, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_ENGINE, ERR_R_MALLOC_FAILURE);
return NULL;
}
- CRYPTO_THREAD_write_lock(global_engine_lock);
+ if (!CRYPTO_THREAD_write_lock(global_engine_lock))
+ return NULL;
engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr);
/* If found obtain a structural reference to engine */
if (fstr.e) {
fstr.e->struct_ref++;
- engine_ref_debug(fstr.e, 0, 1);
+ ENGINE_REF_PRINT(fstr.e, 0, 1);
}
*pe = fstr.e;
CRYPTO_THREAD_unlock(global_engine_lock);