[164] | 1 | /* rsa.h for openSSL */
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | #ifndef WOLFSSL_RSA_H_
|
---|
| 5 | #define WOLFSSL_RSA_H_
|
---|
| 6 |
|
---|
| 7 | #include <wolfssl/openssl/ssl.h>
|
---|
| 8 | #include <wolfssl/openssl/bn.h>
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 | #ifdef __cplusplus
|
---|
| 12 | extern "C" {
|
---|
| 13 | #endif
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | enum {
|
---|
| 17 | RSA_PKCS1_PADDING = 1
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 | struct WOLFSSL_RSA {
|
---|
| 21 | WOLFSSL_BIGNUM* n;
|
---|
| 22 | WOLFSSL_BIGNUM* e;
|
---|
| 23 | WOLFSSL_BIGNUM* d;
|
---|
| 24 | WOLFSSL_BIGNUM* p;
|
---|
| 25 | WOLFSSL_BIGNUM* q;
|
---|
| 26 | WOLFSSL_BIGNUM* dmp1; /* dP */
|
---|
| 27 | WOLFSSL_BIGNUM* dmq1; /* dQ */
|
---|
| 28 | WOLFSSL_BIGNUM* iqmp; /* u */
|
---|
| 29 | void* internal; /* our RSA */
|
---|
| 30 | char inSet; /* internal set from external ? */
|
---|
| 31 | char exSet; /* external set from internal ? */
|
---|
| 32 | };
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | WOLFSSL_API WOLFSSL_RSA* wolfSSL_RSA_new(void);
|
---|
| 36 | WOLFSSL_API void wolfSSL_RSA_free(WOLFSSL_RSA*);
|
---|
| 37 |
|
---|
| 38 | WOLFSSL_API int wolfSSL_RSA_generate_key_ex(WOLFSSL_RSA*, int bits, WOLFSSL_BIGNUM*,
|
---|
| 39 | void* cb);
|
---|
| 40 |
|
---|
| 41 | WOLFSSL_API int wolfSSL_RSA_blinding_on(WOLFSSL_RSA*, WOLFSSL_BN_CTX*);
|
---|
| 42 | WOLFSSL_API int wolfSSL_RSA_public_encrypt(int len, unsigned char* fr,
|
---|
| 43 | unsigned char* to, WOLFSSL_RSA*, int padding);
|
---|
| 44 | WOLFSSL_API int wolfSSL_RSA_private_decrypt(int len, unsigned char* fr,
|
---|
| 45 | unsigned char* to, WOLFSSL_RSA*, int padding);
|
---|
| 46 |
|
---|
| 47 | WOLFSSL_API int wolfSSL_RSA_size(const WOLFSSL_RSA*);
|
---|
| 48 | WOLFSSL_API int wolfSSL_RSA_sign(int type, const unsigned char* m,
|
---|
| 49 | unsigned int mLen, unsigned char* sigRet,
|
---|
| 50 | unsigned int* sigLen, WOLFSSL_RSA*);
|
---|
| 51 | WOLFSSL_API int wolfSSL_RSA_public_decrypt(int flen, unsigned char* from,
|
---|
| 52 | unsigned char* to, WOLFSSL_RSA*, int padding);
|
---|
| 53 | WOLFSSL_API int wolfSSL_RSA_GenAdd(WOLFSSL_RSA*);
|
---|
| 54 | WOLFSSL_API int wolfSSL_RSA_LoadDer(WOLFSSL_RSA*, const unsigned char*, int sz);
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | #define RSA_new wolfSSL_RSA_new
|
---|
| 58 | #define RSA_free wolfSSL_RSA_free
|
---|
| 59 |
|
---|
| 60 | #define RSA_generate_key_ex wolfSSL_RSA_generate_key_ex
|
---|
| 61 |
|
---|
| 62 | #define RSA_blinding_on wolfSSL_RSA_blinding_on
|
---|
| 63 | #define RSA_public_encrypt wolfSSL_RSA_public_encrypt
|
---|
| 64 | #define RSA_private_decrypt wolfSSL_RSA_private_decrypt
|
---|
| 65 |
|
---|
| 66 | #define RSA_size wolfSSL_RSA_size
|
---|
| 67 | #define RSA_sign wolfSSL_RSA_sign
|
---|
| 68 | #define RSA_public_decrypt wolfSSL_RSA_public_decrypt
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | #ifdef __cplusplus
|
---|
| 72 | } /* extern "C" */
|
---|
| 73 | #endif
|
---|
| 74 |
|
---|
| 75 | #endif /* header */
|
---|