Renesas / SecureDweet
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rsa.h Source File

rsa.h

00001 /* rsa.h for openSSL */
00002 
00003 
00004 #ifndef WOLFSSL_RSA_H_
00005 #define WOLFSSL_RSA_H_
00006 
00007 #include <wolfssl/openssl/ssl.h>
00008 #include <wolfssl/openssl/bn.h>
00009 
00010 
00011 #ifdef __cplusplus
00012     extern "C" {
00013 #endif
00014 
00015 
00016 enum  { 
00017     RSA_PKCS1_PADDING = 1
00018  };
00019 
00020 /* rsaTypes */
00021 enum {
00022     NID_sha256 = 672,
00023     NID_sha384 = 673,
00024     NID_sha512 = 674
00025 };
00026 
00027 struct WOLFSSL_RSA {
00028     WOLFSSL_BIGNUM* n;
00029     WOLFSSL_BIGNUM* e;
00030     WOLFSSL_BIGNUM* d;
00031     WOLFSSL_BIGNUM* p;
00032     WOLFSSL_BIGNUM* q;
00033     WOLFSSL_BIGNUM* dmp1;      /* dP */
00034     WOLFSSL_BIGNUM* dmq1;      /* dQ */
00035     WOLFSSL_BIGNUM* iqmp;      /* u */
00036     void*          internal;  /* our RSA */
00037     char           inSet;     /* internal set from external ? */
00038     char           exSet;     /* external set from internal ? */
00039 };
00040 
00041 
00042 WOLFSSL_API WOLFSSL_RSA* wolfSSL_RSA_new(void);
00043 WOLFSSL_API void        wolfSSL_RSA_free(WOLFSSL_RSA*);
00044 
00045 WOLFSSL_API int wolfSSL_RSA_generate_key_ex(WOLFSSL_RSA*, int bits, WOLFSSL_BIGNUM*,
00046                                           void* cb);
00047 
00048 WOLFSSL_API int wolfSSL_RSA_blinding_on(WOLFSSL_RSA*, WOLFSSL_BN_CTX*);
00049 WOLFSSL_API int wolfSSL_RSA_public_encrypt(int len, unsigned char* fr,
00050                                    unsigned char* to, WOLFSSL_RSA*, int padding);
00051 WOLFSSL_API int wolfSSL_RSA_private_decrypt(int len, unsigned char* fr,
00052                                    unsigned char* to, WOLFSSL_RSA*, int padding);
00053 
00054 WOLFSSL_API int wolfSSL_RSA_size(const WOLFSSL_RSA*);
00055 WOLFSSL_API int wolfSSL_RSA_sign(int type, const unsigned char* m,
00056                                unsigned int mLen, unsigned char* sigRet,
00057                                unsigned int* sigLen, WOLFSSL_RSA*);
00058 WOLFSSL_API int wolfSSL_RSA_public_decrypt(int flen, unsigned char* from,
00059                                   unsigned char* to, WOLFSSL_RSA*, int padding);
00060 WOLFSSL_API int wolfSSL_RSA_GenAdd(WOLFSSL_RSA*);
00061 WOLFSSL_API int wolfSSL_RSA_LoadDer(WOLFSSL_RSA*, const unsigned char*, int sz);
00062 
00063 
00064 #define RSA_new  wolfSSL_RSA_new
00065 #define RSA_free wolfSSL_RSA_free
00066 
00067 #define RSA_generate_key_ex wolfSSL_RSA_generate_key_ex
00068 
00069 #define RSA_blinding_on     wolfSSL_RSA_blinding_on
00070 #define RSA_public_encrypt  wolfSSL_RSA_public_encrypt
00071 #define RSA_private_decrypt wolfSSL_RSA_private_decrypt
00072 
00073 #define RSA_size           wolfSSL_RSA_size
00074 #define RSA_sign           wolfSSL_RSA_sign
00075 #define RSA_public_decrypt wolfSSL_RSA_public_decrypt
00076 
00077 
00078 #ifdef __cplusplus
00079     }  /* extern "C" */ 
00080 #endif
00081 
00082 #endif /* header */
00083