Lines Matching refs:pkey
34 static DH *d2i_dhp(const EVP_PKEY *pkey, const unsigned char **pp,
38 int is_dhx = (pkey->ameth == &ossl_dhx_asn1_meth);
48 static int i2d_dhp(const EVP_PKEY *pkey, const DH *a, unsigned char **pp)
50 if (pkey->ameth == &ossl_dhx_asn1_meth)
55 static void int_dh_free(EVP_PKEY *pkey)
57 DH_free(pkey->pkey.dh);
60 static int dh_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey)
85 if ((dh = d2i_dhp(pkey, &pm, pmlen)) == NULL) {
102 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
111 static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
120 dh = pkey->pkey.dh;
127 str->length = i2d_dhp(pkey, dh, &str->data);
147 if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id),
164 static int dh_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
171 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
177 static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
191 params->length = i2d_dhp(pkey, pkey->pkey.dh, ¶ms->data);
199 prkey = BN_to_ASN1_INTEGER(pkey->pkey.dh->priv_key, NULL);
215 if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0,
227 static int dh_param_decode(EVP_PKEY *pkey,
232 if ((dh = d2i_dhp(pkey, pder, derlen)) == NULL)
235 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, dh);
239 static int dh_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
241 return i2d_dhp(pkey, pkey->pkey.dh, pder);
300 static int int_dh_size(const EVP_PKEY *pkey)
302 return DH_size(pkey->pkey.dh);
305 static int dh_bits(const EVP_PKEY *pkey)
307 return DH_bits(pkey->pkey.dh);
310 static int dh_security_bits(const EVP_PKEY *pkey)
312 return DH_security_bits(pkey->pkey.dh);
317 return ossl_ffc_params_cmp(&a->pkey.dh->params, &b->pkey.dh->params,
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)
374 static int dh_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
377 return do_dh_print(bp, pkey->pkey.dh, indent, 0);
380 static int dh_public_print(BIO *bp, const EVP_PKEY *pkey, int indent,
383 return do_dh_print(bp, pkey->pkey.dh, indent, 1);
386 static int dh_private_print(BIO *bp, const EVP_PKEY *pkey, int indent,
389 return do_dh_print(bp, pkey->pkey.dh, indent, 2);
397 static int dh_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
403 if (!ossl_assert(evp_pkey_is_legacy(pkey)))
405 dh = (DH *) evp_pkey_get0_DH_int(pkey);
410 dh = (DH *) EVP_PKEY_get0_DH(pkey);
419 static int dhx_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
428 static int dh_pkey_public_check(const EVP_PKEY *pkey)
430 DH *dh = pkey->pkey.dh;
440 static int dh_pkey_param_check(const EVP_PKEY *pkey)
442 DH *dh = pkey->pkey.dh;
447 static size_t dh_pkey_dirty_cnt(const EVP_PKEY *pkey)
449 return pkey->pkey.dh->dirty_cnt;
456 DH *dh = from->pkey.dh;
513 EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx);
525 || !EVP_PKEY_assign(pkey, type, dh)) {
544 DH *dh = from->pkey.dh;