SSL/TLS Library
CyaSSL is SSL/TLS library for embedded systems.
cyassl/openssl/rsa.h@0:9d17e4342598, 2014-04-20 (annotated)
- Committer:
- wolfSSL
- Date:
- Sun Apr 20 12:40:57 2014 +0000
- Revision:
- 0:9d17e4342598
CyaSSL SSL/TLS Library 2.9.4;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wolfSSL | 0:9d17e4342598 | 1 | /* rsa.h for openSSL */ |
wolfSSL | 0:9d17e4342598 | 2 | |
wolfSSL | 0:9d17e4342598 | 3 | |
wolfSSL | 0:9d17e4342598 | 4 | #ifndef CYASSL_RSA_H_ |
wolfSSL | 0:9d17e4342598 | 5 | #define CYASSL_RSA_H_ |
wolfSSL | 0:9d17e4342598 | 6 | |
wolfSSL | 0:9d17e4342598 | 7 | #include <cyassl/openssl/ssl.h> |
wolfSSL | 0:9d17e4342598 | 8 | #include <cyassl/openssl/bn.h> |
wolfSSL | 0:9d17e4342598 | 9 | |
wolfSSL | 0:9d17e4342598 | 10 | |
wolfSSL | 0:9d17e4342598 | 11 | #ifdef __cplusplus |
wolfSSL | 0:9d17e4342598 | 12 | extern "C" { |
wolfSSL | 0:9d17e4342598 | 13 | #endif |
wolfSSL | 0:9d17e4342598 | 14 | |
wolfSSL | 0:9d17e4342598 | 15 | |
wolfSSL | 0:9d17e4342598 | 16 | enum { |
wolfSSL | 0:9d17e4342598 | 17 | RSA_PKCS1_PADDING = 1 |
wolfSSL | 0:9d17e4342598 | 18 | }; |
wolfSSL | 0:9d17e4342598 | 19 | |
wolfSSL | 0:9d17e4342598 | 20 | struct CYASSL_RSA { |
wolfSSL | 0:9d17e4342598 | 21 | CYASSL_BIGNUM* n; |
wolfSSL | 0:9d17e4342598 | 22 | CYASSL_BIGNUM* e; |
wolfSSL | 0:9d17e4342598 | 23 | CYASSL_BIGNUM* d; |
wolfSSL | 0:9d17e4342598 | 24 | CYASSL_BIGNUM* p; |
wolfSSL | 0:9d17e4342598 | 25 | CYASSL_BIGNUM* q; |
wolfSSL | 0:9d17e4342598 | 26 | CYASSL_BIGNUM* dmp1; /* dP */ |
wolfSSL | 0:9d17e4342598 | 27 | CYASSL_BIGNUM* dmq1; /* dQ */ |
wolfSSL | 0:9d17e4342598 | 28 | CYASSL_BIGNUM* iqmp; /* u */ |
wolfSSL | 0:9d17e4342598 | 29 | void* internal; /* our RSA */ |
wolfSSL | 0:9d17e4342598 | 30 | char inSet; /* internal set from external ? */ |
wolfSSL | 0:9d17e4342598 | 31 | char exSet; /* external set from internal ? */ |
wolfSSL | 0:9d17e4342598 | 32 | }; |
wolfSSL | 0:9d17e4342598 | 33 | |
wolfSSL | 0:9d17e4342598 | 34 | |
wolfSSL | 0:9d17e4342598 | 35 | CYASSL_API CYASSL_RSA* CyaSSL_RSA_new(void); |
wolfSSL | 0:9d17e4342598 | 36 | CYASSL_API void CyaSSL_RSA_free(CYASSL_RSA*); |
wolfSSL | 0:9d17e4342598 | 37 | |
wolfSSL | 0:9d17e4342598 | 38 | CYASSL_API int CyaSSL_RSA_generate_key_ex(CYASSL_RSA*, int bits, CYASSL_BIGNUM*, |
wolfSSL | 0:9d17e4342598 | 39 | void* cb); |
wolfSSL | 0:9d17e4342598 | 40 | |
wolfSSL | 0:9d17e4342598 | 41 | CYASSL_API int CyaSSL_RSA_blinding_on(CYASSL_RSA*, CYASSL_BN_CTX*); |
wolfSSL | 0:9d17e4342598 | 42 | CYASSL_API int CyaSSL_RSA_public_encrypt(int len, unsigned char* fr, |
wolfSSL | 0:9d17e4342598 | 43 | unsigned char* to, CYASSL_RSA*, int padding); |
wolfSSL | 0:9d17e4342598 | 44 | CYASSL_API int CyaSSL_RSA_private_decrypt(int len, unsigned char* fr, |
wolfSSL | 0:9d17e4342598 | 45 | unsigned char* to, CYASSL_RSA*, int padding); |
wolfSSL | 0:9d17e4342598 | 46 | |
wolfSSL | 0:9d17e4342598 | 47 | CYASSL_API int CyaSSL_RSA_size(const CYASSL_RSA*); |
wolfSSL | 0:9d17e4342598 | 48 | CYASSL_API int CyaSSL_RSA_sign(int type, const unsigned char* m, |
wolfSSL | 0:9d17e4342598 | 49 | unsigned int mLen, unsigned char* sigRet, |
wolfSSL | 0:9d17e4342598 | 50 | unsigned int* sigLen, CYASSL_RSA*); |
wolfSSL | 0:9d17e4342598 | 51 | CYASSL_API int CyaSSL_RSA_public_decrypt(int flen, unsigned char* from, |
wolfSSL | 0:9d17e4342598 | 52 | unsigned char* to, CYASSL_RSA*, int padding); |
wolfSSL | 0:9d17e4342598 | 53 | CYASSL_API int CyaSSL_RSA_GenAdd(CYASSL_RSA*); |
wolfSSL | 0:9d17e4342598 | 54 | CYASSL_API int CyaSSL_RSA_LoadDer(CYASSL_RSA*, const unsigned char*, int sz); |
wolfSSL | 0:9d17e4342598 | 55 | |
wolfSSL | 0:9d17e4342598 | 56 | |
wolfSSL | 0:9d17e4342598 | 57 | #define RSA_new CyaSSL_RSA_new |
wolfSSL | 0:9d17e4342598 | 58 | #define RSA_free CyaSSL_RSA_free |
wolfSSL | 0:9d17e4342598 | 59 | |
wolfSSL | 0:9d17e4342598 | 60 | #define RSA_generate_key_ex CyaSSL_RSA_generate_key_ex |
wolfSSL | 0:9d17e4342598 | 61 | |
wolfSSL | 0:9d17e4342598 | 62 | #define RSA_blinding_on CyaSSL_RSA_blinding_on |
wolfSSL | 0:9d17e4342598 | 63 | #define RSA_public_encrypt CyaSSL_RSA_public_encrypt |
wolfSSL | 0:9d17e4342598 | 64 | #define RSA_private_decrypt CyaSSL_RSA_private_decrypt |
wolfSSL | 0:9d17e4342598 | 65 | |
wolfSSL | 0:9d17e4342598 | 66 | #define RSA_size CyaSSL_RSA_size |
wolfSSL | 0:9d17e4342598 | 67 | #define RSA_sign CyaSSL_RSA_sign |
wolfSSL | 0:9d17e4342598 | 68 | #define RSA_public_decrypt CyaSSL_RSA_public_decrypt |
wolfSSL | 0:9d17e4342598 | 69 | |
wolfSSL | 0:9d17e4342598 | 70 | |
wolfSSL | 0:9d17e4342598 | 71 | #ifdef __cplusplus |
wolfSSL | 0:9d17e4342598 | 72 | } /* extern "C" */ |
wolfSSL | 0:9d17e4342598 | 73 | #endif |
wolfSSL | 0:9d17e4342598 | 74 | |
wolfSSL | 0:9d17e4342598 | 75 | #endif /* header */ |