wolf SSL / wolfSSL-TLS13-Beta

Fork of wolfSSL by wolf SSL

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