summaryrefslogtreecommitdiffstats
path: root/providers/implementations/keymgmt/dh_kmgmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'providers/implementations/keymgmt/dh_kmgmt.c')
-rw-r--r--providers/implementations/keymgmt/dh_kmgmt.c54
1 files changed, 27 insertions, 27 deletions
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;
}