wolfssl/cyassl/openssl/rsa.h

73 lines
2.0 KiB
C
Raw Normal View History

2011-02-05 13:14:47 -06:00
/* rsa.h for openSSL */
#ifndef CYASSL_RSA_H_
#define CYASSL_RSA_H_
2012-04-26 18:27:27 -05:00
#include <cyassl/openssl/ssl.h>
#include <cyassl/openssl/bn.h>
2011-02-05 13:14:47 -06:00
2012-04-26 18:27:27 -05:00
#ifdef __cplusplus
extern "C" {
#endif
enum {
RSA_PKCS1_PADDING = 1
};
struct CYASSL_RSA {
2012-05-01 18:12:12 -05: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-04-26 18:27:27 -05:00
};
2012-05-01 18:12:12 -05: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-26 18:27:27 -05: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-01 18:12:12 -05: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*);
#define RSA_new CyaSSL_RSA_new
#define RSA_free CyaSSL_RSA_free
#define RSA_generate_key_ex CyaSSL_RSA_generate_key_ex
2012-04-26 18:27:27 -05: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-01 18:12:12 -05:00
#define RSA_size CyaSSL_RSA_size
#define RSA_sign CyaSSL_RSA_sign
#define RSA_public_decrypt CyaSSL_RSA_public_decrypt
2012-04-26 18:27:27 -05:00
#ifdef __cplusplus
} /* extern "C" */
#endif
2011-02-05 13:14:47 -06:00
#endif /* header */