Lines Matching refs:dh
22 #include "crypto/dh.h"
31 static int dh_ffc_params_fromdata(DH *dh, const OSSL_PARAM params[])
36 if (dh == NULL)
38 ffc = ossl_dh_get0_params(dh);
44 ossl_dh_cache_named_group(dh); /* This increments dh->dirty_cnt */
48 int ossl_dh_params_fromdata(DH *dh, const OSSL_PARAM params[])
53 if (!dh_ffc_params_fromdata(dh, params))
60 || !DH_set_length(dh, priv_len)))
66 int ossl_dh_key_fromdata(DH *dh, const OSSL_PARAM params[], int include_private)
71 if (dh == NULL)
86 if (!DH_set0_key(dh, pub_key, priv_key))
97 int ossl_dh_params_todata(DH *dh, OSSL_PARAM_BLD *bld, OSSL_PARAM params[])
99 long l = DH_get_length(dh);
101 if (!ossl_ffc_params_todata(ossl_dh_get0_params(dh), bld, params))
109 int ossl_dh_key_todata(DH *dh, OSSL_PARAM_BLD *bld, OSSL_PARAM params[],
114 if (dh == NULL)
117 DH_get0_key(dh, &pub, &priv);
129 int ossl_dh_is_foreign(const DH *dh)
132 if (dh->engine != NULL || ossl_dh_get_method(dh) != DH_OpenSSL())
145 DH *ossl_dh_dup(const DH *dh, int selection)
150 if (ossl_dh_is_foreign(dh))
153 if ((dupkey = ossl_dh_new_ex(dh->libctx)) == NULL)
156 dupkey->length = DH_get_length(dh);
158 && !ossl_ffc_params_copy(&dupkey->params, &dh->params))
161 dupkey->flags = dh->flags;
165 || !dh_bn_dup_check(&dupkey->pub_key, dh->pub_key)))
170 || !dh_bn_dup_check(&dupkey->priv_key, dh->priv_key)))
175 &dupkey->ex_data, &dh->ex_data))
198 DH *dh = NULL;
215 dh = d2i_DHparams(NULL, &pm, pmlen);
218 dh = d2i_DHxparams(NULL, &pm, pmlen);
223 if (dh == NULL)
233 if (!DH_set0_key(dh, NULL, privkey_bn))
236 if (!DH_generate_key(dh))
244 DH_free(dh);
245 dh = NULL;
248 return dh;