summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2021-02-18 20:27:26 +1000
committerShane Lontis <shane.lontis@oracle.com>2021-02-26 10:53:01 +1000
commit32ab57cbb4877ce7e6b4eb3f9b3cfbb0ff7cd10b (patch)
tree91e75951efa936b26e3a636b9a0daf90d60182b0 /providers
parent5af02212a5331cc30389246bb94f97fbcdebc23a (diff)
Fix external symbols related to ec & sm2 keys
Partial fix for #12964 This adds ossl_ names for the following symbols: ec_*, ecx_*, ecdh_*, ecdsa_*, sm2_* Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14231)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/asymciphers/sm2_enc.c8
-rw-r--r--providers/implementations/encode_decode/decode_der2key.c20
-rw-r--r--providers/implementations/encode_decode/encode_key2text.c4
-rw-r--r--providers/implementations/exchange/ecdh_exch.c14
-rw-r--r--providers/implementations/exchange/ecx_exch.c18
-rw-r--r--providers/implementations/keymgmt/ec_kmgmt.c68
-rw-r--r--providers/implementations/keymgmt/ecx_kmgmt.c55
-rw-r--r--providers/implementations/signature/eddsa.c6
-rw-r--r--providers/implementations/signature/sm2sig.c7
9 files changed, 104 insertions, 96 deletions
diff --git a/providers/implementations/asymciphers/sm2_enc.c b/providers/implementations/asymciphers/sm2_enc.c
index 923ee5694a..0068e504e2 100644
--- a/providers/implementations/asymciphers/sm2_enc.c
+++ b/providers/implementations/asymciphers/sm2_enc.c
@@ -89,14 +89,14 @@ static int sm2_asym_encrypt(void *vpsm2ctx, unsigned char *out, size_t *outlen,
return 0;
if (out == NULL) {
- if (!sm2_ciphertext_size(psm2ctx->key, md, inlen, outlen)) {
+ if (!ossl_sm2_ciphertext_size(psm2ctx->key, md, inlen, outlen)) {
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
return 0;
}
return 1;
}
- return sm2_encrypt(psm2ctx->key, md, in, inlen, out, outlen);
+ return ossl_sm2_encrypt(psm2ctx->key, md, in, inlen, out, outlen);
}
static int sm2_asym_decrypt(void *vpsm2ctx, unsigned char *out, size_t *outlen,
@@ -110,12 +110,12 @@ static int sm2_asym_decrypt(void *vpsm2ctx, unsigned char *out, size_t *outlen,
return 0;
if (out == NULL) {
- if (!sm2_plaintext_size(psm2ctx->key, md, inlen, outlen))
+ if (!ossl_sm2_plaintext_size(psm2ctx->key, md, inlen, outlen))
return 0;
return 1;
}
- return sm2_decrypt(psm2ctx->key, md, in, inlen, out, outlen);
+ return ossl_sm2_decrypt(psm2ctx->key, md, in, inlen, out, outlen);
}
static void sm2_freectx(void *vpsm2ctx)
diff --git a/providers/implementations/encode_decode/decode_der2key.c b/providers/implementations/encode_decode/decode_der2key.c
index 5073e660cd..fed30bf952 100644
--- a/providers/implementations/encode_decode/decode_der2key.c
+++ b/providers/implementations/encode_decode/decode_der2key.c
@@ -462,7 +462,7 @@ static void dsa_adjust(void *key, struct der2key_ctx_st *ctx)
static void ec_adjust(void *key, struct der2key_ctx_st *ctx)
{
- ec_key_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
+ ossl_ec_key_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
}
/*
@@ -472,39 +472,39 @@ static void ec_adjust(void *key, struct der2key_ctx_st *ctx)
static void ecx_key_adjust(void *key, struct der2key_ctx_st *ctx)
{
- ecx_key_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
+ ossl_ecx_key_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
}
# define ed25519_evp_type EVP_PKEY_ED25519
-# define ed25519_evp_extract (extract_key_fn *)evp_pkey_get1_ED25519
+# define ed25519_evp_extract (extract_key_fn *)ossl_evp_pkey_get1_ED25519
# define ed25519_d2i_private_key NULL
# define ed25519_d2i_public_key NULL
# define ed25519_d2i_key_params NULL
-# define ed25519_free (free_key_fn *)ecx_key_free
+# define ed25519_free (free_key_fn *)ossl_ecx_key_free
# define ed25519_adjust ecx_key_adjust
# define ed448_evp_type EVP_PKEY_ED448
-# define ed448_evp_extract (extract_key_fn *)evp_pkey_get1_ED448
+# define ed448_evp_extract (extract_key_fn *)ossl_evp_pkey_get1_ED448
# define ed448_d2i_private_key NULL
# define ed448_d2i_public_key NULL
# define ed448_d2i_key_params NULL
-# define ed448_free (free_key_fn *)ecx_key_free
+# define ed448_free (free_key_fn *)ossl_ecx_key_free
# define ed448_adjust ecx_key_adjust
# define x25519_evp_type EVP_PKEY_X25519
-# define x25519_evp_extract (extract_key_fn *)evp_pkey_get1_X25519
+# define x25519_evp_extract (extract_key_fn *)ossl_evp_pkey_get1_X25519
# define x25519_d2i_private_key NULL
# define x25519_d2i_public_key NULL
# define x25519_d2i_key_params NULL
-# define x25519_free (free_key_fn *)ecx_key_free
+# define x25519_free (free_key_fn *)ossl_ecx_key_free
# define x25519_adjust ecx_key_adjust
# define x448_evp_type EVP_PKEY_X448
-# define x448_evp_extract (extract_key_fn *)evp_pkey_get1_X448
+# define x448_evp_extract (extract_key_fn *)ossl_evp_pkey_get1_X448
# define x448_d2i_private_key NULL
# define x448_d2i_public_key NULL
# define x448_d2i_key_params NULL
-# define x448_free (free_key_fn *)ecx_key_free
+# define x448_free (free_key_fn *)ossl_ecx_key_free
# define x448_adjust ecx_key_adjust
# ifndef OPENSSL_NO_SM2
diff --git a/providers/implementations/encode_decode/encode_key2text.c b/providers/implementations/encode_decode/encode_key2text.c
index 103a647467..2c6c5d70db 100644
--- a/providers/implementations/encode_decode/encode_key2text.c
+++ b/providers/implementations/encode_decode/encode_key2text.c
@@ -25,7 +25,7 @@
#include "crypto/bn.h" /* bn_get_words() */
#include "crypto/dh.h" /* ossl_dh_get0_params() */
#include "crypto/dsa.h" /* ossl_dsa_get0_params() */
-#include "crypto/ec.h" /* ec_key_get_libctx */
+#include "crypto/ec.h" /* ossl_ec_key_get_libctx */
#include "crypto/ecx.h" /* ECX_KEY, etc... */
#include "crypto/rsa.h" /* RSA_PSS_PARAMS_30, etc... */
#include "prov/bio.h"
@@ -539,7 +539,7 @@ static int ec_to_text(BIO *out, const void *key, int selection)
&& !print_labeled_buf(out, "pub:", pub, pub_len))
goto err;
if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0)
- ret = ec_param_to_text(out, group, ec_key_get_libctx(ec));
+ ret = ec_param_to_text(out, group, ossl_ec_key_get_libctx(ec));
err:
OPENSSL_clear_free(priv, priv_len);
OPENSSL_free(pub);
diff --git a/providers/implementations/exchange/ecdh_exch.c b/providers/implementations/exchange/ecdh_exch.c
index 8d3f748f9b..6c24643255 100644
--- a/providers/implementations/exchange/ecdh_exch.c
+++ b/providers/implementations/exchange/ecdh_exch.c
@@ -25,7 +25,7 @@
#include "prov/providercommon.h"
#include "prov/implementations.h"
#include "prov/securitycheck.h"
-#include "crypto/ec.h" /* ecdh_KDF_X9_63() */
+#include "crypto/ec.h" /* ossl_ecdh_kdf_X9_63() */
static OSSL_FUNC_keyexch_newctx_fn ecdh_newctx;
static OSSL_FUNC_keyexch_init_fn ecdh_init;
@@ -498,12 +498,12 @@ int ecdh_X9_63_kdf_derive(void *vpecdhctx, unsigned char *secret,
goto err;
/* Do KDF stuff */
- if (!ecdh_KDF_X9_63(secret, pecdhctx->kdf_outlen,
- stmp, stmplen,
- pecdhctx->kdf_ukm,
- pecdhctx->kdf_ukmlen,
- pecdhctx->kdf_md,
- pecdhctx->libctx, NULL))
+ if (!ossl_ecdh_kdf_X9_63(secret, pecdhctx->kdf_outlen,
+ stmp, stmplen,
+ pecdhctx->kdf_ukm,
+ pecdhctx->kdf_ukmlen,
+ pecdhctx->kdf_md,
+ pecdhctx->libctx, NULL))
goto err;
*psecretlen = pecdhctx->kdf_outlen;
ret = 1;
diff --git a/providers/implementations/exchange/ecx_exch.c b/providers/implementations/exchange/ecx_exch.c
index 17118f0e6c..6d4471be3c 100644
--- a/providers/implementations/exchange/ecx_exch.c
+++ b/providers/implementations/exchange/ecx_exch.c
@@ -80,12 +80,12 @@ static int ecx_init(void *vecxctx, void *vkey)
if (ecxctx == NULL
|| key == NULL
|| key->keylen != ecxctx->keylen
- || !ecx_key_up_ref(key)) {
+ || !ossl_ecx_key_up_ref(key)) {
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
return 0;
}
- ecx_key_free(ecxctx->key);
+ ossl_ecx_key_free(ecxctx->key);
ecxctx->key = key;
return 1;
@@ -102,11 +102,11 @@ static int ecx_set_peer(void *vecxctx, void *vkey)
if (ecxctx == NULL
|| key == NULL
|| key->keylen != ecxctx->keylen
- || !ecx_key_up_ref(key)) {
+ || !ossl_ecx_key_up_ref(key)) {
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
return 0;
}
- ecx_key_free(ecxctx->peerkey);
+ ossl_ecx_key_free(ecxctx->peerkey);
ecxctx->peerkey = key;
return 1;
@@ -182,8 +182,8 @@ static void ecx_freectx(void *vecxctx)
{
PROV_ECX_CTX *ecxctx = (PROV_ECX_CTX *)vecxctx;
- ecx_key_free(ecxctx->key);
- ecx_key_free(ecxctx->peerkey);
+ ossl_ecx_key_free(ecxctx->key);
+ ossl_ecx_key_free(ecxctx->peerkey);
OPENSSL_free(ecxctx);
}
@@ -203,15 +203,15 @@ static void *ecx_dupctx(void *vecxctx)
}
*dstctx = *srcctx;
- if (dstctx->key != NULL && !ecx_key_up_ref(dstctx->key)) {
+ if (dstctx->key != NULL && !ossl_ecx_key_up_ref(dstctx->key)) {
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
OPENSSL_free(dstctx);
return NULL;
}
- if (dstctx->peerkey != NULL && !ecx_key_up_ref(dstctx->peerkey)) {
+ if (dstctx->peerkey != NULL && !ossl_ecx_key_up_ref(dstctx->peerkey)) {
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
- ecx_key_free(dstctx->key);
+ ossl_ecx_key_free(dstctx->key);
OPENSSL_free(dstctx);
return NULL;
}
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
index f612d8ed0e..6a74196600 100644
--- a/providers/implementations/keymgmt/ec_kmgmt.c
+++ b/providers/implementations/keymgmt/ec_kmgmt.c
@@ -131,7 +131,7 @@ int key_to_params(const EC_KEY *eckey, OSSL_PARAM_BLD *tmpl,
* EC_POINT_point2buf() can generate random numbers in some
* implementations so we need to ensure we use the correct libctx.
*/
- bnctx = BN_CTX_new_ex(ec_key_get_libctx(eckey));
+ bnctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(eckey));
if (bnctx == NULL)
goto err;
@@ -237,7 +237,7 @@ int otherparams_to_params(const EC_KEY *ec, OSSL_PARAM_BLD *tmpl,
return 0;
format = EC_KEY_get_conv_form(ec);
- name = ec_pt_format_id2name((int)format);
+ name = ossl_ec_pt_format_id2name((int)format);
if (name != NULL
&& !ossl_param_build_set_utf8_string(tmpl, params,
OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT,
@@ -245,7 +245,7 @@ int otherparams_to_params(const EC_KEY *ec, OSSL_PARAM_BLD *tmpl,
return 0;
group_check = EC_KEY_get_flags(ec) & EC_FLAG_CHECK_NAMED_GROUP_MASK;
- name = ec_check_group_type_id2name(group_check);
+ name = ossl_ec_check_group_type_id2name(group_check);
if (name != NULL
&& !ossl_param_build_set_utf8_string(tmpl, params,
OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE,
@@ -314,7 +314,7 @@ static int ec_match(const void *keydata1, const void *keydata2, int selection)
if (!ossl_prov_is_running())
return 0;
- ctx = BN_CTX_new_ex(ec_key_get_libctx(ec1));
+ ctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(ec1));
if (ctx == NULL)
return 0;
@@ -377,7 +377,7 @@ int common_import(void *keydata, int selection, const OSSL_PARAM params[],
if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) == 0)
return 0;
- ok = ok && ec_group_fromdata(ec, params);
+ ok = ok && ossl_ec_group_fromdata(ec, params);
if (!common_check_sm2(ec, sm2_wanted))
return 0;
@@ -386,10 +386,10 @@ int common_import(void *keydata, int selection, const OSSL_PARAM params[],
int include_private =
selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY ? 1 : 0;
- ok = ok && ec_key_fromdata(ec, params, include_private);
+ ok = ok && ossl_ec_key_fromdata(ec, params, include_private);
}
if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0)
- ok = ok && ec_key_otherparams_fromdata(ec, params);
+ ok = ok && ossl_ec_key_otherparams_fromdata(ec, params);
return ok;
}
@@ -451,15 +451,16 @@ int ec_export(void *keydata, int selection, OSSL_CALLBACK *param_cb,
return 0;
if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) {
- bnctx = BN_CTX_new_ex(ec_key_get_libctx(ec));
+ bnctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(ec));
if (bnctx == NULL) {
ok = 0;
goto end;
}
BN_CTX_start(bnctx);
- ok = ok && ec_group_todata(EC_KEY_get0_group(ec), tmpl, NULL,
- ec_key_get_libctx(ec), ec_key_get0_propq(ec),
- bnctx, &genbuf);
+ ok = ok && ossl_ec_group_todata(EC_KEY_get0_group(ec), tmpl, NULL,
+ ossl_ec_key_get_libctx(ec),
+ ossl_ec_key_get0_propq(ec),
+ bnctx, &genbuf);
}
if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) {
@@ -610,8 +611,8 @@ int common_get_params(void *key, OSSL_PARAM params[], int sm2)
if (ecg == NULL)
return 0;
- libctx = ec_key_get_libctx(eck);
- propq = ec_key_get0_propq(eck);
+ libctx = ossl_ec_key_get_libctx(eck);
+ propq = ossl_ec_key_get0_propq(eck);
bnctx = BN_CTX_new_ex(libctx);
if (bnctx == NULL)
@@ -696,7 +697,8 @@ int common_get_params(void *key, OSSL_PARAM params[], int sm2)
}
ret = ec_get_ecm_params(ecg, params)
- && ec_group_todata(ecg, NULL, params, libctx, propq, bnctx, &genbuf)
+ && ossl_ec_group_todata(ecg, NULL, params, libctx, propq, bnctx,
+ &genbuf)
&& key_to_params(eck, NULL, params, 1, &pub_key)
&& otherparams_to_params(eck, NULL, params);
err:
@@ -773,12 +775,12 @@ int ec_set_params(void *key, const OSSL_PARAM params[])
if (key == NULL)
return 0;
- if (!ec_group_set_params((EC_GROUP *)EC_KEY_get0_group(key), params))
+ if (!ossl_ec_group_set_params((EC_GROUP *)EC_KEY_get0_group(key), params))
return 0;
p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY);
if (p != NULL) {
- BN_CTX *ctx = BN_CTX_new_ex(ec_key_get_libctx(key));
+ BN_CTX *ctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(key));
int ret = 1;
if (ctx == NULL
@@ -790,7 +792,7 @@ int ec_set_params(void *key, const OSSL_PARAM params[])
return 0;
}
- return ec_key_otherparams_fromdata(eck, params);
+ return ossl_ec_key_otherparams_fromdata(eck, params);
}
#ifndef FIPS_MODULE
@@ -842,7 +844,7 @@ int sm2_validate(const void *keydata, int selection, int checktype)
if (!ossl_prov_is_running())
return 0;
- ctx = BN_CTX_new_ex(ec_key_get_libctx(eck));
+ ctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(eck));
if (ctx == NULL)
return 0;
@@ -854,16 +856,16 @@ int sm2_validate(const void *keydata, int selection, int checktype)
if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
if (checktype == OSSL_KEYMGMT_VALIDATE_QUICK_CHECK)
- ok = ok && ec_key_public_check_quick(eck, ctx);
+ ok = ok && ossl_ec_key_public_check_quick(eck, ctx);
else
- ok = ok && ec_key_public_check(eck, ctx);
+ ok = ok && ossl_ec_key_public_check(eck, ctx);
}
if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
- ok = ok && sm2_key_private_check(eck);
+ ok = ok && ossl_sm2_key_private_check(eck);
if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == OSSL_KEYMGMT_SELECT_KEYPAIR)
- ok = ok && ec_key_pairwise_check(eck, ctx);
+ ok = ok && ossl_ec_key_pairwise_check(eck, ctx);
BN_CTX_free(ctx);
return ok;
@@ -881,7 +883,7 @@ int ec_validate(const void *keydata, int selection, int checktype)
if (!ossl_prov_is_running())
return 0;
- ctx = BN_CTX_new_ex(ec_key_get_libctx(eck));
+ ctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(eck));
if (ctx == NULL)
return 0;
@@ -900,16 +902,16 @@ int ec_validate(const void *keydata, int selection, int checktype)
if ((selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
if (checktype == OSSL_KEYMGMT_VALIDATE_QUICK_CHECK)
- ok = ok && ec_key_public_check_quick(eck, ctx);
+ ok = ok && ossl_ec_key_public_check_quick(eck, ctx);
else
- ok = ok && ec_key_public_check(eck, ctx);
+ ok = ok && ossl_ec_key_public_check(eck, ctx);
}
if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
- ok = ok && ec_key_private_check(eck);
+ ok = ok && ossl_ec_key_private_check(eck);
if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == OSSL_KEYMGMT_SELECT_KEYPAIR)
- ok = ok && ec_key_pairwise_check(eck, ctx);
+ ok = ok && ossl_ec_key_pairwise_check(eck, ctx);
BN_CTX_free(ctx);
return ok;
@@ -1168,14 +1170,14 @@ static void *ec_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg)
goto err;
} else {
if (gctx->encoding != NULL) {
- int flags = ec_encoding_name2id(gctx->encoding);
+ int flags = ossl_ec_encoding_name2id(gctx->encoding);
if (flags < 0)
goto err;
EC_GROUP_set_asn1_flag(gctx->gen_group, flags);
}
if (gctx->pt_format != NULL) {
- int format = ec_pt_format_name2id(gctx->pt_format);
+ int format = ossl_ec_pt_format_name2id(gctx->pt_format);
if (format < 0)
goto err;
@@ -1191,10 +1193,10 @@ static void *ec_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg)
ret = ret && EC_KEY_generate_key(ec);
if (gctx->ecdh_mode != -1)
- ret = ret && ec_set_ecdh_cofactor_mode(ec, gctx->ecdh_mode);
+ ret = ret && ossl_ec_set_ecdh_cofactor_mode(ec, gctx->ecdh_mode);
if (gctx->group_check != NULL)
- ret = ret && ec_set_check_group_type_from_name(ec, gctx->group_check);
+ ret = ret && ossl_ec_set_check_group_type_from_name(ec, gctx->group_check);
if (ret)
return ec;
err:
@@ -1223,14 +1225,14 @@ static void *sm2_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg)
goto err;
} else {
if (gctx->encoding) {
- int flags = ec_encoding_name2id(gctx->encoding);
+ int flags = ossl_ec_encoding_name2id(gctx->encoding);
if (flags < 0)
goto err;
EC_GROUP_set_asn1_flag(gctx->gen_group, flags);
}
if (gctx->pt_format != NULL) {
- int format = ec_pt_format_name2id(gctx->pt_format);
+ int format = ossl_ec_pt_format_name2id(gctx->pt_format);
if (format < 0)
goto err;
diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c
index 86deae8561..6cb0e9bc41 100644
--- a/providers/implementations/keymgmt/ecx_kmgmt.c
+++ b/providers/implementations/keymgmt/ecx_kmgmt.c
@@ -89,32 +89,32 @@ static void *x25519_new_key(void *provctx)
{
if (!ossl_prov_is_running())
return 0;
- return ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_X25519, 0,
- NULL);
+ return ossl_ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_X25519, 0,
+ NULL);
}
static void *x448_new_key(void *provctx)
{
if (!ossl_prov_is_running())
return 0;
- return ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_X448, 0,
- NULL);
+ return ossl_ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_X448, 0,
+ NULL);
}
static void *ed25519_new_key(void *provctx)
{
if (!ossl_prov_is_running())
return 0;
- return ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_ED25519, 0,
- NULL);
+ return ossl_ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_ED25519, 0,
+ NULL);
}
static void *ed448_new_key(void *provctx)
{
if (!ossl_prov_is_running())
return 0;
- return ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_ED448, 0,
- NULL);
+ return ossl_ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_ED448, 0,
+ NULL);
}
static int ecx_has(const void *keydata, int selection)
@@ -184,7 +184,7 @@ static int ecx_import(void *keydata, int selection, const OSSL_PARAM params[])
return 0;
include_private = ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0);
- ok = ok && ecx_key_fromdata(key, params, include_private);
+ ok = ok && ossl_ecx_key_fromdata(key, params, include_private);
return ok;
}
@@ -546,7 +546,8 @@ static void *ecx_gen(struct ecx_gen_ctx *gctx)
if (gctx == NULL)
return NULL;
- if ((key = ecx_key_new(gctx->libctx, gctx->type, 0, gctx->propq)) == NULL) {
+ if ((key = ossl_ecx_key_new(gctx->libctx, gctx->type, 0,
+ gctx->propq)) == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
return NULL;
}
@@ -555,7 +556,7 @@ static void *ecx_gen(struct ecx_gen_ctx *gctx)
if ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0)
return key;
- if ((privkey = ecx_key_allocate_privkey(key)) == NULL) {
+ if ((privkey = ossl_ecx_key_allocate_privkey(key)) == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
goto err;
}
@@ -587,7 +588,7 @@ static void *ecx_gen(struct ecx_gen_ctx *gctx)
key->haspubkey = 1;
return key;
err:
- ecx_key_free(key);
+ ossl_ecx_key_free(key);
return NULL;
}
@@ -749,7 +750,7 @@ static int ed448_validate(const void *keydata, int selection, int checktype)
#define MAKE_KEYMGMT_FUNCTIONS(alg) \
const OSSL_DISPATCH ossl_##alg##_keymgmt_functions[] = { \
{ OSSL_FUNC_KEYMGMT_NEW, (void (*)(void))alg##_new_key }, \
- { OSSL_FUNC_KEYMGMT_FREE, (void (*)(void))ecx_key_free }, \
+ { OSSL_FUNC_KEYMGMT_FREE, (void (*)(void))ossl_ecx_key_free }, \
{ OSSL_FUNC_KEYMGMT_GET_PARAMS, (void (*) (void))alg##_get_params }, \
{ OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS, (void (*) (void))alg##_gettable_params }, \
{ OSSL_FUNC_KEYMGMT_SET_PARAMS, (void (*) (void))alg##_set_params }, \
@@ -786,7 +787,8 @@ static void *s390x_ecx_keygen25519(struct ecx_gen_ctx *gctx)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- ECX_KEY *key = ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X25519, 1, gctx->propq);
+ ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X25519, 1,
+ gctx->propq);
unsigned char *privkey = NULL, *pubkey;
if (key == NULL) {
@@ -800,7 +802,7 @@ static void *s390x_ecx_keygen25519(struct ecx_gen_ctx *gctx)
pubkey = key->pubkey;
- privkey = ecx_key_allocate_privkey(key);
+ privkey = ossl_ecx_key_allocate_privkey(key);
if (privkey == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
goto err;
@@ -818,7 +820,7 @@ static void *s390x_ecx_keygen25519(struct ecx_gen_ctx *gctx)
key->haspubkey = 1;
return key;
err:
- ecx_key_free(key);
+ ossl_ecx_key_free(key);
return NULL;
}
@@ -831,7 +833,8 @@ static void *s390x_ecx_keygen448(struct ecx_gen_ctx *gctx)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- ECX_KEY *key = ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X448, 1, gctx->propq);
+ ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X448, 1,
+ gctx->propq);
unsigned char *privkey = NULL, *pubkey;
if (key == NULL) {
@@ -845,7 +848,7 @@ static void *s390x_ecx_keygen448(struct ecx_gen_ctx *gctx)
pubkey = key->pubkey;
- privkey = ecx_key_allocate_privkey(key);
+ privkey = ossl_ecx_key_allocate_privkey(key);
if (privkey == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
goto err;
@@ -862,7 +865,7 @@ static void *s390x_ecx_keygen448(struct ecx_gen_ctx *gctx)
key->haspubkey = 1;
return key;
err:
- ecx_key_free(key);
+ ossl_ecx_key_free(key);
return NULL;
}
@@ -879,7 +882,8 @@ static void *s390x_ecd_keygen25519(struct ecx_gen_ctx *gctx)
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
};
unsigned char x_dst[32], buff[SHA512_DIGEST_LENGTH];
- ECX_KEY *key = ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED25519, 1, gctx->propq);
+ ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED25519, 1,
+ gctx->propq);
unsigned char *privkey = NULL, *pubkey;
unsigned int sz;
EVP_MD *sha = NULL;
@@ -896,7 +900,7 @@ static void *s390x_ecd_keygen25519(struct ecx_gen_ctx *gctx)
pubkey = key->pubkey;
- privkey = ecx_key_allocate_privkey(key);
+ privkey = ossl_ecx_key_allocate_privkey(key);
if (privkey == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
goto err;
@@ -925,7 +929,7 @@ static void *s390x_ecd_keygen25519(struct ecx_gen_ctx *gctx)
key->haspubkey = 1;
return key;
err:
- ecx_key_free(key);
+ ossl_ecx_key_free(key);
return NULL;
}
@@ -946,7 +950,8 @@ static void *s390x_ecd_keygen448(struct ecx_gen_ctx *gctx)
0x24, 0xbc, 0xb6, 0x6e, 0x71, 0x46, 0x3f, 0x69, 0x00
};
unsigned char x_dst[57], buff[114];
- ECX_KEY *key = ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED448, 1, gctx->propq);
+ ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED448, 1,
+ gctx->propq);
unsigned char *privkey = NULL, *pubkey;
EVP_MD_CTX *hashctx = NULL;
EVP_MD *shake = NULL;
@@ -962,7 +967,7 @@ static void *s390x_ecd_keygen448(struct ecx_gen_ctx *gctx)
pubkey = key->pubkey;
- privkey = ecx_key_allocate_privkey(key);
+ privkey = ossl_ecx_key_allocate_privkey(key);
if (privkey == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
goto err;
@@ -998,7 +1003,7 @@ static void *s390x_ecd_keygen448(struct ecx_gen_ctx *gctx)
key->haspubkey = 1;
return key;
err:
- ecx_key_free(key);
+ ossl_ecx_key_free(key);
EVP_MD_CTX_free(hashctx);
EVP_MD_free(shake);
return NULL;
diff --git a/providers/implementations/signature/eddsa.c b/providers/implementations/signature/eddsa.c
index 9813545381..71b57d70ea 100644
--- a/providers/implementations/signature/eddsa.c
+++ b/providers/implementations/signature/eddsa.c
@@ -99,7 +99,7 @@ static int eddsa_digest_signverify_init(void *vpeddsactx, const char *mdname,
return 0;
}
- if (!ecx_key_up_ref(edkey)) {
+ if (!ossl_ecx_key_up_ref(edkey)) {
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
return 0;
}
@@ -240,7 +240,7 @@ static void eddsa_freectx(void *vpeddsactx)
{
PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx;
- ecx_key_free(peddsactx->key);
+ ossl_ecx_key_free(peddsactx->key);
OPENSSL_free(peddsactx);
}
@@ -260,7 +260,7 @@ static void *eddsa_dupctx(void *vpeddsactx)
*dstctx = *srcctx;
dstctx->key = NULL;
- if (srcctx->key != NULL && !ecx_key_up_ref(srcctx->key)) {
+ if (srcctx->key != NULL && !ossl_ecx_key_up_ref(srcctx->key)) {
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
goto err;
}
diff --git a/providers/implementations/signature/sm2sig.c b/providers/implementations/signature/sm2sig.c
index 84c3853f23..d12c7191fb 100644
--- a/providers/implementations/signature/sm2sig.c
+++ b/providers/implementations/signature/sm2sig.c
@@ -144,7 +144,7 @@ static int sm2sig_sign(void *vpsm2ctx, unsigned char *sig, size_t *siglen,
if (ctx->mdsize != 0 && tbslen != ctx->mdsize)
return 0;
- ret = sm2_internal_sign(tbs, tbslen, sig, &sltmp, ctx->ec);
+ ret = ossl_sm2_internal_sign(tbs, tbslen, sig, &sltmp, ctx->ec);
if (ret <= 0)
return 0;
@@ -160,7 +160,7 @@ static int sm2sig_verify(void *vpsm2ctx, const unsigned char *sig, size_t siglen
if (ctx->mdsize != 0 && tbslen != ctx->mdsize)
return 0;
- return sm2_internal_verify(tbs, tbslen, sig, siglen, ctx->ec);
+ return ossl_sm2_internal_verify(tbs, tbslen, sig, siglen, ctx->ec);
}
static void free_md(PROV_SM2_CTX *ctx)
@@ -231,7 +231,8 @@ static int sm2sig_compute_z_digest(PROV_SM2_CTX *ctx)
if ((z = OPENSSL_zalloc(ctx->mdsize)) == NULL
/* get hashed prefix 'z' of tbs message */
- || !sm2_compute_z_digest(z, ctx->md, ctx->id, ctx->id_len, ctx->ec)
+ || !ossl_sm2_compute_z_digest(z, ctx->md, ctx->id, ctx->id_len,
+ ctx->ec)
|| !EVP_DigestUpdate(ctx->mdctx, z, ctx->mdsize))
ret = 0;
OPENSSL_free(z);