1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

- Fixed cipher interface for encrypt/decrypt functions

This commit is contained in:
Paul Bakker
2010-03-18 21:21:02 +00:00
parent 4fc45522f1
commit f3ccc68100
21 changed files with 286 additions and 170 deletions

View File

@@ -27,6 +27,7 @@
#define AES_DECRYPT 0
#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0800
#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0810
/**
* \brief AES context structure
@@ -72,8 +73,10 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key, int keysize );
* \param mode AES_ENCRYPT or AES_DECRYPT
* \param input 16-byte input block
* \param output 16-byte output block
*
* \return 0
*/
void aes_crypt_ecb( aes_context *ctx,
int aes_crypt_ecb( aes_context *ctx,
int mode,
const unsigned char input[16],
unsigned char output[16] );
@@ -89,8 +92,10 @@ void aes_crypt_ecb( aes_context *ctx,
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_INPUT_LENGTH
*/
void aes_crypt_cbc( aes_context *ctx,
int aes_crypt_cbc( aes_context *ctx,
int mode,
int length,
unsigned char iv[16],
@@ -107,8 +112,10 @@ void aes_crypt_cbc( aes_context *ctx,
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
* \return 0
*/
void aes_crypt_cfb128( aes_context *ctx,
int aes_crypt_cfb128( aes_context *ctx,
int mode,
int length,
int *iv_off,

View File

@@ -53,8 +53,10 @@ void arc4_setup( arc4_context *ctx, const unsigned char *key, int keylen );
* \param ctx ARC4 context
* \param buf buffer to be processed
* \param buflen amount of data in buf
*
* \return 0
*/
void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen );
int arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen );
/*
* \brief Checkup routine

View File

@@ -32,6 +32,7 @@ typedef UINT32 uint32_t;
#define CAMELLIA_DECRYPT 0
#define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0a00
#define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0a10
/**
* \brief CAMELLIA context structure
@@ -76,8 +77,10 @@ int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key, int ke
* \param mode CAMELLIA_ENCRYPT or CAMELLIA_DECRYPT
* \param input 16-byte input block
* \param output 16-byte output block
*
* \return 0
*/
void camellia_crypt_ecb( camellia_context *ctx,
int camellia_crypt_ecb( camellia_context *ctx,
int mode,
const unsigned char input[16],
unsigned char output[16] );
@@ -93,8 +96,10 @@ void camellia_crypt_ecb( camellia_context *ctx,
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
* \return 0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH
*/
void camellia_crypt_cbc( camellia_context *ctx,
int camellia_crypt_cbc( camellia_context *ctx,
int mode,
int length,
unsigned char iv[16],
@@ -111,8 +116,10 @@ void camellia_crypt_cbc( camellia_context *ctx,
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
* \return 0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH
*/
void camellia_crypt_cfb128( camellia_context *ctx,
int camellia_crypt_cfb128( camellia_context *ctx,
int mode,
int length,
int *iv_off,

View File

@@ -26,6 +26,8 @@
#define DES_ENCRYPT 1
#define DES_DECRYPT 0
#define POLARSSL_ERR_DES_INVALID_INPUT_LENGTH -0x0C00
/**
* \brief DES context structure
*/
@@ -104,8 +106,10 @@ void des3_set3key_dec( des3_context *ctx, const unsigned char key[24] );
* \param ctx DES context
* \param input 64-bit input block
* \param output 64-bit output block
*
* \return 0
*/
void des_crypt_ecb( des_context *ctx,
int des_crypt_ecb( des_context *ctx,
const unsigned char input[8],
unsigned char output[8] );
@@ -119,7 +123,7 @@ void des_crypt_ecb( des_context *ctx,
* \param input buffer holding the input data
* \param output buffer holding the output data
*/
void des_crypt_cbc( des_context *ctx,
int des_crypt_cbc( des_context *ctx,
int mode,
int length,
unsigned char iv[8],
@@ -132,8 +136,10 @@ void des_crypt_cbc( des_context *ctx,
* \param ctx 3DES context
* \param input 64-bit input block
* \param output 64-bit output block
*
* \return 0
*/
void des3_crypt_ecb( des3_context *ctx,
int des3_crypt_ecb( des3_context *ctx,
const unsigned char input[8],
unsigned char output[8] );
@@ -146,8 +152,10 @@ void des3_crypt_ecb( des3_context *ctx,
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
* \return 0 if successful, or POLARSSL_ERR_DES_INVALID_INPUT_LENGTH
*/
void des3_crypt_cbc( des3_context *ctx,
int des3_crypt_cbc( des3_context *ctx,
int mode,
int length,
unsigned char iv[8],

View File

@@ -38,6 +38,8 @@
#define PADLOCK_ALIGN16(x) (unsigned long *) (16 + ((long) x & ~15))
#define POLARSSL_ERR_PADLOCK_DATA_MISALIGNED -0x08E0
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -60,8 +60,10 @@ void xtea_setup( xtea_context *ctx, unsigned char key[16] );
* \param mode XTEA_ENCRYPT or XTEA_DECRYPT
* \param input 8-byte input block
* \param output 8-byte output block
*
* \return 0
*/
void xtea_crypt_ecb( xtea_context *ctx,
int xtea_crypt_ecb( xtea_context *ctx,
int mode,
unsigned char input[8],
unsigned char output[8] );