Lines Matching refs:rsa
64 int ossl_rsa_fromdata(RSA *rsa, const OSSL_PARAM params[], int include_private) in ossl_rsa_fromdata() argument
75 if (rsa == NULL) in ossl_rsa_fromdata()
102 ctx = BN_CTX_new_ex(rsa->libctx); in ossl_rsa_fromdata()
120 if (!RSA_set0_key(rsa, n, e, d)) in ossl_rsa_fromdata()
157 if (!RSA_set0_factors(rsa, sk_BIGNUM_value(factors, 0), in ossl_rsa_fromdata()
175 if (!ossl_rsa_sp800_56b_derive_params_from_pq(rsa, in ossl_rsa_fromdata()
176 RSA_bits(rsa), in ossl_rsa_fromdata()
187 if (!ossl_rsa_multiprime_derive(rsa, RSA_bits(rsa), in ossl_rsa_fromdata()
189 rsa->e, factors, exps, in ossl_rsa_fromdata()
199 if (!ossl_rsa_set0_all_params(rsa, factors, exps, coeffs)) { in ossl_rsa_fromdata()
217 && !ossl_rsa_set0_all_params(rsa, factors, exps, coeffs)) in ossl_rsa_fromdata()
232 if (!ossl_rsa_check_factors(rsa)) { in ossl_rsa_fromdata()
259 int ossl_rsa_todata(RSA *rsa, OSSL_PARAM_BLD *bld, OSSL_PARAM params[], in DEFINE_SPECIAL_STACK_OF_CONST()
268 if (rsa == NULL || factors == NULL || exps == NULL || coeffs == NULL) in DEFINE_SPECIAL_STACK_OF_CONST()
271 RSA_get0_key(rsa, &rsa_n, &rsa_e, &rsa_d); in DEFINE_SPECIAL_STACK_OF_CONST()
272 ossl_rsa_get0_all_params(rsa, factors, exps, coeffs); in DEFINE_SPECIAL_STACK_OF_CONST()
297 ossl_rsa_acvp_test_get_params(rsa, params); in DEFINE_SPECIAL_STACK_OF_CONST()
455 int ossl_rsa_is_foreign(const RSA *rsa) in ossl_rsa_is_foreign() argument
458 if (rsa->engine != NULL || RSA_get_method(rsa) != RSA_PKCS1_OpenSSL()) in ossl_rsa_is_foreign()
471 RSA *ossl_rsa_dup(const RSA *rsa, int selection) in ossl_rsa_dup() argument
479 if (ossl_rsa_is_foreign(rsa)) in ossl_rsa_dup()
482 if ((dupkey = ossl_rsa_new_with_ctx(rsa->libctx)) == NULL) in ossl_rsa_dup()
487 if (!rsa_bn_dup_check(&dupkey->n, rsa->n)) in ossl_rsa_dup()
489 if (!rsa_bn_dup_check(&dupkey->e, rsa->e)) in ossl_rsa_dup()
496 if (!rsa_bn_dup_check(&dupkey->d, rsa->d)) in ossl_rsa_dup()
500 if (!rsa_bn_dup_check(&dupkey->p, rsa->p)) in ossl_rsa_dup()
502 if (!rsa_bn_dup_check(&dupkey->q, rsa->q)) in ossl_rsa_dup()
504 if (!rsa_bn_dup_check(&dupkey->dmp1, rsa->dmp1)) in ossl_rsa_dup()
506 if (!rsa_bn_dup_check(&dupkey->dmq1, rsa->dmq1)) in ossl_rsa_dup()
508 if (!rsa_bn_dup_check(&dupkey->iqmp, rsa->iqmp)) in ossl_rsa_dup()
512 dupkey->version = rsa->version; in ossl_rsa_dup()
513 dupkey->flags = rsa->flags; in ossl_rsa_dup()
515 dupkey->pss_params = rsa->pss_params; in ossl_rsa_dup()
520 && (pnum = sk_RSA_PRIME_INFO_num(rsa->prime_infos)) > 0) { in ossl_rsa_dup()
533 pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i); in ossl_rsa_dup()
545 if (rsa->pss != NULL) { in ossl_rsa_dup()
546 dupkey->pss = RSA_PSS_PARAMS_dup(rsa->pss); in ossl_rsa_dup()
547 if (rsa->pss->maskGenAlgorithm != NULL in ossl_rsa_dup()
549 dupkey->pss->maskHash = ossl_x509_algor_mgf1_decode(rsa->pss->maskGenAlgorithm); in ossl_rsa_dup()
555 &dupkey->ex_data, &rsa->ex_data)) in ossl_rsa_dup()
588 static int ossl_rsa_sync_to_pss_params_30(RSA *rsa) in ossl_rsa_sync_to_pss_params_30() argument
593 if (rsa != NULL in ossl_rsa_sync_to_pss_params_30()
594 && (legacy_pss = RSA_get0_pss_params(rsa)) != NULL in ossl_rsa_sync_to_pss_params_30()
595 && (pss = ossl_rsa_get0_pss_params_30(rsa)) != NULL) { in ossl_rsa_sync_to_pss_params_30()
656 int ossl_rsa_param_decode(RSA *rsa, const X509_ALGOR *alg) in ossl_rsa_param_decode() argument
673 || !ossl_rsa_set0_pss_params(rsa, pss)) { in ossl_rsa_param_decode()
677 if (!ossl_rsa_sync_to_pss_params_30(rsa)) in ossl_rsa_param_decode()
686 RSA *rsa; in ossl_rsa_key_from_pkcs8() local
692 rsa = d2i_RSAPrivateKey(NULL, &p, pklen); in ossl_rsa_key_from_pkcs8()
693 if (rsa == NULL) { in ossl_rsa_key_from_pkcs8()
697 if (!ossl_rsa_param_decode(rsa, alg)) { in ossl_rsa_key_from_pkcs8()
698 RSA_free(rsa); in ossl_rsa_key_from_pkcs8()
702 RSA_clear_flags(rsa, RSA_FLAG_TYPE_MASK); in ossl_rsa_key_from_pkcs8()
705 RSA_set_flags(rsa, RSA_FLAG_TYPE_RSA); in ossl_rsa_key_from_pkcs8()
708 RSA_set_flags(rsa, RSA_FLAG_TYPE_RSASSAPSS); in ossl_rsa_key_from_pkcs8()
715 return rsa; in ossl_rsa_key_from_pkcs8()