Lines Matching refs:dh

25 #include "crypto/dh.h"
37 DH *dh = NULL;
41 dh = d2i_DHxparams(NULL, pp, length);
43 dh = d2i_DHparams(NULL, pp, length);
45 return dh;
57 DH_free(pkey->pkey.dh);
70 DH *dh = NULL;
85 if ((dh = d2i_dhp(pkey, &pm, pmlen)) == NULL) {
96 if ((dh->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) {
102 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
107 DH_free(dh);
113 DH *dh;
120 dh = pkey->pkey.dh;
127 str->length = i2d_dhp(pkey, dh, &str->data);
134 pub_key = BN_to_ASN1_INTEGER(dh->pub_key, NULL);
167 DH *dh = ossl_dh_key_from_pkcs8(p8, NULL, NULL);
169 if (dh != NULL) {
171 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
191 params->length = i2d_dhp(pkey, pkey->pkey.dh, &params->data);
199 prkey = BN_to_ASN1_INTEGER(pkey->pkey.dh->priv_key, NULL);
230 DH *dh;
232 if ((dh = d2i_dhp(pkey, pder, derlen)) == NULL)
234 dh->dirty_cnt++;
235 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
241 return i2d_dhp(pkey, pkey->pkey.dh, pder);
302 return DH_size(pkey->pkey.dh);
307 return DH_bits(pkey->pkey.dh);
312 return DH_security_bits(pkey->pkey.dh);
317 return ossl_ffc_params_cmp(&a->pkey.dh->params, &b->pkey.dh->params,
333 DH *DHparams_dup(const DH *dh)
339 if (!int_dh_param_copy(ret, dh, -1)) {
348 if (to->pkey.dh == NULL) {
349 to->pkey.dh = DH_new();
350 if (to->pkey.dh == NULL)
353 return int_dh_param_copy(to->pkey.dh, from->pkey.dh,
359 return a->pkey.dh == NULL
360 || a->pkey.dh->params.p == NULL
361 || a->pkey.dh->params.g == NULL;
368 if (BN_cmp(b->pkey.dh->pub_key, a->pkey.dh->pub_key) != 0)
377 return do_dh_print(bp, pkey->pkey.dh, indent, 0);
383 return do_dh_print(bp, pkey->pkey.dh, indent, 1);
389 return do_dh_print(bp, pkey->pkey.dh, indent, 2);
399 DH *dh;
405 dh = (DH *) evp_pkey_get0_DH_int(pkey);
406 if (dh == NULL)
408 return ossl_dh_buf2key(dh, arg2, arg1);
410 dh = (DH *) EVP_PKEY_get0_DH(pkey);
411 if (dh == NULL)
413 return ossl_dh_key2buf(dh, arg2, 0, 1);
430 DH *dh = pkey->pkey.dh;
432 if (dh->pub_key == NULL) {
437 return DH_check_pub_key_ex(dh, dh->pub_key);
442 DH *dh = pkey->pkey.dh;
444 return DH_check_ex(dh);
449 return pkey->pkey.dh->dirty_cnt;
456 DH *dh = from->pkey.dh;
458 const BIGNUM *p = DH_get0_p(dh), *g = DH_get0_g(dh), *q = DH_get0_q(dh);
459 long l = DH_get_length(dh);
460 const BIGNUM *pub_key = DH_get0_pub_key(dh);
461 const BIGNUM *priv_key = DH_get0_priv_key(dh);
514 DH *dh = ossl_dh_new_ex(pctx->libctx);
516 if (dh == NULL) {
520 DH_clear_flags(dh, DH_FLAG_TYPE_MASK);
521 DH_set_flags(dh, type == EVP_PKEY_DH ? DH_FLAG_TYPE_DH : DH_FLAG_TYPE_DHX);
523 if (!ossl_dh_params_fromdata(dh, params)
524 || !ossl_dh_key_fromdata(dh, params, 1)
525 || !EVP_PKEY_assign(pkey, type, dh)) {
526 DH_free(dh);
544 DH *dh = from->pkey.dh;
548 if (dh != NULL) {
549 dupkey = ossl_dh_dup(dh, OSSL_KEYMGMT_SELECT_ALL);