30 #ifndef POLARSSL_OPENSSL_H 31 #define POLARSSL_OPENSSL_H 39 #define AES_BLOCK_SIZE 16 40 #define AES_KEY aes_context 41 #define MD5_CTX md5_context 42 #define SHA_CTX sha1_context 44 #define SHA1_Init( CTX ) \ 46 #define SHA1_Update( CTX, BUF, LEN ) \ 47 sha1_update( (CTX), (unsigned char *)(BUF), (LEN) ) 48 #define SHA1_Final( OUT, CTX ) \ 49 sha1_finish( (CTX), (OUT) ) 51 #define MD5_Init( CTX ) \ 53 #define MD5_Update( CTX, BUF, LEN ) \ 54 md5_update( (CTX), (unsigned char *)(BUF), (LEN) ) 55 #define MD5_Final( OUT, CTX ) \ 56 md5_finish( (CTX), (OUT) ) 58 #define AES_set_encrypt_key( KEY, KEYSIZE, CTX ) \ 59 aes_setkey_enc( (CTX), (KEY), (KEYSIZE) ) 60 #define AES_set_decrypt_key( KEY, KEYSIZE, CTX ) \ 61 aes_setkey_dec( (CTX), (KEY), (KEYSIZE) ) 62 #define AES_cbc_encrypt( INPUT, OUTPUT, LEN, CTX, IV, MODE ) \ 63 aes_crypt_cbc( (CTX), (MODE), (LEN), (IV), (INPUT), (OUTPUT) ) 74 memcpy( output, input, size );
81 unsigned char *buffer = *(
unsigned char **) bufptr;
92 if( ignore != 0 || ( len != 94 && len != 162 ) )
122 #define RSA rsa_context 123 #define RSA_PKCS1_PADDING 1 124 #define RSA_size( CTX ) (CTX)->len 125 #define RSA_free( CTX ) rsa_free( CTX ) 126 #define ERR_get_error( ) "ERR_get_error() not supported" 127 #define RSA_blinding_off( IGNORE ) 129 #define d2i_RSAPrivateKey( a, b, c ) new rsa_context rsa_context * d2i_RSA_PUBKEY(void *ignore, unsigned char **bufptr, int len)
int RSA_public_encrypt(int size, unsigned char *input, unsigned char *output, RSA *key, int ignore)
int rsa_pkcs1_decrypt(rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, size_t *olen, const unsigned char *input, unsigned char *output, size_t output_max_len)
Generic wrapper to perform a PKCS#1 decryption using the mode from the context.
int RSA_public_decrypt(int size, unsigned char *input, unsigned char *output, RSA *key, int ignore)
int __RSA_Passthrough(void *output, void *input, int size)
int rsa_pkcs1_encrypt(rsa_context *ctx, int(*f_rng)(void *, unsigned char *, size_t), void *p_rng, int mode, size_t ilen, const unsigned char *input, unsigned char *output)
Generic wrapper to perform a PKCS#1 encryption using the mode from the context.
int RSA_private_decrypt(int size, unsigned char *input, unsigned char *output, RSA *key, int ignore)
size_t mpi_msb(const mpi *X)
Return the number of bits up to and including the most significant '1' bit'.
int mpi_read_binary(mpi *X, const unsigned char *buf, size_t buflen)
Import X from unsigned binary data, big endian.
The RSA public-key cryptosystem.
SHA-1 cryptographic hash function.
int RSA_private_encrypt(int size, unsigned char *input, unsigned char *output, RSA *key, int ignore)
MD5 message digest algorithm (hash function)