70#if !defined(MBEDTLS_CONFIG_FILE)
73#include MBEDTLS_CONFIG_FILE
80#define MBEDTLS_AES_ENCRYPT 1
81#define MBEDTLS_AES_DECRYPT 0
84#define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020
85#define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022
88#define MBEDTLS_ERR_AES_BAD_INPUT_DATA -0x0021
91#define MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE -0x0023
94#define MBEDTLS_ERR_AES_HW_ACCEL_FAILED -0x0025
96#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
97 !defined(inline) && !defined(__cplusplus)
98#define inline __inline
105#if !defined(MBEDTLS_AES_ALT)
127#if defined(MBEDTLS_CIPHER_MODE_XTS)
163#if defined(MBEDTLS_CIPHER_MODE_XTS)
200 unsigned int keybits );
218 unsigned int keybits );
220#if defined(MBEDTLS_CIPHER_MODE_XTS)
238 const unsigned char *
key,
239 unsigned int keybits );
258 const unsigned char *
key,
259 unsigned int keybits );
287 const unsigned char input[16],
288 unsigned char output[16] );
290#if defined(MBEDTLS_CIPHER_MODE_CBC)
335 unsigned char iv[16],
336 const unsigned char *
input,
337 unsigned char *output );
340#if defined(MBEDTLS_CIPHER_MODE_XTS)
379 const unsigned char data_unit[16],
380 const unsigned char *
input,
381 unsigned char *output );
384#if defined(MBEDTLS_CIPHER_MODE_CFB)
428 unsigned char iv[16],
429 const unsigned char *
input,
430 unsigned char *output );
471 unsigned char iv[16],
472 const unsigned char *
input,
473 unsigned char *output );
476#if defined(MBEDTLS_CIPHER_MODE_OFB)
525 unsigned char iv[16],
526 const unsigned char *
input,
527 unsigned char *output );
531#if defined(MBEDTLS_CIPHER_MODE_CTR)
611 unsigned char nonce_counter[16],
612 unsigned char stream_block[16],
613 const unsigned char *
input,
614 unsigned char *output );
629 const unsigned char input[16],
630 unsigned char output[16] );
644 const unsigned char input[16],
645 unsigned char output[16] );
647#if !defined(MBEDTLS_DEPRECATED_REMOVED)
648#if defined(MBEDTLS_DEPRECATED_WARNING)
649#define MBEDTLS_DEPRECATED __attribute__((deprecated))
651#define MBEDTLS_DEPRECATED
664 const unsigned char input[16],
665 unsigned char output[16] );
678 const unsigned char input[16],
679 unsigned char output[16] );
681#undef MBEDTLS_DEPRECATED
685#if defined(MBEDTLS_SELF_TEST)
692int mbedtls_aes_self_test(
int verbose );
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.
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...
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.
#define MBEDTLS_DEPRECATED
MBEDTLS_DEPRECATED 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.
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.
MBEDTLS_DEPRECATED 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_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.
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLenum GLenum GLenum input
The AES context-type definition.
The AES XTS context-type definition.
mbedtls_aes_context crypt
mbedtls_aes_context tweak