]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/CyaSSL/cyassl/openssl/rsa.h
Add FreeRTOS-Plus directory.
[freertos] / FreeRTOS-Plus / CyaSSL / cyassl / openssl / rsa.h
1 /* rsa.h for openSSL */
2
3
4 #ifndef CYASSL_RSA_H_
5 #define CYASSL_RSA_H_
6
7 #include <cyassl/openssl/ssl.h>
8 #include <cyassl/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 CYASSL_RSA {
21         CYASSL_BIGNUM* n;
22         CYASSL_BIGNUM* e;
23         CYASSL_BIGNUM* d;
24         CYASSL_BIGNUM* p;
25         CYASSL_BIGNUM* q;
26         CYASSL_BIGNUM* dmp1;      /* dP */
27         CYASSL_BIGNUM* dmq1;      /* dQ */
28         CYASSL_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 CYASSL_API CYASSL_RSA* CyaSSL_RSA_new(void);
36 CYASSL_API void        CyaSSL_RSA_free(CYASSL_RSA*);
37
38 CYASSL_API int CyaSSL_RSA_generate_key_ex(CYASSL_RSA*, int bits, CYASSL_BIGNUM*,
39                                           void* cb);
40
41 CYASSL_API int CyaSSL_RSA_blinding_on(CYASSL_RSA*, CYASSL_BN_CTX*);
42 CYASSL_API int CyaSSL_RSA_public_encrypt(int len, unsigned char* fr,
43                                        unsigned char* to, CYASSL_RSA*, int padding);
44 CYASSL_API int CyaSSL_RSA_private_decrypt(int len, unsigned char* fr,
45                                        unsigned char* to, CYASSL_RSA*, int padding);
46
47 CYASSL_API int CyaSSL_RSA_size(const CYASSL_RSA*);
48 CYASSL_API int CyaSSL_RSA_sign(int type, const unsigned char* m,
49                                unsigned int mLen, unsigned char* sigRet,
50                                unsigned int* sigLen, CYASSL_RSA*);
51 CYASSL_API int CyaSSL_RSA_public_decrypt(int flen, unsigned char* from,
52                                   unsigned char* to, CYASSL_RSA*, int padding);
53 CYASSL_API int CyaSSL_RSA_GenAdd(CYASSL_RSA*);
54 CYASSL_API int CyaSSL_RSA_LoadDer(CYASSL_RSA*, const unsigned char*, int sz);
55
56
57 #define RSA_new  CyaSSL_RSA_new
58 #define RSA_free CyaSSL_RSA_free
59
60 #define RSA_generate_key_ex CyaSSL_RSA_generate_key_ex
61
62 #define RSA_blinding_on     CyaSSL_RSA_blinding_on
63 #define RSA_public_encrypt  CyaSSL_RSA_public_encrypt
64 #define RSA_private_decrypt CyaSSL_RSA_private_decrypt
65
66 #define RSA_size           CyaSSL_RSA_size
67 #define RSA_sign           CyaSSL_RSA_sign
68 #define RSA_public_decrypt CyaSSL_RSA_public_decrypt
69
70
71 #ifdef __cplusplus
72     }  /* extern "C" */ 
73 #endif
74
75 #endif /* header */