mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
- Changed interface for AES and Camellia setkey functions to indicate invalid key lengths.
This commit is contained in:
parent
33768bf19b
commit
2b222c830b
9 changed files with 182 additions and 129 deletions
|
|
@ -25,6 +25,8 @@
|
|||
#define AES_ENCRYPT 1
|
||||
#define AES_DECRYPT 0
|
||||
|
||||
#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH 0x0800
|
||||
|
||||
/**
|
||||
* \brief AES context structure
|
||||
*/
|
||||
|
|
@ -46,8 +48,10 @@ extern "C" {
|
|||
* \param ctx AES context to be initialized
|
||||
* \param key encryption key
|
||||
* \param keysize must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
|
||||
*/
|
||||
void aes_setkey_enc( aes_context *ctx, unsigned char *key, int keysize );
|
||||
int aes_setkey_enc( aes_context *ctx, unsigned char *key, int keysize );
|
||||
|
||||
/**
|
||||
* \brief AES key schedule (decryption)
|
||||
|
|
@ -55,8 +59,10 @@ void aes_setkey_enc( aes_context *ctx, unsigned char *key, int keysize );
|
|||
* \param ctx AES context to be initialized
|
||||
* \param key decryption key
|
||||
* \param keysize must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_AES_INVALID_KEY_LENGTH
|
||||
*/
|
||||
void aes_setkey_dec( aes_context *ctx, unsigned char *key, int keysize );
|
||||
int aes_setkey_dec( aes_context *ctx, unsigned char *key, int keysize );
|
||||
|
||||
/**
|
||||
* \brief AES-ECB block encryption/decryption
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ typedef UINT32 uint32_t;
|
|||
#define CAMELLIA_ENCRYPT 1
|
||||
#define CAMELLIA_DECRYPT 0
|
||||
|
||||
#define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH 0x0a00
|
||||
|
||||
/**
|
||||
* \brief CAMELLIA context structure
|
||||
*/
|
||||
|
|
@ -50,8 +52,10 @@ extern "C" {
|
|||
* \param ctx CAMELLIA context to be initialized
|
||||
* \param key encryption key
|
||||
* \param keysize must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH
|
||||
*/
|
||||
void camellia_setkey_enc( camellia_context *ctx, unsigned char *key, int keysize );
|
||||
int camellia_setkey_enc( camellia_context *ctx, unsigned char *key, int keysize );
|
||||
|
||||
/**
|
||||
* \brief CAMELLIA key schedule (decryption)
|
||||
|
|
@ -59,8 +63,10 @@ void camellia_setkey_enc( camellia_context *ctx, unsigned char *key, int keysize
|
|||
* \param ctx CAMELLIA context to be initialized
|
||||
* \param key decryption key
|
||||
* \param keysize must be 128, 192 or 256
|
||||
*
|
||||
* \return 0 if successful, or POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH
|
||||
*/
|
||||
void camellia_setkey_dec( camellia_context *ctx, unsigned char *key, int keysize );
|
||||
int camellia_setkey_dec( camellia_context *ctx, unsigned char *key, int keysize );
|
||||
|
||||
/**
|
||||
* \brief CAMELLIA-ECB block encryption/decryption
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue