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()
67 if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id), in rsa_pub_encode()
76 static int rsa_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey) in rsa_pub_decode() argument
93 switch (pkey->ameth->pkey_id) { in rsa_pub_decode()
105 if (!EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa)) { in rsa_pub_decode()
118 if (((RSA_flags(a->pkey.rsa) & RSA_METHOD_FLAG_NO_CHECK)) in rsa_pub_cmp()
119 || (RSA_flags(b->pkey.rsa) & RSA_METHOD_FLAG_NO_CHECK)) { in rsa_pub_cmp()
123 if (BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) != 0 in rsa_pub_cmp()
124 || BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) != 0) in rsa_pub_cmp()
129 static int old_rsa_priv_decode(EVP_PKEY *pkey, in old_rsa_priv_decode() argument
136 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa); in old_rsa_priv_decode()
140 static int old_rsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder) in old_rsa_priv_encode() argument
142 return i2d_RSAPrivateKey(pkey->pkey.rsa, pder); in old_rsa_priv_encode()
145 static int rsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) in rsa_priv_encode() argument
152 if (!rsa_param_encode(pkey, &str, &strtype)) in rsa_priv_encode()
154 rklen = i2d_RSAPrivateKey(pkey->pkey.rsa, &rk); in rsa_priv_encode()
162 if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0, in rsa_priv_encode()
173 static int rsa_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8) in rsa_priv_decode() argument
180 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa); in rsa_priv_decode()
185 static int int_rsa_size(const EVP_PKEY *pkey) in int_rsa_size() argument
187 return RSA_size(pkey->pkey.rsa); in int_rsa_size()
190 static int rsa_bits(const EVP_PKEY *pkey) in rsa_bits() argument
192 return BN_num_bits(pkey->pkey.rsa->n); in rsa_bits()
195 static int rsa_security_bits(const EVP_PKEY *pkey) in rsa_security_bits() argument
197 return RSA_security_bits(pkey->pkey.rsa); in rsa_security_bits()
200 static void int_rsa_free(EVP_PKEY *pkey) in int_rsa_free() argument
202 RSA_free(pkey->pkey.rsa); in int_rsa_free()
300 static int pkey_rsa_print(BIO *bp, const EVP_PKEY *pkey, int off, int priv) in pkey_rsa_print() argument
302 const RSA *x = pkey->pkey.rsa; in pkey_rsa_print()
314 if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ? "RSA-PSS" : "RSA") <= 0) in pkey_rsa_print()
382 if (pkey_is_pss(pkey) && !rsa_pss_param_print(bp, 1, x->pss, off)) in pkey_rsa_print()
389 static int rsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent, in rsa_pub_print() argument
392 return pkey_rsa_print(bp, pkey, indent, 0); in rsa_pub_print()
395 static int rsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent, in rsa_priv_print() argument
398 return pkey_rsa_print(bp, pkey, indent, 1); in rsa_priv_print()
420 static int rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) in rsa_pkey_ctrl() argument
428 if (pkey->pkey.rsa->pss != NULL) { in rsa_pkey_ctrl()
429 if (!ossl_rsa_pss_get_param(pkey->pkey.rsa->pss, &md, &mgf1md, in rsa_pkey_ctrl()
542 const X509_ALGOR *sigalg, EVP_PKEY *pkey) in ossl_rsa_pss_to_ctx() argument
563 if (pkey) { in ossl_rsa_pss_to_ctx()
564 if (!EVP_DigestVerifyInit(ctx, &pkctx, md, NULL, pkey)) in ossl_rsa_pss_to_ctx()
635 const ASN1_BIT_STRING *sig, EVP_PKEY *pkey) in rsa_item_verify() argument
642 if (ossl_rsa_pss_to_ctx(ctx, NULL, sigalg, pkey) > 0) { in rsa_item_verify()
779 static int rsa_pkey_check(const EVP_PKEY *pkey) in rsa_pkey_check() argument
781 return RSA_check_key_ex(pkey->pkey.rsa, NULL); in rsa_pkey_check()
784 static size_t rsa_pkey_dirty_cnt(const EVP_PKEY *pkey) in rsa_pkey_dirty_cnt() argument
786 return pkey->pkey.rsa->dirty_cnt; in rsa_pkey_dirty_cnt()
798 RSA *rsa = from->pkey.rsa; in rsa_int_export_to()
853 EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx); in rsa_int_import_from() local
908 ok = EVP_PKEY_assign_RSA(pkey, rsa); in rsa_int_import_from()
911 ok = EVP_PKEY_assign(pkey, EVP_PKEY_RSA_PSS, rsa); in rsa_int_import_from()
949 RSA *rsa = from->pkey.rsa; in rsa_pkey_copy()