43#if !defined(MBEDTLS_CONFIG_FILE)
46#include MBEDTLS_CONFIG_FILE
60#define MBEDTLS_AES_ENCRYPT 1
61#define MBEDTLS_AES_DECRYPT 0
64#define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020
65#define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022
68#define MBEDTLS_ERR_AES_BAD_INPUT_DATA -0x0021
71#define MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE -0x0023
74#define MBEDTLS_ERR_AES_HW_ACCEL_FAILED -0x0025
76#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
77 !defined(inline) && !defined(__cplusplus)
78#define inline __inline
85#if !defined(MBEDTLS_AES_ALT)
107#if defined(MBEDTLS_CIPHER_MODE_XTS)
111typedef struct mbedtls_aes_xts_context
117} mbedtls_aes_xts_context;
143#if defined(MBEDTLS_CIPHER_MODE_XTS)
152void mbedtls_aes_xts_init( mbedtls_aes_xts_context *ctx );
161void mbedtls_aes_xts_free( mbedtls_aes_xts_context *ctx );
180 unsigned int keybits );
198 unsigned int keybits );
200#if defined(MBEDTLS_CIPHER_MODE_XTS)
217int mbedtls_aes_xts_setkey_enc( mbedtls_aes_xts_context *ctx,
218 const unsigned char *key,
219 unsigned int keybits );
237int mbedtls_aes_xts_setkey_dec( mbedtls_aes_xts_context *ctx,
238 const unsigned char *key,
239 unsigned int keybits );
267 const unsigned char input[16],
268 unsigned char output[16] );
270#if defined(MBEDTLS_CIPHER_MODE_CBC)
315 unsigned char iv[16],
316 const unsigned char *input,
317 unsigned char *output );
320#if defined(MBEDTLS_CIPHER_MODE_XTS)
356int mbedtls_aes_crypt_xts( mbedtls_aes_xts_context *ctx,
359 const unsigned char data_unit[16],
360 const unsigned char *input,
361 unsigned char *output );
364#if defined(MBEDTLS_CIPHER_MODE_CFB)
408 unsigned char iv[16],
409 const unsigned char *input,
410 unsigned char *output );
451 unsigned char iv[16],
452 const unsigned char *input,
453 unsigned char *output );
456#if defined(MBEDTLS_CIPHER_MODE_OFB)
505 unsigned char iv[16],
506 const unsigned char *input,
507 unsigned char *output );
511#if defined(MBEDTLS_CIPHER_MODE_CTR)
591 unsigned char nonce_counter[16],
592 unsigned char stream_block[16],
593 const unsigned char *input,
594 unsigned char *output );
609 const unsigned char input[16],
610 unsigned char output[16] );
624 const unsigned char input[16],
625 unsigned char output[16] );
627#if !defined(MBEDTLS_DEPRECATED_REMOVED)
628#if defined(MBEDTLS_DEPRECATED_WARNING)
629#define MBEDTLS_DEPRECATED __attribute__((deprecated))
631#define MBEDTLS_DEPRECATED
644 const unsigned char input[16],
645 unsigned char output[16] );
658 const unsigned char input[16],
659 unsigned char output[16] );
661#undef MBEDTLS_DEPRECATED
667#if defined(MBEDTLS_SELF_TEST)
674int mbedtls_aes_self_test(
int verbose );
Configuration options (set of defines)
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_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.
void mbedtls_aes_encrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Deprecated internal AES block encryption function without return value.
int mbedtls_internal_aes_encrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Internal AES block encryption function.
void mbedtls_aes_init(mbedtls_aes_context *ctx)
This function initializes the specified AES context.
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.
void mbedtls_aes_decrypt(mbedtls_aes_context *ctx, const unsigned char input[16], unsigned char output[16])
Deprecated internal AES block decryption function without return value.
The AES context-type definition.