#ifndef OSSL_CRYPTO_RSA_LOCAL_H
#define OSSL_CRYPTO_RSA_LOCAL_H
-#include <openssl/rsa.h>
+#include "crypto/rsa.h"
#include "internal/refcount.h"
+#include "crypto/rsa.h"
#define RSA_MAX_PRIME_NUM 5
#define RSA_MIN_MODULUS_BITS 512
DECLARE_ASN1_ITEM(RSA_PRIME_INFO)
DEFINE_STACK_OF(RSA_PRIME_INFO)
+#if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
+struct rsa_acvp_test_st {
+ /* optional inputs */
+ BIGNUM *Xp1;
+ BIGNUM *Xp2;
+ BIGNUM *Xq1;
+ BIGNUM *Xq2;
+ BIGNUM *Xp;
+ BIGNUM *Xq;
+
+ /* optional outputs */
+ BIGNUM *p1;
+ BIGNUM *p2;
+ BIGNUM *q1;
+ BIGNUM *q2;
+};
+#endif
+
struct rsa_st {
/*
* #legacy
BIGNUM *dmp1;
BIGNUM *dmq1;
BIGNUM *iqmp;
- /* If a PSS only key this contains the parameter restrictions */
- RSA_PSS_PARAMS *pss;
+
+ /*
+ * If a PSS only key this contains the parameter restrictions.
+ * There are two structures for the same thing, used in different cases.
+ */
+ /* This is used uniquely by OpenSSL provider implementations. */
+ RSA_PSS_PARAMS_30 pss_params;
+
+#if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
+ RSA_ACVP_TEST *acvp_test;
+#endif
+
#ifndef FIPS_MODULE
+ /* This is used uniquely by rsa_ameth.c and rsa_pmeth.c. */
+ RSA_PSS_PARAMS *pss;
/* for multi-prime RSA, defined in RFC 8017 */
STACK_OF(RSA_PRIME_INFO) *prime_infos;
/* Be careful using this if the RSA structure is shared */
int rsa_multip_calc_product(RSA *rsa);
int rsa_multip_cap(int bits);
-int rsa_sp800_56b_validate_strength(int nbits, int strength);
-int rsa_check_pminusq_diff(BIGNUM *diff, const BIGNUM *p, const BIGNUM *q,
- int nbits);
-int rsa_get_lcm(BN_CTX *ctx, const BIGNUM *p, const BIGNUM *q,
- BIGNUM *lcm, BIGNUM *gcd, BIGNUM *p1, BIGNUM *q1,
- BIGNUM *p1q1);
-
-int rsa_check_public_exponent(const BIGNUM *e);
-int rsa_check_private_exponent(const RSA *rsa, int nbits, BN_CTX *ctx);
-int rsa_check_prime_factor(BIGNUM *p, BIGNUM *e, int nbits, BN_CTX *ctx);
-int rsa_check_prime_factor_range(const BIGNUM *p, int nbits, BN_CTX *ctx);
-int rsa_check_crt_components(const RSA *rsa, BN_CTX *ctx);
-
-int rsa_sp800_56b_pairwise_test(RSA *rsa, BN_CTX *ctx);
-int rsa_sp800_56b_check_public(const RSA *rsa);
-int rsa_sp800_56b_check_private(const RSA *rsa);
-int rsa_sp800_56b_check_keypair(const RSA *rsa, const BIGNUM *efixed,
- int strength, int nbits);
-int rsa_sp800_56b_generate_key(RSA *rsa, int nbits, const BIGNUM *efixed,
- BN_GENCB *cb);
-
-int rsa_sp800_56b_derive_params_from_pq(RSA *rsa, int nbits,
- const BIGNUM *e, BN_CTX *ctx);
-int rsa_fips186_4_gen_prob_primes(RSA *rsa, BIGNUM *p1, BIGNUM *p2,
- BIGNUM *Xpout, const BIGNUM *Xp,
- const BIGNUM *Xp1, const BIGNUM *Xp2,
- BIGNUM *q1, BIGNUM *q2, BIGNUM *Xqout,
- const BIGNUM *Xq, const BIGNUM *Xq1,
- const BIGNUM *Xq2, int nbits,
- const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);
-
-int rsa_padding_add_SSLv23_with_libctx(OPENSSL_CTX *libctx, unsigned char *to,
- int tlen, const unsigned char *from,
- int flen);
-int rsa_padding_add_PKCS1_type_2_with_libctx(OPENSSL_CTX *libctx,
- unsigned char *to, int tlen,
- const unsigned char *from,
- int flen);
-int rsa_padding_add_PKCS1_OAEP_mgf1_with_libctx(OPENSSL_CTX *libctx,
- unsigned char *to, int tlen,
- const unsigned char *from,
- int flen,
- const unsigned char *param,
- int plen, const EVP_MD *md,
- const EVP_MD *mgf1md);
+int ossl_rsa_sp800_56b_validate_strength(int nbits, int strength);
+int ossl_rsa_check_pminusq_diff(BIGNUM *diff, const BIGNUM *p, const BIGNUM *q,
+ int nbits);
+int ossl_rsa_get_lcm(BN_CTX *ctx, const BIGNUM *p, const BIGNUM *q,
+ BIGNUM *lcm, BIGNUM *gcd, BIGNUM *p1, BIGNUM *q1,
+ BIGNUM *p1q1);
+
+int ossl_rsa_check_public_exponent(const BIGNUM *e);
+int ossl_rsa_check_private_exponent(const RSA *rsa, int nbits, BN_CTX *ctx);
+int ossl_rsa_check_prime_factor(BIGNUM *p, BIGNUM *e, int nbits, BN_CTX *ctx);
+int ossl_rsa_check_prime_factor_range(const BIGNUM *p, int nbits, BN_CTX *ctx);
+int ossl_rsa_check_crt_components(const RSA *rsa, BN_CTX *ctx);
+
+int ossl_rsa_sp800_56b_pairwise_test(RSA *rsa, BN_CTX *ctx);
+int ossl_rsa_sp800_56b_check_public(const RSA *rsa);
+int ossl_rsa_sp800_56b_check_private(const RSA *rsa);
+int ossl_rsa_sp800_56b_check_keypair(const RSA *rsa, const BIGNUM *efixed,
+ int strength, int nbits);
+int ossl_rsa_sp800_56b_generate_key(RSA *rsa, int nbits, const BIGNUM *efixed,
+ BN_GENCB *cb);
+
+int ossl_rsa_sp800_56b_derive_params_from_pq(RSA *rsa, int nbits,
+ const BIGNUM *e, BN_CTX *ctx);
+int ossl_rsa_fips186_4_gen_prob_primes(RSA *rsa, RSA_ACVP_TEST *test,
+ int nbits, const BIGNUM *e, BN_CTX *ctx,
+ BN_GENCB *cb);
+
+int ossl_rsa_padding_add_SSLv23_ex(OPENSSL_CTX *libctx, unsigned char *to,
+ int tlen, const unsigned char *from,
+ int flen);
+int ossl_rsa_padding_add_PKCS1_type_2_ex(OPENSSL_CTX *libctx, unsigned char *to,
+ int tlen, const unsigned char *from,
+ int flen);
#endif /* OSSL_CRYPTO_RSA_LOCAL_H */