Lines Matching refs:pkey

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