Lines Matching refs:dh

101     DH *dh = NULL;  in dh_newdata()  local
104 dh = ossl_dh_new_ex(PROV_LIBCTX_OF(provctx)); in dh_newdata()
105 if (dh != NULL) { in dh_newdata()
106 DH_clear_flags(dh, DH_FLAG_TYPE_MASK); in dh_newdata()
107 DH_set_flags(dh, DH_FLAG_TYPE_DH); in dh_newdata()
110 return dh; in dh_newdata()
115 DH *dh = NULL; in dhx_newdata() local
117 dh = ossl_dh_new_ex(PROV_LIBCTX_OF(provctx)); in dhx_newdata()
118 if (dh != NULL) { in dhx_newdata()
119 DH_clear_flags(dh, DH_FLAG_TYPE_MASK); in dhx_newdata()
120 DH_set_flags(dh, DH_FLAG_TYPE_DHX); in dhx_newdata()
122 return dh; in dhx_newdata()
132 const DH *dh = keydata; in dh_has() local
135 if (!ossl_prov_is_running() || dh == NULL) in dh_has()
141 ok = ok && (DH_get0_pub_key(dh) != NULL); in dh_has()
143 ok = ok && (DH_get0_priv_key(dh) != NULL); in dh_has()
145 ok = ok && (DH_get0_p(dh) != NULL && DH_get0_g(dh) != NULL); in dh_has()
193 DH *dh = keydata; in dh_import() local
196 if (!ossl_prov_is_running() || dh == NULL) in dh_import()
203 ok = ok && ossl_dh_params_fromdata(dh, params); in dh_import()
209 ok = ok && ossl_dh_key_fromdata(dh, params, include_private); in dh_import()
218 DH *dh = keydata; in dh_export() local
223 if (!ossl_prov_is_running() || dh == NULL) in dh_export()
234 ok = ok && ossl_dh_params_todata(dh, tmpl, NULL); in dh_export()
240 ok = ok && ossl_dh_key_todata(dh, tmpl, NULL, include_private); in dh_export()
317 DH *dh = key; in dh_get_params() local
321 && !OSSL_PARAM_set_int(p, DH_bits(dh))) in dh_get_params()
324 && !OSSL_PARAM_set_int(p, DH_security_bits(dh))) in dh_get_params()
327 && !OSSL_PARAM_set_int(p, DH_size(dh))) in dh_get_params()
332 p->return_size = ossl_dh_key2buf(dh, (unsigned char **)&p->data, in dh_get_params()
338 return ossl_dh_params_todata(dh, NULL, params) in dh_get_params()
339 && ossl_dh_key_todata(dh, NULL, params, 1); in dh_get_params()
370 DH *dh = key; in dh_set_params() local
376 || !ossl_dh_buf2key(dh, p->data, p->data_size))) in dh_set_params()
382 static int dh_validate_public(const DH *dh, int checktype) in dh_validate_public() argument
387 DH_get0_key(dh, &pub_key, NULL); in dh_validate_public()
395 if (ossl_dh_is_named_safe_prime_group(dh)) in dh_validate_public()
396 return ossl_dh_check_pub_key_partial(dh, pub_key, &res); in dh_validate_public()
398 return DH_check_pub_key_ex(dh, pub_key); in dh_validate_public()
401 static int dh_validate_private(const DH *dh) in dh_validate_private() argument
406 DH_get0_key(dh, NULL, &priv_key); in dh_validate_private()
409 return ossl_dh_check_priv_key(dh, priv_key, &status); in dh_validate_private()
414 const DH *dh = keydata; in dh_validate() local
430 ok = ok && DH_check_params_ex(dh); in dh_validate()
432 ok = ok && DH_check_ex(dh); in dh_validate()
436 ok = ok && dh_validate_public(dh, checktype); in dh_validate()
439 ok = ok && dh_validate_private(dh); in dh_validate()
443 ok = ok && ossl_dh_check_pairwise(dh); in dh_validate()
503 DH *dh = templ; in dh_gen_set_template() local
505 if (!ossl_prov_is_running() || gctx == NULL || dh == NULL) in dh_gen_set_template()
507 gctx->ffc_params = ossl_dh_get0_params(dh); in dh_gen_set_template()
700 DH *dh = NULL; in dh_gen() local
736 dh = ossl_dh_new_by_nid_ex(gctx->libctx, gctx->group_nid); in dh_gen()
737 if (dh == NULL) in dh_gen()
739 ffc = ossl_dh_get0_params(dh); in dh_gen()
741 dh = ossl_dh_new_ex(gctx->libctx); in dh_gen()
742 if (dh == NULL) in dh_gen()
744 ffc = ossl_dh_get0_params(dh); in dh_gen()
775 ret = DH_generate_parameters_ex(dh, gctx->pbits, in dh_gen()
778 ret = ossl_dh_generate_ffc_parameters(dh, gctx->gen_type, in dh_gen()
790 DH_set_length(dh, (long)gctx->priv_len); in dh_gen()
793 if (DH_generate_key(dh) <= 0) in dh_gen()
796 DH_clear_flags(dh, DH_FLAG_TYPE_MASK); in dh_gen()
797 DH_set_flags(dh, gctx->dh_type); in dh_gen()
802 DH_free(dh); in dh_gen()
803 dh = NULL; in dh_gen()
806 return dh; in dh_gen()
824 DH *dh = NULL; in dh_load() local
826 if (ossl_prov_is_running() && reference_sz == sizeof(dh)) { in dh_load()
828 dh = *(DH **)reference; in dh_load()
831 return dh; in dh_load()