diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2021-02-18 06:56:53 +0100 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2021-02-26 01:50:30 +0100 |
commit | 19dbb742cdf68d8ada6338a025491a3b46b9ebe1 (patch) | |
tree | bf4d54751be7e826ad47f690990bde107d30b839 /providers | |
parent | Fix external symbols for bn (diff) | |
download | openssl-19dbb742cdf68d8ada6338a025491a3b46b9ebe1.tar.xz openssl-19dbb742cdf68d8ada6338a025491a3b46b9ebe1.zip |
Fix external symbols related to dh keys
Partial fix for #12964
This adds ossl_ names for the following symbols:
dh_new_by_nid_ex, dh_new_ex, dh_generate_ffc_parameters, dh_generate_public_key,
dh_get_named_group_uid_from_size, dh_gen_type_id2name, dh_gen_type_name2id,
dh_cache_named_group, dh_get0_params, dh_get0_nid,
dh_params_fromdata, dh_key_fromdata, dh_params_todata, dh_key_todata,
dh_check_pub_key_partial, dh_check_priv_key, dh_check_pairwise,
dh_get_method, dh_buf2key, dh_key2buf, dh_KDF_X9_42_asn1,
dh_pkey_method, dhx_pkey_method
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/encode_decode/encode_key2text.c | 4 | ||||
-rw-r--r-- | providers/implementations/exchange/dh_exch.c | 14 | ||||
-rw-r--r-- | providers/implementations/keymgmt/dh_kmgmt.c | 54 |
3 files changed, 36 insertions, 36 deletions
diff --git a/providers/implementations/encode_decode/encode_key2text.c b/providers/implementations/encode_decode/encode_key2text.c index 8be3478102..4b4cfc8fa7 100644 --- a/providers/implementations/encode_decode/encode_key2text.c +++ b/providers/implementations/encode_decode/encode_key2text.c @@ -23,7 +23,7 @@ #include <openssl/proverr.h> #include "internal/ffc.h" #include "crypto/bn.h" /* bn_get_words() */ -#include "crypto/dh.h" /* dh_get0_params() */ +#include "crypto/dh.h" /* ossl_dh_get0_params() */ #include "crypto/dsa.h" /* dsa_get0_params() */ #include "crypto/ec.h" /* ec_key_get_libctx */ #include "crypto/ecx.h" /* ECX_KEY, etc... */ @@ -245,7 +245,7 @@ static int dh_to_text(BIO *out, const void *key, int selection) } } if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) { - params = dh_get0_params((DH *)dh); + params = ossl_dh_get0_params((DH *)dh); if (params == NULL) { ERR_raise(ERR_LIB_PROV, PROV_R_NOT_PARAMETERS); return 0; diff --git a/providers/implementations/exchange/dh_exch.c b/providers/implementations/exchange/dh_exch.c index 32ce2ee0ed..2638675da5 100644 --- a/providers/implementations/exchange/dh_exch.c +++ b/providers/implementations/exchange/dh_exch.c @@ -180,13 +180,13 @@ static int dh_X9_42_kdf_derive(void *vpdhctx, unsigned char *secret, /* Do KDF stuff */ if (pdhctx->kdf_type == PROV_DH_KDF_X9_42_ASN1) { - if (!dh_KDF_X9_42_asn1(secret, pdhctx->kdf_outlen, - stmp, stmplen, - pdhctx->kdf_cekalg, - pdhctx->kdf_ukm, - pdhctx->kdf_ukmlen, - pdhctx->kdf_md, - pdhctx->libctx, NULL)) + if (!ossl_dh_kdf_X9_42_asn1(secret, pdhctx->kdf_outlen, + stmp, stmplen, + pdhctx->kdf_cekalg, + pdhctx->kdf_ukm, + pdhctx->kdf_ukmlen, + pdhctx->kdf_md, + pdhctx->libctx, NULL)) goto err; } *secretlen = pdhctx->kdf_outlen; diff --git a/providers/implementations/keymgmt/dh_kmgmt.c b/providers/implementations/keymgmt/dh_kmgmt.c index a967309644..9b1679e4fa 100644 --- a/providers/implementations/keymgmt/dh_kmgmt.c +++ b/providers/implementations/keymgmt/dh_kmgmt.c @@ -91,7 +91,7 @@ static int dh_gen_type_name2id_w_default(const char *name, int type) #endif } - return dh_gen_type_name2id(name); + return ossl_dh_gen_type_name2id(name); } static void *dh_newdata(void *provctx) @@ -99,7 +99,7 @@ static void *dh_newdata(void *provctx) DH *dh = NULL; if (ossl_prov_is_running()) { - dh = dh_new_ex(PROV_LIBCTX_OF(provctx)); + dh = ossl_dh_new_ex(PROV_LIBCTX_OF(provctx)); if (dh != NULL) { DH_clear_flags(dh, DH_FLAG_TYPE_MASK); DH_set_flags(dh, DH_FLAG_TYPE_DH); @@ -112,7 +112,7 @@ static void *dhx_newdata(void *provctx) { DH *dh = NULL; - dh = dh_new_ex(PROV_LIBCTX_OF(provctx)); + dh = ossl_dh_new_ex(PROV_LIBCTX_OF(provctx)); if (dh != NULL) { DH_clear_flags(dh, DH_FLAG_TYPE_MASK); DH_set_flags(dh, DH_FLAG_TYPE_DHX); @@ -158,8 +158,8 @@ static int dh_match(const void *keydata1, const void *keydata2, int selection) if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) ok = ok && BN_cmp(DH_get0_priv_key(dh1), DH_get0_priv_key(dh2)) == 0; if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) { - FFC_PARAMS *dhparams1 = dh_get0_params((DH *)dh1); - FFC_PARAMS *dhparams2 = dh_get0_params((DH *)dh2); + FFC_PARAMS *dhparams1 = ossl_dh_get0_params((DH *)dh1); + FFC_PARAMS *dhparams2 = ossl_dh_get0_params((DH *)dh2); ok = ok && ossl_ffc_params_cmp(dhparams1, dhparams2, 1); } @@ -178,10 +178,10 @@ static int dh_import(void *keydata, int selection, const OSSL_PARAM params[]) return 0; if ((selection & OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) != 0) - ok = ok && dh_params_fromdata(dh, params); + ok = ok && ossl_dh_params_fromdata(dh, params); if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) - ok = ok && dh_key_fromdata(dh, params); + ok = ok && ossl_dh_key_fromdata(dh, params); return ok; } @@ -202,9 +202,9 @@ static int dh_export(void *keydata, int selection, OSSL_CALLBACK *param_cb, return 0; if ((selection & OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) != 0) - ok = ok && dh_params_todata(dh, tmpl, NULL); + ok = ok && ossl_dh_params_todata(dh, tmpl, NULL); if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) != 0) - ok = ok && dh_key_todata(dh, tmpl, NULL); + ok = ok && ossl_dh_key_todata(dh, tmpl, NULL); if (!ok || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) { @@ -295,14 +295,14 @@ static ossl_inline int dh_get_params(void *key, OSSL_PARAM params[]) if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY)) != NULL) { if (p->data_type != OSSL_PARAM_OCTET_STRING) return 0; - p->return_size = dh_key2buf(dh, (unsigned char **)&p->data, - p->data_size, 0); + p->return_size = ossl_dh_key2buf(dh, (unsigned char **)&p->data, + p->data_size, 0); if (p->return_size == 0) return 0; } - return dh_params_todata(dh, NULL, params) - && dh_key_todata(dh, NULL, params); + return ossl_dh_params_todata(dh, NULL, params) + && ossl_dh_key_todata(dh, NULL, params); } static const OSSL_PARAM dh_params[] = { @@ -339,7 +339,7 @@ static int dh_set_params(void *key, const OSSL_PARAM params[]) p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY); if (p != NULL && (p->data_type != OSSL_PARAM_OCTET_STRING - || !dh_buf2key(dh, p->data, p->data_size))) + || !ossl_dh_buf2key(dh, p->data, p->data_size))) return 0; return 1; @@ -357,7 +357,7 @@ static int dh_validate_public(const DH *dh, int checktype) /* The partial test is only valid for named group's with q = (p - 1) / 2 */ if (checktype == OSSL_KEYMGMT_VALIDATE_QUICK_CHECK && ossl_dh_is_named_safe_prime_group(dh)) - return dh_check_pub_key_partial(dh, pub_key, &res); + return ossl_dh_check_pub_key_partial(dh, pub_key, &res); return DH_check_pub_key(dh, pub_key, &res); } @@ -370,7 +370,7 @@ static int dh_validate_private(const DH *dh) DH_get0_key(dh, NULL, &priv_key); if (priv_key == NULL) return 0; - return dh_check_priv_key(dh, priv_key, &status);; + return ossl_dh_check_priv_key(dh, priv_key, &status);; } static int dh_validate(const void *keydata, int selection, int checktype) @@ -404,7 +404,7 @@ static int dh_validate(const void *keydata, int selection, int checktype) if ((selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == OSSL_KEYMGMT_SELECT_KEYPAIR) - ok = ok && dh_check_pairwise(dh); + ok = ok && ossl_dh_check_pairwise(dh); return ok; } @@ -461,7 +461,7 @@ static int dh_gen_set_template(void *genctx, void *templ) if (!ossl_prov_is_running() || gctx == NULL || dh == NULL) return 0; - gctx->ffc_params = dh_get0_params(dh); + gctx->ffc_params = ossl_dh_get0_params(dh); return 1; } @@ -492,8 +492,7 @@ static int dh_gen_set_params(void *genctx, const OSSL_PARAM params[]) if (p != NULL) { if (p->data_type != OSSL_PARAM_UTF8_STRING || ((gctx->gen_type = - dh_gen_type_name2id_w_default(p->data, - gctx->dh_type)) == -1)) { + dh_gen_type_name2id_w_default(p->data, gctx->dh_type)) == -1)) { ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT); return 0; } @@ -606,18 +605,18 @@ static void *dh_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) && gctx->ffc_params == NULL) { /* Select a named group if there is not one already */ if (gctx->group_nid == NID_undef) - gctx->group_nid = dh_get_named_group_uid_from_size(gctx->pbits); + gctx->group_nid = ossl_dh_get_named_group_uid_from_size(gctx->pbits); if (gctx->group_nid == NID_undef) return NULL; - dh = dh_new_by_nid_ex(gctx->libctx, gctx->group_nid); + dh = ossl_dh_new_by_nid_ex(gctx->libctx, gctx->group_nid); if (dh == NULL) return NULL; - ffc = dh_get0_params(dh); + ffc = ossl_dh_get0_params(dh); } else { - dh = dh_new_ex(gctx->libctx); + dh = ossl_dh_new_ex(gctx->libctx); if (dh == NULL) return NULL; - ffc = dh_get0_params(dh); + ffc = ossl_dh_get0_params(dh); /* Copy the template value if one was passed */ if (gctx->ffc_params != NULL @@ -653,8 +652,9 @@ static void *dh_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) ret = DH_generate_parameters_ex(dh, gctx->pbits, gctx->generator, gencb); else - ret = dh_generate_ffc_parameters(dh, gctx->gen_type, gctx->pbits, - gctx->qbits, gencb); + ret = ossl_dh_generate_ffc_parameters(dh, gctx->gen_type, + gctx->pbits, gctx->qbits, + gencb); if (ret <= 0) goto end; } |