wolfSSL 3.11.1 for TLS1.3 beta
Fork of wolfSSL by
wolfssl/openssl/rsa.h@13:80fb167dafdf, 2017-05-30 (annotated)
- Committer:
- wolfSSL
- Date:
- Tue May 30 06:16:19 2017 +0000
- Revision:
- 13:80fb167dafdf
- Parent:
- 11:cee25a834751
wolfSSL 3.11.1: TLS1.3 Beta
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wolfSSL | 11:cee25a834751 | 1 | /* rsa.h for openSSL */ |
wolfSSL | 11:cee25a834751 | 2 | |
wolfSSL | 11:cee25a834751 | 3 | |
wolfSSL | 11:cee25a834751 | 4 | #ifndef WOLFSSL_RSA_H_ |
wolfSSL | 11:cee25a834751 | 5 | #define WOLFSSL_RSA_H_ |
wolfSSL | 11:cee25a834751 | 6 | |
wolfSSL | 11:cee25a834751 | 7 | #include <wolfssl/openssl/bn.h> |
wolfSSL | 11:cee25a834751 | 8 | |
wolfSSL | 11:cee25a834751 | 9 | |
wolfSSL | 11:cee25a834751 | 10 | #ifdef __cplusplus |
wolfSSL | 11:cee25a834751 | 11 | extern "C" { |
wolfSSL | 11:cee25a834751 | 12 | #endif |
wolfSSL | 11:cee25a834751 | 13 | |
wolfSSL | 11:cee25a834751 | 14 | |
wolfSSL | 11:cee25a834751 | 15 | enum { |
wolfSSL | 11:cee25a834751 | 16 | RSA_PKCS1_PADDING = 1 |
wolfSSL | 11:cee25a834751 | 17 | }; |
wolfSSL | 11:cee25a834751 | 18 | |
wolfSSL | 11:cee25a834751 | 19 | /* rsaTypes */ |
wolfSSL | 11:cee25a834751 | 20 | enum { |
wolfSSL | 11:cee25a834751 | 21 | NID_sha256 = 672, |
wolfSSL | 11:cee25a834751 | 22 | NID_sha384 = 673, |
wolfSSL | 11:cee25a834751 | 23 | NID_sha512 = 674 |
wolfSSL | 11:cee25a834751 | 24 | }; |
wolfSSL | 11:cee25a834751 | 25 | |
wolfSSL | 11:cee25a834751 | 26 | #ifndef WOLFSSL_RSA_TYPE_DEFINED /* guard on redeclaration */ |
wolfSSL | 11:cee25a834751 | 27 | typedef struct WOLFSSL_RSA WOLFSSL_RSA; |
wolfSSL | 11:cee25a834751 | 28 | #define WOLFSSL_RSA_TYPE_DEFINED |
wolfSSL | 11:cee25a834751 | 29 | #endif |
wolfSSL | 11:cee25a834751 | 30 | |
wolfSSL | 11:cee25a834751 | 31 | typedef WOLFSSL_RSA RSA; |
wolfSSL | 11:cee25a834751 | 32 | |
wolfSSL | 11:cee25a834751 | 33 | struct WOLFSSL_RSA { |
wolfSSL | 11:cee25a834751 | 34 | WOLFSSL_BIGNUM* n; |
wolfSSL | 11:cee25a834751 | 35 | WOLFSSL_BIGNUM* e; |
wolfSSL | 11:cee25a834751 | 36 | WOLFSSL_BIGNUM* d; |
wolfSSL | 11:cee25a834751 | 37 | WOLFSSL_BIGNUM* p; |
wolfSSL | 11:cee25a834751 | 38 | WOLFSSL_BIGNUM* q; |
wolfSSL | 11:cee25a834751 | 39 | WOLFSSL_BIGNUM* dmp1; /* dP */ |
wolfSSL | 11:cee25a834751 | 40 | WOLFSSL_BIGNUM* dmq1; /* dQ */ |
wolfSSL | 11:cee25a834751 | 41 | WOLFSSL_BIGNUM* iqmp; /* u */ |
wolfSSL | 11:cee25a834751 | 42 | void* internal; /* our RSA */ |
wolfSSL | 11:cee25a834751 | 43 | char inSet; /* internal set from external ? */ |
wolfSSL | 11:cee25a834751 | 44 | char exSet; /* external set from internal ? */ |
wolfSSL | 11:cee25a834751 | 45 | }; |
wolfSSL | 11:cee25a834751 | 46 | |
wolfSSL | 11:cee25a834751 | 47 | |
wolfSSL | 11:cee25a834751 | 48 | WOLFSSL_API WOLFSSL_RSA* wolfSSL_RSA_new(void); |
wolfSSL | 11:cee25a834751 | 49 | WOLFSSL_API void wolfSSL_RSA_free(WOLFSSL_RSA*); |
wolfSSL | 11:cee25a834751 | 50 | |
wolfSSL | 11:cee25a834751 | 51 | WOLFSSL_API int wolfSSL_RSA_generate_key_ex(WOLFSSL_RSA*, int bits, WOLFSSL_BIGNUM*, |
wolfSSL | 11:cee25a834751 | 52 | void* cb); |
wolfSSL | 11:cee25a834751 | 53 | |
wolfSSL | 11:cee25a834751 | 54 | WOLFSSL_API int wolfSSL_RSA_blinding_on(WOLFSSL_RSA*, WOLFSSL_BN_CTX*); |
wolfSSL | 11:cee25a834751 | 55 | WOLFSSL_API int wolfSSL_RSA_public_encrypt(int len, unsigned char* fr, |
wolfSSL | 11:cee25a834751 | 56 | unsigned char* to, WOLFSSL_RSA*, int padding); |
wolfSSL | 11:cee25a834751 | 57 | WOLFSSL_API int wolfSSL_RSA_private_decrypt(int len, unsigned char* fr, |
wolfSSL | 11:cee25a834751 | 58 | unsigned char* to, WOLFSSL_RSA*, int padding); |
wolfSSL | 11:cee25a834751 | 59 | |
wolfSSL | 11:cee25a834751 | 60 | WOLFSSL_API int wolfSSL_RSA_size(const WOLFSSL_RSA*); |
wolfSSL | 11:cee25a834751 | 61 | WOLFSSL_API int wolfSSL_RSA_sign(int type, const unsigned char* m, |
wolfSSL | 11:cee25a834751 | 62 | unsigned int mLen, unsigned char* sigRet, |
wolfSSL | 11:cee25a834751 | 63 | unsigned int* sigLen, WOLFSSL_RSA*); |
wolfSSL | 11:cee25a834751 | 64 | WOLFSSL_API int wolfSSL_RSA_public_decrypt(int flen, unsigned char* from, |
wolfSSL | 11:cee25a834751 | 65 | unsigned char* to, WOLFSSL_RSA*, int padding); |
wolfSSL | 11:cee25a834751 | 66 | WOLFSSL_API int wolfSSL_RSA_GenAdd(WOLFSSL_RSA*); |
wolfSSL | 11:cee25a834751 | 67 | WOLFSSL_API int wolfSSL_RSA_LoadDer(WOLFSSL_RSA*, const unsigned char*, int sz); |
wolfSSL | 11:cee25a834751 | 68 | |
wolfSSL | 11:cee25a834751 | 69 | |
wolfSSL | 11:cee25a834751 | 70 | #define RSA_new wolfSSL_RSA_new |
wolfSSL | 11:cee25a834751 | 71 | #define RSA_free wolfSSL_RSA_free |
wolfSSL | 11:cee25a834751 | 72 | |
wolfSSL | 11:cee25a834751 | 73 | #define RSA_generate_key_ex wolfSSL_RSA_generate_key_ex |
wolfSSL | 11:cee25a834751 | 74 | |
wolfSSL | 11:cee25a834751 | 75 | #define RSA_blinding_on wolfSSL_RSA_blinding_on |
wolfSSL | 11:cee25a834751 | 76 | #define RSA_public_encrypt wolfSSL_RSA_public_encrypt |
wolfSSL | 11:cee25a834751 | 77 | #define RSA_private_decrypt wolfSSL_RSA_private_decrypt |
wolfSSL | 11:cee25a834751 | 78 | |
wolfSSL | 11:cee25a834751 | 79 | #define RSA_size wolfSSL_RSA_size |
wolfSSL | 11:cee25a834751 | 80 | #define RSA_sign wolfSSL_RSA_sign |
wolfSSL | 11:cee25a834751 | 81 | #define RSA_public_decrypt wolfSSL_RSA_public_decrypt |
wolfSSL | 11:cee25a834751 | 82 | |
wolfSSL | 11:cee25a834751 | 83 | |
wolfSSL | 11:cee25a834751 | 84 | #ifdef __cplusplus |
wolfSSL | 11:cee25a834751 | 85 | } /* extern "C" */ |
wolfSSL | 11:cee25a834751 | 86 | #endif |
wolfSSL | 11:cee25a834751 | 87 | |
wolfSSL | 11:cee25a834751 | 88 | #endif /* header */ |
wolfSSL | 11:cee25a834751 | 89 |