File indexing completed on 2025-01-18 10:05:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef OPENSSL_RSA_H
0011 # define OPENSSL_RSA_H
0012 # pragma once
0013
0014 # include <openssl/macros.h>
0015 # ifndef OPENSSL_NO_DEPRECATED_3_0
0016 # define HEADER_RSA_H
0017 # endif
0018
0019 # include <openssl/opensslconf.h>
0020
0021 # include <openssl/asn1.h>
0022 # include <openssl/bio.h>
0023 # include <openssl/crypto.h>
0024 # include <openssl/types.h>
0025 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
0026 # include <openssl/bn.h>
0027 # endif
0028 # include <openssl/rsaerr.h>
0029 # include <openssl/safestack.h>
0030 # ifndef OPENSSL_NO_STDIO
0031 # include <stdio.h>
0032 # endif
0033
0034 # ifdef __cplusplus
0035 extern "C" {
0036 # endif
0037
0038 # ifndef OPENSSL_RSA_MAX_MODULUS_BITS
0039 # define OPENSSL_RSA_MAX_MODULUS_BITS 16384
0040 # endif
0041
0042 # define RSA_3 0x3L
0043 # define RSA_F4 0x10001L
0044
0045 # ifndef OPENSSL_NO_DEPRECATED_3_0
0046
0047
0048 # define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 2048
0049
0050 # ifndef OPENSSL_RSA_SMALL_MODULUS_BITS
0051 # define OPENSSL_RSA_SMALL_MODULUS_BITS 3072
0052 # endif
0053
0054
0055 # ifndef OPENSSL_RSA_MAX_PUBEXP_BITS
0056 # define OPENSSL_RSA_MAX_PUBEXP_BITS 64
0057 # endif
0058
0059 # define RSA_ASN1_VERSION_DEFAULT 0
0060 # define RSA_ASN1_VERSION_MULTI 1
0061
0062 # define RSA_DEFAULT_PRIME_NUM 2
0063
0064 # define RSA_METHOD_FLAG_NO_CHECK 0x0001
0065 # define RSA_FLAG_CACHE_PUBLIC 0x0002
0066 # define RSA_FLAG_CACHE_PRIVATE 0x0004
0067 # define RSA_FLAG_BLINDING 0x0008
0068 # define RSA_FLAG_THREAD_SAFE 0x0010
0069
0070
0071
0072
0073
0074
0075 # define RSA_FLAG_EXT_PKEY 0x0020
0076
0077
0078
0079
0080
0081
0082
0083 # define RSA_FLAG_NO_BLINDING 0x0080
0084 # endif
0085
0086
0087
0088 # ifndef OPENSSL_NO_DEPRECATED_1_1_0
0089 # define RSA_FLAG_NO_CONSTTIME 0x0000
0090 # endif
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100 # ifndef OPENSSL_NO_DEPRECATED_0_9_8
0101 # define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME
0102 # endif
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117 # define RSA_FLAG_TYPE_MASK 0xF000
0118 # define RSA_FLAG_TYPE_RSA 0x0000
0119 # define RSA_FLAG_TYPE_RSASSAPSS 0x1000
0120 # define RSA_FLAG_TYPE_RSAESOAEP 0x2000
0121
0122 int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad_mode);
0123 int EVP_PKEY_CTX_get_rsa_padding(EVP_PKEY_CTX *ctx, int *pad_mode);
0124
0125 int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int saltlen);
0126 int EVP_PKEY_CTX_get_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int *saltlen);
0127
0128 int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int bits);
0129 int EVP_PKEY_CTX_set1_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);
0130 int EVP_PKEY_CTX_set_rsa_keygen_primes(EVP_PKEY_CTX *ctx, int primes);
0131 int EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(EVP_PKEY_CTX *ctx, int saltlen);
0132 # ifndef OPENSSL_NO_DEPRECATED_3_0
0133 OSSL_DEPRECATEDIN_3_0
0134 int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);
0135 # endif
0136
0137
0138 # define RSA_PSS_SALTLEN_DIGEST -1
0139
0140 # define RSA_PSS_SALTLEN_AUTO -2
0141
0142 # define RSA_PSS_SALTLEN_MAX -3
0143
0144
0145 # define RSA_PSS_SALTLEN_AUTO_DIGEST_MAX -4
0146
0147 # define RSA_PSS_SALTLEN_MAX_SIGN -2
0148
0149 int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
0150 int EVP_PKEY_CTX_set_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, const char *mdname,
0151 const char *mdprops);
0152 int EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
0153 int EVP_PKEY_CTX_get_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, char *name,
0154 size_t namelen);
0155 int EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
0156 int EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name(EVP_PKEY_CTX *ctx,
0157 const char *mdname);
0158
0159 int EVP_PKEY_CTX_set_rsa_pss_keygen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
0160 int EVP_PKEY_CTX_set_rsa_pss_keygen_md_name(EVP_PKEY_CTX *ctx,
0161 const char *mdname,
0162 const char *mdprops);
0163
0164 int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
0165 int EVP_PKEY_CTX_set_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, const char *mdname,
0166 const char *mdprops);
0167 int EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
0168 int EVP_PKEY_CTX_get_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, char *name,
0169 size_t namelen);
0170 int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, void *label, int llen);
0171 int EVP_PKEY_CTX_get0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char **label);
0172
0173 # define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1)
0174 # define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2)
0175
0176 # define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3)
0177 # define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4)
0178 # define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5)
0179
0180 # define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6)
0181 # define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7)
0182 # define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8)
0183
0184 # define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9)
0185 # define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10)
0186
0187 # define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11)
0188 # define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12)
0189
0190 # define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13)
0191
0192 # define EVP_PKEY_CTRL_RSA_IMPLICIT_REJECTION (EVP_PKEY_ALG_CTRL + 14)
0193
0194 # define RSA_PKCS1_PADDING 1
0195 # define RSA_NO_PADDING 3
0196 # define RSA_PKCS1_OAEP_PADDING 4
0197 # define RSA_X931_PADDING 5
0198
0199
0200 # define RSA_PKCS1_PSS_PADDING 6
0201 # define RSA_PKCS1_WITH_TLS_PADDING 7
0202
0203
0204 # define RSA_PKCS1_NO_IMPLICIT_REJECT_PADDING 8
0205
0206 # define RSA_PKCS1_PADDING_SIZE 11
0207
0208 # define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg)
0209 # define RSA_get_app_data(s) RSA_get_ex_data(s,0)
0210
0211 # ifndef OPENSSL_NO_DEPRECATED_3_0
0212 OSSL_DEPRECATEDIN_3_0 RSA *RSA_new(void);
0213 OSSL_DEPRECATEDIN_3_0 RSA *RSA_new_method(ENGINE *engine);
0214 OSSL_DEPRECATEDIN_3_0 int RSA_bits(const RSA *rsa);
0215 OSSL_DEPRECATEDIN_3_0 int RSA_size(const RSA *rsa);
0216 OSSL_DEPRECATEDIN_3_0 int RSA_security_bits(const RSA *rsa);
0217
0218 OSSL_DEPRECATEDIN_3_0 int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
0219 OSSL_DEPRECATEDIN_3_0 int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
0220 OSSL_DEPRECATEDIN_3_0 int RSA_set0_crt_params(RSA *r,
0221 BIGNUM *dmp1, BIGNUM *dmq1,
0222 BIGNUM *iqmp);
0223 OSSL_DEPRECATEDIN_3_0 int RSA_set0_multi_prime_params(RSA *r,
0224 BIGNUM *primes[],
0225 BIGNUM *exps[],
0226 BIGNUM *coeffs[],
0227 int pnum);
0228 OSSL_DEPRECATEDIN_3_0 void RSA_get0_key(const RSA *r,
0229 const BIGNUM **n, const BIGNUM **e,
0230 const BIGNUM **d);
0231 OSSL_DEPRECATEDIN_3_0 void RSA_get0_factors(const RSA *r,
0232 const BIGNUM **p, const BIGNUM **q);
0233 OSSL_DEPRECATEDIN_3_0 int RSA_get_multi_prime_extra_count(const RSA *r);
0234 OSSL_DEPRECATEDIN_3_0 int RSA_get0_multi_prime_factors(const RSA *r,
0235 const BIGNUM *primes[]);
0236 OSSL_DEPRECATEDIN_3_0 void RSA_get0_crt_params(const RSA *r,
0237 const BIGNUM **dmp1,
0238 const BIGNUM **dmq1,
0239 const BIGNUM **iqmp);
0240 OSSL_DEPRECATEDIN_3_0
0241 int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[],
0242 const BIGNUM *coeffs[]);
0243 OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_n(const RSA *d);
0244 OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_e(const RSA *d);
0245 OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_d(const RSA *d);
0246 OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_p(const RSA *d);
0247 OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_q(const RSA *d);
0248 OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_dmp1(const RSA *r);
0249 OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_dmq1(const RSA *r);
0250 OSSL_DEPRECATEDIN_3_0 const BIGNUM *RSA_get0_iqmp(const RSA *r);
0251 OSSL_DEPRECATEDIN_3_0 const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r);
0252 OSSL_DEPRECATEDIN_3_0 void RSA_clear_flags(RSA *r, int flags);
0253 OSSL_DEPRECATEDIN_3_0 int RSA_test_flags(const RSA *r, int flags);
0254 OSSL_DEPRECATEDIN_3_0 void RSA_set_flags(RSA *r, int flags);
0255 OSSL_DEPRECATEDIN_3_0 int RSA_get_version(RSA *r);
0256 OSSL_DEPRECATEDIN_3_0 ENGINE *RSA_get0_engine(const RSA *r);
0257 # endif
0258
0259 # define EVP_RSA_gen(bits) \
0260 EVP_PKEY_Q_keygen(NULL, NULL, "RSA", (size_t)(0 + (bits)))
0261
0262
0263 # ifndef OPENSSL_NO_DEPRECATED_0_9_8
0264 OSSL_DEPRECATEDIN_0_9_8 RSA *RSA_generate_key(int bits, unsigned long e, void
0265 (*callback) (int, int, void *),
0266 void *cb_arg);
0267 # endif
0268
0269
0270 # ifndef OPENSSL_NO_DEPRECATED_3_0
0271 OSSL_DEPRECATEDIN_3_0 int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e,
0272 BN_GENCB *cb);
0273
0274 OSSL_DEPRECATEDIN_3_0 int RSA_generate_multi_prime_key(RSA *rsa, int bits,
0275 int primes, BIGNUM *e,
0276 BN_GENCB *cb);
0277
0278 OSSL_DEPRECATEDIN_3_0
0279 int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2,
0280 BIGNUM *q1, BIGNUM *q2,
0281 const BIGNUM *Xp1, const BIGNUM *Xp2,
0282 const BIGNUM *Xp, const BIGNUM *Xq1,
0283 const BIGNUM *Xq2, const BIGNUM *Xq,
0284 const BIGNUM *e, BN_GENCB *cb);
0285 OSSL_DEPRECATEDIN_3_0 int RSA_X931_generate_key_ex(RSA *rsa, int bits,
0286 const BIGNUM *e,
0287 BN_GENCB *cb);
0288
0289 OSSL_DEPRECATEDIN_3_0 int RSA_check_key(const RSA *);
0290 OSSL_DEPRECATEDIN_3_0 int RSA_check_key_ex(const RSA *, BN_GENCB *cb);
0291
0292 OSSL_DEPRECATEDIN_3_0
0293 int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
0294 RSA *rsa, int padding);
0295 OSSL_DEPRECATEDIN_3_0
0296 int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
0297 RSA *rsa, int padding);
0298 OSSL_DEPRECATEDIN_3_0
0299 int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to,
0300 RSA *rsa, int padding);
0301 OSSL_DEPRECATEDIN_3_0
0302 int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to,
0303 RSA *rsa, int padding);
0304 OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
0305
0306 OSSL_DEPRECATEDIN_3_0 int RSA_up_ref(RSA *r);
0307 OSSL_DEPRECATEDIN_3_0 int RSA_flags(const RSA *r);
0308
0309 OSSL_DEPRECATEDIN_3_0 void RSA_set_default_method(const RSA_METHOD *meth);
0310 OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *RSA_get_default_method(void);
0311 OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *RSA_null_method(void);
0312 OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *RSA_get_method(const RSA *rsa);
0313 OSSL_DEPRECATEDIN_3_0 int RSA_set_method(RSA *rsa, const RSA_METHOD *meth);
0314
0315
0316 OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *RSA_PKCS1_OpenSSL(void);
0317
0318 DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(OSSL_DEPRECATEDIN_3_0,
0319 RSA, RSAPublicKey)
0320 DECLARE_ASN1_ENCODE_FUNCTIONS_name_attr(OSSL_DEPRECATEDIN_3_0,
0321 RSA, RSAPrivateKey)
0322 # endif
0323
0324 int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2);
0325
0326 struct rsa_pss_params_st {
0327 X509_ALGOR *hashAlgorithm;
0328 X509_ALGOR *maskGenAlgorithm;
0329 ASN1_INTEGER *saltLength;
0330 ASN1_INTEGER *trailerField;
0331
0332 X509_ALGOR *maskHash;
0333 };
0334
0335 DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS)
0336 DECLARE_ASN1_DUP_FUNCTION(RSA_PSS_PARAMS)
0337
0338 typedef struct rsa_oaep_params_st {
0339 X509_ALGOR *hashFunc;
0340 X509_ALGOR *maskGenFunc;
0341 X509_ALGOR *pSourceFunc;
0342
0343 X509_ALGOR *maskHash;
0344 } RSA_OAEP_PARAMS;
0345
0346 DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS)
0347
0348 # ifndef OPENSSL_NO_DEPRECATED_3_0
0349 # ifndef OPENSSL_NO_STDIO
0350 OSSL_DEPRECATEDIN_3_0 int RSA_print_fp(FILE *fp, const RSA *r, int offset);
0351 # endif
0352
0353 OSSL_DEPRECATEDIN_3_0 int RSA_print(BIO *bp, const RSA *r, int offset);
0354
0355
0356
0357
0358
0359 OSSL_DEPRECATEDIN_3_0 int RSA_sign(int type, const unsigned char *m,
0360 unsigned int m_length, unsigned char *sigret,
0361 unsigned int *siglen, RSA *rsa);
0362 OSSL_DEPRECATEDIN_3_0 int RSA_verify(int type, const unsigned char *m,
0363 unsigned int m_length,
0364 const unsigned char *sigbuf,
0365 unsigned int siglen, RSA *rsa);
0366
0367
0368
0369
0370
0371 OSSL_DEPRECATEDIN_3_0
0372 int RSA_sign_ASN1_OCTET_STRING(int type,
0373 const unsigned char *m, unsigned int m_length,
0374 unsigned char *sigret, unsigned int *siglen,
0375 RSA *rsa);
0376 OSSL_DEPRECATEDIN_3_0
0377 int RSA_verify_ASN1_OCTET_STRING(int type,
0378 const unsigned char *m, unsigned int m_length,
0379 unsigned char *sigbuf, unsigned int siglen,
0380 RSA *rsa);
0381
0382 OSSL_DEPRECATEDIN_3_0 int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
0383 OSSL_DEPRECATEDIN_3_0 void RSA_blinding_off(RSA *rsa);
0384 OSSL_DEPRECATEDIN_3_0 BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);
0385
0386 OSSL_DEPRECATEDIN_3_0
0387 int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
0388 const unsigned char *f, int fl);
0389 OSSL_DEPRECATEDIN_3_0
0390 int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
0391 const unsigned char *f, int fl,
0392 int rsa_len);
0393 OSSL_DEPRECATEDIN_3_0
0394 int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
0395 const unsigned char *f, int fl);
0396 OSSL_DEPRECATEDIN_3_0
0397 int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
0398 const unsigned char *f, int fl,
0399 int rsa_len);
0400 OSSL_DEPRECATEDIN_3_0 int PKCS1_MGF1(unsigned char *mask, long len,
0401 const unsigned char *seed, long seedlen,
0402 const EVP_MD *dgst);
0403 OSSL_DEPRECATEDIN_3_0
0404 int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
0405 const unsigned char *f, int fl,
0406 const unsigned char *p, int pl);
0407 OSSL_DEPRECATEDIN_3_0
0408 int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
0409 const unsigned char *f, int fl, int rsa_len,
0410 const unsigned char *p, int pl);
0411 OSSL_DEPRECATEDIN_3_0
0412 int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,
0413 const unsigned char *from, int flen,
0414 const unsigned char *param, int plen,
0415 const EVP_MD *md, const EVP_MD *mgf1md);
0416 OSSL_DEPRECATEDIN_3_0
0417 int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,
0418 const unsigned char *from, int flen,
0419 int num,
0420 const unsigned char *param, int plen,
0421 const EVP_MD *md, const EVP_MD *mgf1md);
0422 OSSL_DEPRECATEDIN_3_0 int RSA_padding_add_none(unsigned char *to, int tlen,
0423 const unsigned char *f, int fl);
0424 OSSL_DEPRECATEDIN_3_0 int RSA_padding_check_none(unsigned char *to, int tlen,
0425 const unsigned char *f, int fl,
0426 int rsa_len);
0427 OSSL_DEPRECATEDIN_3_0 int RSA_padding_add_X931(unsigned char *to, int tlen,
0428 const unsigned char *f, int fl);
0429 OSSL_DEPRECATEDIN_3_0 int RSA_padding_check_X931(unsigned char *to, int tlen,
0430 const unsigned char *f, int fl,
0431 int rsa_len);
0432 OSSL_DEPRECATEDIN_3_0 int RSA_X931_hash_id(int nid);
0433
0434 OSSL_DEPRECATEDIN_3_0
0435 int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
0436 const EVP_MD *Hash, const unsigned char *EM,
0437 int sLen);
0438 OSSL_DEPRECATEDIN_3_0
0439 int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,
0440 const unsigned char *mHash, const EVP_MD *Hash,
0441 int sLen);
0442
0443 OSSL_DEPRECATEDIN_3_0
0444 int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
0445 const EVP_MD *Hash, const EVP_MD *mgf1Hash,
0446 const unsigned char *EM, int sLen);
0447
0448 OSSL_DEPRECATEDIN_3_0
0449 int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
0450 const unsigned char *mHash,
0451 const EVP_MD *Hash, const EVP_MD *mgf1Hash,
0452 int sLen);
0453
0454 # define RSA_get_ex_new_index(l, p, newf, dupf, freef) \
0455 CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef)
0456 OSSL_DEPRECATEDIN_3_0 int RSA_set_ex_data(RSA *r, int idx, void *arg);
0457 OSSL_DEPRECATEDIN_3_0 void *RSA_get_ex_data(const RSA *r, int idx);
0458
0459 DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, RSA, RSAPublicKey)
0460 DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, RSA, RSAPrivateKey)
0461
0462
0463
0464
0465
0466
0467
0468
0469 # define RSA_FLAG_FIPS_METHOD 0x0400
0470
0471
0472
0473
0474
0475
0476
0477 # define RSA_FLAG_NON_FIPS_ALLOW 0x0400
0478
0479
0480
0481
0482 # define RSA_FLAG_CHECKED 0x0800
0483
0484 OSSL_DEPRECATEDIN_3_0 RSA_METHOD *RSA_meth_new(const char *name, int flags);
0485 OSSL_DEPRECATEDIN_3_0 void RSA_meth_free(RSA_METHOD *meth);
0486 OSSL_DEPRECATEDIN_3_0 RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth);
0487 OSSL_DEPRECATEDIN_3_0 const char *RSA_meth_get0_name(const RSA_METHOD *meth);
0488 OSSL_DEPRECATEDIN_3_0 int RSA_meth_set1_name(RSA_METHOD *meth,
0489 const char *name);
0490 OSSL_DEPRECATEDIN_3_0 int RSA_meth_get_flags(const RSA_METHOD *meth);
0491 OSSL_DEPRECATEDIN_3_0 int RSA_meth_set_flags(RSA_METHOD *meth, int flags);
0492 OSSL_DEPRECATEDIN_3_0 void *RSA_meth_get0_app_data(const RSA_METHOD *meth);
0493 OSSL_DEPRECATEDIN_3_0 int RSA_meth_set0_app_data(RSA_METHOD *meth,
0494 void *app_data);
0495 OSSL_DEPRECATEDIN_3_0
0496 int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth)) (int flen,
0497 const unsigned char *from,
0498 unsigned char *to,
0499 RSA *rsa, int padding);
0500 OSSL_DEPRECATEDIN_3_0
0501 int RSA_meth_set_pub_enc(RSA_METHOD *rsa,
0502 int (*pub_enc) (int flen, const unsigned char *from,
0503 unsigned char *to, RSA *rsa,
0504 int padding));
0505 OSSL_DEPRECATEDIN_3_0
0506 int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth)) (int flen,
0507 const unsigned char *from,
0508 unsigned char *to,
0509 RSA *rsa, int padding);
0510 OSSL_DEPRECATEDIN_3_0
0511 int RSA_meth_set_pub_dec(RSA_METHOD *rsa,
0512 int (*pub_dec) (int flen, const unsigned char *from,
0513 unsigned char *to, RSA *rsa,
0514 int padding));
0515 OSSL_DEPRECATEDIN_3_0
0516 int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth)) (int flen,
0517 const unsigned char *from,
0518 unsigned char *to,
0519 RSA *rsa, int padding);
0520 OSSL_DEPRECATEDIN_3_0
0521 int RSA_meth_set_priv_enc(RSA_METHOD *rsa,
0522 int (*priv_enc) (int flen, const unsigned char *from,
0523 unsigned char *to, RSA *rsa,
0524 int padding));
0525 OSSL_DEPRECATEDIN_3_0
0526 int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth)) (int flen,
0527 const unsigned char *from,
0528 unsigned char *to,
0529 RSA *rsa, int padding);
0530 OSSL_DEPRECATEDIN_3_0
0531 int RSA_meth_set_priv_dec(RSA_METHOD *rsa,
0532 int (*priv_dec) (int flen, const unsigned char *from,
0533 unsigned char *to, RSA *rsa,
0534 int padding));
0535 OSSL_DEPRECATEDIN_3_0
0536 int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth)) (BIGNUM *r0,
0537 const BIGNUM *i,
0538 RSA *rsa, BN_CTX *ctx);
0539 OSSL_DEPRECATEDIN_3_0
0540 int RSA_meth_set_mod_exp(RSA_METHOD *rsa,
0541 int (*mod_exp) (BIGNUM *r0, const BIGNUM *i, RSA *rsa,
0542 BN_CTX *ctx));
0543 OSSL_DEPRECATEDIN_3_0
0544 int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth)) (BIGNUM *r,
0545 const BIGNUM *a,
0546 const BIGNUM *p,
0547 const BIGNUM *m,
0548 BN_CTX *ctx,
0549 BN_MONT_CTX *m_ctx);
0550 OSSL_DEPRECATEDIN_3_0
0551 int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa,
0552 int (*bn_mod_exp) (BIGNUM *r,
0553 const BIGNUM *a,
0554 const BIGNUM *p,
0555 const BIGNUM *m,
0556 BN_CTX *ctx,
0557 BN_MONT_CTX *m_ctx));
0558 OSSL_DEPRECATEDIN_3_0
0559 int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa);
0560 OSSL_DEPRECATEDIN_3_0
0561 int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa));
0562 OSSL_DEPRECATEDIN_3_0
0563 int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa);
0564 OSSL_DEPRECATEDIN_3_0
0565 int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa));
0566 OSSL_DEPRECATEDIN_3_0
0567 int (*RSA_meth_get_sign(const RSA_METHOD *meth)) (int type,
0568 const unsigned char *m,
0569 unsigned int m_length,
0570 unsigned char *sigret,
0571 unsigned int *siglen,
0572 const RSA *rsa);
0573 OSSL_DEPRECATEDIN_3_0
0574 int RSA_meth_set_sign(RSA_METHOD *rsa,
0575 int (*sign) (int type, const unsigned char *m,
0576 unsigned int m_length,
0577 unsigned char *sigret, unsigned int *siglen,
0578 const RSA *rsa));
0579 OSSL_DEPRECATEDIN_3_0
0580 int (*RSA_meth_get_verify(const RSA_METHOD *meth)) (int dtype,
0581 const unsigned char *m,
0582 unsigned int m_length,
0583 const unsigned char *sigbuf,
0584 unsigned int siglen,
0585 const RSA *rsa);
0586 OSSL_DEPRECATEDIN_3_0
0587 int RSA_meth_set_verify(RSA_METHOD *rsa,
0588 int (*verify) (int dtype, const unsigned char *m,
0589 unsigned int m_length,
0590 const unsigned char *sigbuf,
0591 unsigned int siglen, const RSA *rsa));
0592 OSSL_DEPRECATEDIN_3_0
0593 int (*RSA_meth_get_keygen(const RSA_METHOD *meth)) (RSA *rsa, int bits,
0594 BIGNUM *e, BN_GENCB *cb);
0595 OSSL_DEPRECATEDIN_3_0
0596 int RSA_meth_set_keygen(RSA_METHOD *rsa,
0597 int (*keygen) (RSA *rsa, int bits, BIGNUM *e,
0598 BN_GENCB *cb));
0599 OSSL_DEPRECATEDIN_3_0
0600 int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth)) (RSA *rsa,
0601 int bits,
0602 int primes,
0603 BIGNUM *e,
0604 BN_GENCB *cb);
0605 OSSL_DEPRECATEDIN_3_0
0606 int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth,
0607 int (*keygen) (RSA *rsa, int bits,
0608 int primes, BIGNUM *e,
0609 BN_GENCB *cb));
0610 #endif
0611
0612 # ifdef __cplusplus
0613 }
0614 # endif
0615 #endif