Lines Matching refs:pkey
29 static int rsa_param_encode(const EVP_PKEY *pkey, in rsa_param_encode() argument
32 const RSA *rsa = pkey->pkey.rsa; in rsa_param_encode()
53 static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) in rsa_pub_encode() argument
60 if (!rsa_param_encode(pkey, &str, &strtype)) in rsa_pub_encode()
62 penclen = i2d_RSAPublicKey(pkey->pkey.rsa, &penc); in rsa_pub_encode()
65 if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id), in rsa_pub_encode()
73 static int rsa_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey) in rsa_pub_decode() argument
90 switch (pkey->ameth->pkey_id) { in rsa_pub_decode()
102 if (!EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa)) { in rsa_pub_decode()
115 if (((RSA_flags(a->pkey.rsa) & RSA_METHOD_FLAG_NO_CHECK)) in rsa_pub_cmp()
116 || (RSA_flags(b->pkey.rsa) & RSA_METHOD_FLAG_NO_CHECK)) { in rsa_pub_cmp()
120 if (BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) != 0 in rsa_pub_cmp()
121 || BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) != 0) in rsa_pub_cmp()
126 static int old_rsa_priv_decode(EVP_PKEY *pkey, in old_rsa_priv_decode() argument
133 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa); in old_rsa_priv_decode()
137 static int old_rsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder) in old_rsa_priv_encode() argument
139 return i2d_RSAPrivateKey(pkey->pkey.rsa, pder); in old_rsa_priv_encode()
142 static int rsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) in rsa_priv_encode() argument
149 if (!rsa_param_encode(pkey, &str, &strtype)) in rsa_priv_encode()
151 rklen = i2d_RSAPrivateKey(pkey->pkey.rsa, &rk); in rsa_priv_encode()
159 if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0, in rsa_priv_encode()
170 static int rsa_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8) in rsa_priv_decode() argument
177 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa); in rsa_priv_decode()
182 static int int_rsa_size(const EVP_PKEY *pkey) in int_rsa_size() argument
184 return RSA_size(pkey->pkey.rsa); in int_rsa_size()
187 static int rsa_bits(const EVP_PKEY *pkey) in rsa_bits() argument
189 return BN_num_bits(pkey->pkey.rsa->n); in rsa_bits()
192 static int rsa_security_bits(const EVP_PKEY *pkey) in rsa_security_bits() argument
194 return RSA_security_bits(pkey->pkey.rsa); in rsa_security_bits()
197 static void int_rsa_free(EVP_PKEY *pkey) in int_rsa_free() argument
199 RSA_free(pkey->pkey.rsa); in int_rsa_free()
297 static int pkey_rsa_print(BIO *bp, const EVP_PKEY *pkey, int off, int priv) in pkey_rsa_print() argument
299 const RSA *x = pkey->pkey.rsa; in pkey_rsa_print()
311 if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ? "RSA-PSS" : "RSA") <= 0) in pkey_rsa_print()
379 if (pkey_is_pss(pkey) && !rsa_pss_param_print(bp, 1, x->pss, off)) in pkey_rsa_print()
386 static int rsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent, in rsa_pub_print() argument
389 return pkey_rsa_print(bp, pkey, indent, 0); in rsa_pub_print()
392 static int rsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent, in rsa_priv_print() argument
395 return pkey_rsa_print(bp, pkey, indent, 1); in rsa_priv_print()
417 static int rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) in rsa_pkey_ctrl() argument
425 if (pkey->pkey.rsa->pss != NULL) { in rsa_pkey_ctrl()
426 if (!ossl_rsa_pss_get_param(pkey->pkey.rsa->pss, &md, &mgf1md, in rsa_pkey_ctrl()
521 const X509_ALGOR *sigalg, EVP_PKEY *pkey) in ossl_rsa_pss_to_ctx() argument
542 if (pkey) { in ossl_rsa_pss_to_ctx()
543 if (!EVP_DigestVerifyInit(ctx, &pkctx, md, NULL, pkey)) in ossl_rsa_pss_to_ctx()
614 const ASN1_BIT_STRING *sig, EVP_PKEY *pkey) in rsa_item_verify() argument
621 if (ossl_rsa_pss_to_ctx(ctx, NULL, sigalg, pkey) > 0) { in rsa_item_verify()
723 static int rsa_pkey_check(const EVP_PKEY *pkey) in rsa_pkey_check() argument
725 return RSA_check_key_ex(pkey->pkey.rsa, NULL); in rsa_pkey_check()
728 static size_t rsa_pkey_dirty_cnt(const EVP_PKEY *pkey) in rsa_pkey_dirty_cnt() argument
730 return pkey->pkey.rsa->dirty_cnt; in rsa_pkey_dirty_cnt()
742 RSA *rsa = from->pkey.rsa; in rsa_int_export_to()
797 EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx); in rsa_int_import_from() local
852 ok = EVP_PKEY_assign_RSA(pkey, rsa); in rsa_int_import_from()
855 ok = EVP_PKEY_assign(pkey, EVP_PKEY_RSA_PSS, rsa); in rsa_int_import_from()
893 RSA *rsa = from->pkey.rsa; in rsa_pkey_copy()