62 #include <openssl/asn1.h>
64 #ifndef OPENSSL_NO_BIO
65 #include <openssl/bio.h>
67 #include <openssl/crypto.h>
68 #include <openssl/ossl_typ.h>
69 #ifndef OPENSSL_NO_DEPRECATED
70 #include <openssl/bn.h>
74 #error RSA is disabled.
88 int (*rsa_pub_enc)(
int flen,
const unsigned char *from,
90 RSA *rsa,
int padding);
91 int (*rsa_pub_dec)(
int flen,
const unsigned char *from,
93 RSA *rsa,
int padding);
94 int (*rsa_priv_enc)(
int flen,
const unsigned char *from,
96 RSA *rsa,
int padding);
97 int (*rsa_priv_dec)(
int flen,
const unsigned char *from,
99 RSA *rsa,
int padding);
104 int (*init)(
RSA *rsa);
105 int (*finish)(
RSA *rsa);
115 int (*rsa_sign)(
int type,
116 const unsigned char *m,
unsigned int m_length,
117 unsigned char *sigret,
unsigned int *siglen,
const RSA *rsa);
118 int (*rsa_verify)(
int dtype,
119 const unsigned char *m,
unsigned int m_length,
120 unsigned char *sigbuf,
unsigned int siglen,
const RSA *rsa);
162 #ifndef OPENSSL_RSA_MAX_MODULUS_BITS
163 # define OPENSSL_RSA_MAX_MODULUS_BITS 16384
166 #ifndef OPENSSL_RSA_SMALL_MODULUS_BITS
167 # define OPENSSL_RSA_SMALL_MODULUS_BITS 3072
169 #ifndef OPENSSL_RSA_MAX_PUBEXP_BITS
170 # define OPENSSL_RSA_MAX_PUBEXP_BITS 64
174 #define RSA_F4 0x10001L
176 #define RSA_METHOD_FLAG_NO_CHECK 0x0001
178 #define RSA_FLAG_CACHE_PUBLIC 0x0002
179 #define RSA_FLAG_CACHE_PRIVATE 0x0004
180 #define RSA_FLAG_BLINDING 0x0008
181 #define RSA_FLAG_THREAD_SAFE 0x0010
187 #define RSA_FLAG_EXT_PKEY 0x0020
191 #define RSA_FLAG_SIGN_VER 0x0040
193 #define RSA_FLAG_NO_BLINDING 0x0080
198 #define RSA_FLAG_NO_CONSTTIME 0x0100
208 #ifndef OPENSSL_NO_DEPRECATED
209 #define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME
220 #define RSA_PKCS1_PADDING 1
221 #define RSA_SSLV23_PADDING 2
222 #define RSA_NO_PADDING 3
223 #define RSA_PKCS1_OAEP_PADDING 4
224 #define RSA_X931_PADDING 5
226 #define RSA_PKCS1_PADDING_SIZE 11
228 #define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg)
229 #define RSA_get_app_data(s) RSA_get_ex_data(s,0)
233 int RSA_size(
const RSA *);
236 #ifndef OPENSSL_NO_DEPRECATED
237 RSA * RSA_generate_key(
int bits,
unsigned long e,
void
238 (*callback)(
int,
int,
void *),
void *cb_arg);
244 int RSA_check_key(
const RSA *);
246 int RSA_public_encrypt(
int flen,
const unsigned char *from,
247 unsigned char *to,
RSA *rsa,
int padding);
248 int RSA_private_encrypt(
int flen,
const unsigned char *from,
249 unsigned char *to,
RSA *rsa,
int padding);
250 int RSA_public_decrypt(
int flen,
const unsigned char *from,
251 unsigned char *to,
RSA *rsa,
int padding);
252 int RSA_private_decrypt(
int flen,
const unsigned char *from,
253 unsigned char *to,
RSA *rsa,
int padding);
254 void RSA_free (
RSA *r);
256 int RSA_up_ref(
RSA *r);
258 int RSA_flags(
const RSA *r);
260 void RSA_set_default_method(
const RSA_METHOD *meth);
261 const RSA_METHOD *RSA_get_default_method(
void);
266 int RSA_memory_lock(
RSA *r);
273 DECLARE_ASN1_ENCODE_FUNCTIONS_const(
RSA, RSAPublicKey)
274 DECLARE_ASN1_ENCODE_FUNCTIONS_const(
RSA, RSAPrivateKey)
276 #ifndef OPENSSL_NO_FP_API
277 int RSA_print_fp(FILE *fp,
const RSA *r,
int offset);
280 #ifndef OPENSSL_NO_BIO
281 int RSA_print(
BIO *bp,
const RSA *r,
int offset);
284 int i2d_RSA_NET(
const RSA *a,
unsigned char **pp,
285 int (*cb)(
char *buf,
int len,
const char *prompt,
int verify),
287 RSA *d2i_RSA_NET(RSA **a,
const unsigned char **pp,
long length,
288 int (*cb)(
char *buf,
int len,
const char *prompt,
int verify),
291 int i2d_Netscape_RSA(
const RSA *a,
unsigned char **pp,
292 int (*cb)(
char *buf,
int len,
const char *prompt,
294 RSA *d2i_Netscape_RSA(RSA **a,
const unsigned char **pp,
long length,
295 int (*cb)(
char *buf,
int len,
const char *prompt,
300 int RSA_sign(
int type,
const unsigned char *m,
unsigned int m_length,
301 unsigned char *sigret,
unsigned int *siglen, RSA *rsa);
302 int RSA_verify(
int type,
const unsigned char *m,
unsigned int m_length,
303 unsigned char *sigbuf,
unsigned int siglen, RSA *rsa);
307 int RSA_sign_ASN1_OCTET_STRING(
int type,
308 const unsigned char *m,
unsigned int m_length,
309 unsigned char *sigret,
unsigned int *siglen, RSA *rsa);
310 int RSA_verify_ASN1_OCTET_STRING(
int type,
311 const unsigned char *m,
unsigned int m_length,
312 unsigned char *sigbuf,
unsigned int siglen, RSA *rsa);
314 int RSA_blinding_on(RSA *rsa,
BN_CTX *ctx);
315 void RSA_blinding_off(RSA *rsa);
318 int RSA_padding_add_PKCS1_type_1(
unsigned char *to,
int tlen,
319 const unsigned char *f,
int fl);
320 int RSA_padding_check_PKCS1_type_1(
unsigned char *to,
int tlen,
321 const unsigned char *f,
int fl,
int rsa_len);
322 int RSA_padding_add_PKCS1_type_2(
unsigned char *to,
int tlen,
323 const unsigned char *f,
int fl);
324 int RSA_padding_check_PKCS1_type_2(
unsigned char *to,
int tlen,
325 const unsigned char *f,
int fl,
int rsa_len);
326 int PKCS1_MGF1(
unsigned char *mask,
long len,
327 const unsigned char *seed,
long seedlen,
const EVP_MD *dgst);
328 int RSA_padding_add_PKCS1_OAEP(
unsigned char *to,
int tlen,
329 const unsigned char *f,
int fl,
330 const unsigned char *p,
int pl);
331 int RSA_padding_check_PKCS1_OAEP(
unsigned char *to,
int tlen,
332 const unsigned char *f,
int fl,
int rsa_len,
333 const unsigned char *p,
int pl);
334 int RSA_padding_add_SSLv23(
unsigned char *to,
int tlen,
335 const unsigned char *f,
int fl);
336 int RSA_padding_check_SSLv23(
unsigned char *to,
int tlen,
337 const unsigned char *f,
int fl,
int rsa_len);
338 int RSA_padding_add_none(
unsigned char *to,
int tlen,
339 const unsigned char *f,
int fl);
340 int RSA_padding_check_none(
unsigned char *to,
int tlen,
341 const unsigned char *f,
int fl,
int rsa_len);
342 int RSA_padding_add_X931(
unsigned char *to,
int tlen,
343 const unsigned char *f,
int fl);
344 int RSA_padding_check_X931(
unsigned char *to,
int tlen,
345 const unsigned char *f,
int fl,
int rsa_len);
346 int RSA_X931_hash_id(
int nid);
348 int RSA_verify_PKCS1_PSS(RSA *rsa,
const unsigned char *mHash,
349 const EVP_MD *Hash,
const unsigned char *EM,
int sLen);
350 int RSA_padding_add_PKCS1_PSS(RSA *rsa,
unsigned char *EM,
351 const unsigned char *mHash,
352 const EVP_MD *Hash,
int sLen);
354 int RSA_get_ex_new_index(
long argl,
void *argp, CRYPTO_EX_new *new_func,
355 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
356 int RSA_set_ex_data(RSA *r,
int idx,
void *arg);
357 void *RSA_get_ex_data(
const RSA *r,
int idx);
359 RSA *RSAPublicKey_dup(RSA *rsa);
360 RSA *RSAPrivateKey_dup(RSA *rsa);
366 void ERR_load_RSA_strings(
void);
371 #define RSA_F_MEMORY_LOCK 100
372 #define RSA_F_RSA_BUILTIN_KEYGEN 129
373 #define RSA_F_RSA_CHECK_KEY 123
374 #define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101
375 #define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102
376 #define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103
377 #define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 104
378 #define RSA_F_RSA_GENERATE_KEY 105
379 #define RSA_F_RSA_MEMORY_LOCK 130
380 #define RSA_F_RSA_NEW_METHOD 106
381 #define RSA_F_RSA_NULL 124
382 #define RSA_F_RSA_NULL_MOD_EXP 131
383 #define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132
384 #define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133
385 #define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134
386 #define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135
387 #define RSA_F_RSA_PADDING_ADD_NONE 107
388 #define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121
389 #define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125
390 #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108
391 #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109
392 #define RSA_F_RSA_PADDING_ADD_SSLV23 110
393 #define RSA_F_RSA_PADDING_ADD_X931 127
394 #define RSA_F_RSA_PADDING_CHECK_NONE 111
395 #define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122
396 #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112
397 #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113
398 #define RSA_F_RSA_PADDING_CHECK_SSLV23 114
399 #define RSA_F_RSA_PADDING_CHECK_X931 128
400 #define RSA_F_RSA_PRINT 115
401 #define RSA_F_RSA_PRINT_FP 116
402 #define RSA_F_RSA_SETUP_BLINDING 136
403 #define RSA_F_RSA_SIGN 117
404 #define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118
405 #define RSA_F_RSA_VERIFY 119
406 #define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120
407 #define RSA_F_RSA_VERIFY_PKCS1_PSS 126
410 #define RSA_R_ALGORITHM_MISMATCH 100
411 #define RSA_R_BAD_E_VALUE 101
412 #define RSA_R_BAD_FIXED_HEADER_DECRYPT 102
413 #define RSA_R_BAD_PAD_BYTE_COUNT 103
414 #define RSA_R_BAD_SIGNATURE 104
415 #define RSA_R_BLOCK_TYPE_IS_NOT_01 106
416 #define RSA_R_BLOCK_TYPE_IS_NOT_02 107
417 #define RSA_R_DATA_GREATER_THAN_MOD_LEN 108
418 #define RSA_R_DATA_TOO_LARGE 109
419 #define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110
420 #define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132
421 #define RSA_R_DATA_TOO_SMALL 111
422 #define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122
423 #define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112
424 #define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124
425 #define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125
426 #define RSA_R_D_E_NOT_CONGRUENT_TO_1 123
427 #define RSA_R_FIRST_OCTET_INVALID 133
428 #define RSA_R_INVALID_HEADER 137
429 #define RSA_R_INVALID_MESSAGE_LENGTH 131
430 #define RSA_R_INVALID_PADDING 138
431 #define RSA_R_INVALID_TRAILER 139
432 #define RSA_R_IQMP_NOT_INVERSE_OF_Q 126
433 #define RSA_R_KEY_SIZE_TOO_SMALL 120
434 #define RSA_R_LAST_OCTET_INVALID 134
435 #define RSA_R_MODULUS_TOO_LARGE 105
436 #define RSA_R_NO_PUBLIC_EXPONENT 140
437 #define RSA_R_NULL_BEFORE_BLOCK_MISSING 113
438 #define RSA_R_N_DOES_NOT_EQUAL_P_Q 127
439 #define RSA_R_OAEP_DECODING_ERROR 121
440 #define RSA_R_PADDING_CHECK_FAILED 114
441 #define RSA_R_P_NOT_PRIME 128
442 #define RSA_R_Q_NOT_PRIME 129
443 #define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130
444 #define RSA_R_SLEN_CHECK_FAILED 136
445 #define RSA_R_SLEN_RECOVERY_FAILED 135
446 #define RSA_R_SSLV3_ROLLBACK_ATTACK 115
447 #define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
448 #define RSA_R_UNKNOWN_ALGORITHM_TYPE 117
449 #define RSA_R_UNKNOWN_PADDING_TYPE 118
450 #define RSA_R_WRONG_SIGNATURE_LENGTH 119
Definition: eng_int.h:148
Definition: bn_blind.c:118