wolfssl/cyassl/openssl/rsa.h

76 lines
2.2 KiB
C
Raw Normal View History

2011-02-05 22:14:47 +03:00
/* rsa.h for openSSL */
#ifndef CYASSL_RSA_H_
#define CYASSL_RSA_H_
2012-04-27 03:27:27 +04:00
#include <cyassl/openssl/ssl.h>
#include <cyassl/openssl/bn.h>
2011-02-05 22:14:47 +03:00
2012-04-27 03:27:27 +04:00
#ifdef __cplusplus
extern "C" {
#endif
enum {
RSA_PKCS1_PADDING = 1
};
struct CYASSL_RSA {
2012-05-02 03:12:12 +04:00
CYASSL_BIGNUM* n;
CYASSL_BIGNUM* e;
CYASSL_BIGNUM* d;
CYASSL_BIGNUM* p;
CYASSL_BIGNUM* q;
CYASSL_BIGNUM* dmp1; /* dP */
CYASSL_BIGNUM* dmq1; /* dQ */
CYASSL_BIGNUM* iqmp; /* u */
void* internal; /* our RSA */
2012-05-03 02:11:20 +04:00
char inSet; /* internal set from external ? */
char exSet; /* external set from internal ? */
2012-04-27 03:27:27 +04:00
};
2012-05-02 03:12:12 +04:00
CYASSL_API CYASSL_RSA* CyaSSL_RSA_new(void);
CYASSL_API void CyaSSL_RSA_free(CYASSL_RSA*);
CYASSL_API int CyaSSL_RSA_generate_key_ex(CYASSL_RSA*, int bits, CYASSL_BIGNUM*,
void* cb);
2012-04-27 03:27:27 +04:00
CYASSL_API int CyaSSL_RSA_blinding_on(CYASSL_RSA*, CYASSL_BN_CTX*);
CYASSL_API int CyaSSL_RSA_public_encrypt(int len, unsigned char* fr,
unsigned char* to, CYASSL_RSA*, int padding);
CYASSL_API int CyaSSL_RSA_private_decrypt(int len, unsigned char* fr,
unsigned char* to, CYASSL_RSA*, int padding);
2012-05-02 03:12:12 +04:00
CYASSL_API int CyaSSL_RSA_size(const CYASSL_RSA*);
CYASSL_API int CyaSSL_RSA_sign(int type, const unsigned char* m,
unsigned int mLen, unsigned char* sigRet,
unsigned int* sigLen, CYASSL_RSA*);
CYASSL_API int CyaSSL_RSA_public_decrypt(int flen, unsigned char* from,
unsigned char* to, CYASSL_RSA*, int padding);
CYASSL_API int CyaSSL_RSA_GenAdd(CYASSL_RSA*);
2012-05-08 03:35:23 +04:00
CYASSL_API int CyaSSL_RSA_LoadDer(CYASSL_RSA*, const unsigned char*, int sz);
2012-05-02 03:12:12 +04:00
#define RSA_new CyaSSL_RSA_new
#define RSA_free CyaSSL_RSA_free
#define RSA_generate_key_ex CyaSSL_RSA_generate_key_ex
2012-04-27 03:27:27 +04:00
#define RSA_blinding_on CyaSSL_RSA_blinding_on
#define RSA_public_encrypt CyaSSL_RSA_public_encrypt
#define RSA_private_decrypt CyaSSL_RSA_private_decrypt
2012-05-02 03:12:12 +04:00
#define RSA_size CyaSSL_RSA_size
#define RSA_sign CyaSSL_RSA_sign
#define RSA_public_decrypt CyaSSL_RSA_public_decrypt
2012-04-27 03:27:27 +04:00
#ifdef __cplusplus
} /* extern "C" */
#endif
2011-02-05 22:14:47 +03:00
#endif /* header */