Lines Matching refs:dh

31 static int dh_ffc_params_fromdata(DH *dh, const OSSL_PARAM params[])  in dh_ffc_params_fromdata()  argument
34 FFC_PARAMS *ffc = ossl_dh_get0_params(dh); in dh_ffc_params_fromdata()
38 ossl_dh_cache_named_group(dh); /* This increments dh->dirty_cnt */ in dh_ffc_params_fromdata()
42 int ossl_dh_params_fromdata(DH *dh, const OSSL_PARAM params[]) in ossl_dh_params_fromdata() argument
47 if (!dh_ffc_params_fromdata(dh, params)) in ossl_dh_params_fromdata()
54 || !DH_set_length(dh, priv_len))) in ossl_dh_params_fromdata()
60 int ossl_dh_key_fromdata(DH *dh, const OSSL_PARAM params[], int include_private) in ossl_dh_key_fromdata() argument
65 if (dh == NULL) in ossl_dh_key_fromdata()
80 if (!DH_set0_key(dh, pub_key, priv_key)) in ossl_dh_key_fromdata()
91 int ossl_dh_params_todata(DH *dh, OSSL_PARAM_BLD *bld, OSSL_PARAM params[]) in ossl_dh_params_todata() argument
93 long l = DH_get_length(dh); in ossl_dh_params_todata()
95 if (!ossl_ffc_params_todata(ossl_dh_get0_params(dh), bld, params)) in ossl_dh_params_todata()
103 int ossl_dh_key_todata(DH *dh, OSSL_PARAM_BLD *bld, OSSL_PARAM params[], in ossl_dh_key_todata() argument
108 if (dh == NULL) in ossl_dh_key_todata()
111 DH_get0_key(dh, &pub, &priv); in ossl_dh_key_todata()
123 int ossl_dh_is_foreign(const DH *dh) in ossl_dh_is_foreign() argument
126 if (dh->engine != NULL || ossl_dh_get_method(dh) != DH_OpenSSL()) in ossl_dh_is_foreign()
139 DH *ossl_dh_dup(const DH *dh, int selection) in ossl_dh_dup() argument
144 if (ossl_dh_is_foreign(dh)) in ossl_dh_dup()
147 if ((dupkey = ossl_dh_new_ex(dh->libctx)) == NULL) in ossl_dh_dup()
150 dupkey->length = DH_get_length(dh); in ossl_dh_dup()
152 && !ossl_ffc_params_copy(&dupkey->params, &dh->params)) in ossl_dh_dup()
155 dupkey->flags = dh->flags; in ossl_dh_dup()
159 || !dh_bn_dup_check(&dupkey->pub_key, dh->pub_key))) in ossl_dh_dup()
164 || !dh_bn_dup_check(&dupkey->priv_key, dh->priv_key))) in ossl_dh_dup()
169 &dupkey->ex_data, &dh->ex_data)) in ossl_dh_dup()
192 DH *dh = NULL; in ossl_dh_key_from_pkcs8() local
209 dh = d2i_DHparams(NULL, &pm, pmlen); in ossl_dh_key_from_pkcs8()
212 dh = d2i_DHxparams(NULL, &pm, pmlen); in ossl_dh_key_from_pkcs8()
217 if (dh == NULL) in ossl_dh_key_from_pkcs8()
227 if (!DH_set0_key(dh, NULL, privkey_bn)) in ossl_dh_key_from_pkcs8()
230 if (!DH_generate_key(dh)) in ossl_dh_key_from_pkcs8()
238 DH_free(dh); in ossl_dh_key_from_pkcs8()
239 dh = NULL; in ossl_dh_key_from_pkcs8()
242 return dh; in ossl_dh_key_from_pkcs8()