39#define MBEDTLS_AES_ENCRYPT 1
40#define MBEDTLS_AES_DECRYPT 0
44#define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020
46#define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022
50#define MBEDTLS_ERR_AES_BAD_INPUT_DATA -0x0021
56#if !defined(MBEDTLS_AES_ALT)
67#if defined(MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH) && !defined(MBEDTLS_PADLOCK_C)
83#if defined(MBEDTLS_CIPHER_MODE_XTS)
118#if defined(MBEDTLS_CIPHER_MODE_XTS)
156 unsigned int keybits);
175 unsigned int keybits);
177#if defined(MBEDTLS_CIPHER_MODE_XTS)
196 const unsigned char *key,
197 unsigned int keybits);
217 const unsigned char *key,
218 unsigned int keybits);
247 const unsigned char input[16],
248 unsigned char output[16]);
250#if defined(MBEDTLS_CIPHER_MODE_CBC)
296 unsigned char iv[16],
297 const unsigned char *input,
298 unsigned char *output);
301#if defined(MBEDTLS_CIPHER_MODE_XTS)
341 const unsigned char data_unit[16],
342 const unsigned char *input,
343 unsigned char *output);
346#if defined(MBEDTLS_CIPHER_MODE_CFB)
391 unsigned char iv[16],
392 const unsigned char *input,
393 unsigned char *output);
435 unsigned char iv[16],
436 const unsigned char *input,
437 unsigned char *output);
440#if defined(MBEDTLS_CIPHER_MODE_OFB)
490 unsigned char iv[16],
491 const unsigned char *input,
492 unsigned char *output);
496#if defined(MBEDTLS_CIPHER_MODE_CTR)
573 unsigned char nonce_counter[16],
574 unsigned char stream_block[16],
575 const unsigned char *input,
576 unsigned char *output);
592 const unsigned char input[16],
593 unsigned char output[16]);
608 const unsigned char input[16],
609 unsigned char output[16]);
611#if defined(MBEDTLS_SELF_TEST)
int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
This function performs an AES single-block encryption or decryption operation.
int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the decryption key.
int mbedtls_aes_self_test(int verbose)
Checkup routine.
void mbedtls_aes_xts_init(mbedtls_aes_xts_context *ctx)
This function initializes the specified AES XTS context.
int mbedtls_aes_crypt_ofb(mbedtls_aes_context *ctx, size_t length, size_t *iv_off, unsigned char iv[16], const unsigned char *input, unsigned char *output)
This function performs an AES-OFB (Output Feedback Mode) encryption or decryption operation.
int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx, int mode, size_t length, unsigned char iv[16], const unsigned char *input, unsigned char *output)
This function performs an AES-CBC encryption or decryption operation on full blocks.
int mbedtls_aes_crypt_ctr(mbedtls_aes_context *ctx, size_t length, size_t *nc_off, unsigned char nonce_counter[16], unsigned char stream_block[16], const unsigned char *input, unsigned char *output)
This function performs an AES-CTR encryption or decryption operation.
int mbedtls_aes_xts_setkey_dec(mbedtls_aes_xts_context *ctx, const unsigned char *key, unsigned int keybits)
This function prepares an XTS context for decryption and sets the decryption key.
int mbedtls_aes_crypt_xts(mbedtls_aes_xts_context *ctx, int mode, size_t length, const unsigned char data_unit[16], const unsigned char *input, unsigned char *output)
This function performs an AES-XTS encryption or decryption operation for an entire XTS data unit.
int mbedtls_internal_aes_encrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Internal AES block encryption function. This is only exposed to allow overriding it using MBEDTLS_AES...
struct mbedtls_aes_xts_context mbedtls_aes_xts_context
The AES XTS context-type definition.
void mbedtls_aes_xts_free(mbedtls_aes_xts_context *ctx)
This function releases and clears the specified AES XTS context.
int mbedtls_aes_crypt_cfb128(mbedtls_aes_context *ctx, int mode, size_t length, size_t *iv_off, unsigned char iv[16], const unsigned char *input, unsigned char *output)
This function performs an AES-CFB128 encryption or decryption operation.
int mbedtls_aes_crypt_cfb8(mbedtls_aes_context *ctx, int mode, size_t length, unsigned char iv[16], const unsigned char *input, unsigned char *output)
This function performs an AES-CFB8 encryption or decryption operation.
void mbedtls_aes_init(mbedtls_aes_context *ctx)
This function initializes the specified AES context.
struct mbedtls_aes_context mbedtls_aes_context
The AES context-type definition.
int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the encryption key.
void mbedtls_aes_free(mbedtls_aes_context *ctx)
This function releases and clears the specified AES context.
int mbedtls_internal_aes_decrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Internal AES block decryption function. This is only exposed to allow overriding it using see MBEDTLS...
int mbedtls_aes_xts_setkey_enc(mbedtls_aes_xts_context *ctx, const unsigned char *key, unsigned int keybits)
This function prepares an XTS context for encryption and sets the encryption key.
Build-time configuration info.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
The AES context-type definition.
The AES XTS context-type definition.