Go to the documentation of this file.
45 #if !defined(MBEDTLS_CONFIG_FILE)
48 #include MBEDTLS_CONFIG_FILE
55 #define MBEDTLS_AES_ENCRYPT 1
56 #define MBEDTLS_AES_DECRYPT 0
59 #define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020
60 #define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022
63 #define MBEDTLS_ERR_AES_BAD_INPUT_DATA -0x0021
66 #define MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE -0x0023
69 #define MBEDTLS_ERR_AES_HW_ACCEL_FAILED -0x0025
71 #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
72 !defined(inline) && !defined(__cplusplus)
73 #define inline __inline
80 #if !defined(MBEDTLS_AES_ALT)
102 #if defined(MBEDTLS_CIPHER_MODE_XTS)
138 #if defined(MBEDTLS_CIPHER_MODE_XTS)
175 unsigned int keybits );
193 unsigned int keybits );
195 #if defined(MBEDTLS_CIPHER_MODE_XTS)
213 const unsigned char *key,
214 unsigned int keybits );
233 const unsigned char *key,
234 unsigned int keybits );
262 const unsigned char input[16],
263 unsigned char output[16] );
265 #if defined(MBEDTLS_CIPHER_MODE_CBC)
310 unsigned char iv[16],
311 const unsigned char *input,
312 unsigned char *output );
315 #if defined(MBEDTLS_CIPHER_MODE_XTS)
354 const unsigned char data_unit[16],
355 const unsigned char *input,
356 unsigned char *output );
359 #if defined(MBEDTLS_CIPHER_MODE_CFB)
403 unsigned char iv[16],
404 const unsigned char *input,
405 unsigned char *output );
446 unsigned char iv[16],
447 const unsigned char *input,
448 unsigned char *output );
451 #if defined(MBEDTLS_CIPHER_MODE_OFB)
500 unsigned char iv[16],
501 const unsigned char *input,
502 unsigned char *output );
506 #if defined(MBEDTLS_CIPHER_MODE_CTR)
586 unsigned char nonce_counter[16],
587 unsigned char stream_block[16],
588 const unsigned char *input,
589 unsigned char *output );
604 const unsigned char input[16],
605 unsigned char output[16] );
619 const unsigned char input[16],
620 unsigned char output[16] );
622 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
623 #if defined(MBEDTLS_DEPRECATED_WARNING)
624 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
626 #define MBEDTLS_DEPRECATED
639 const unsigned char input[16],
640 unsigned char output[16] );
653 const unsigned char input[16],
654 unsigned char output[16] );
656 #undef MBEDTLS_DEPRECATED
660 #if defined(MBEDTLS_SELF_TEST)
mbedtls_aes_context tweak
int mbedtls_aes_self_test(int verbose)
Checkup routine.
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_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_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.
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_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.
The AES XTS context-type definition.
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...
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.
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.
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.
struct mbedtls_aes_xts_context mbedtls_aes_xts_context
The AES XTS context-type definition.
The AES context-type definition.
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.
mbedtls_aes_context crypt
void mbedtls_aes_free(mbedtls_aes_context *ctx)
This function releases and clears the specified AES context.
Configuration options (set of defines)
void mbedtls_aes_init(mbedtls_aes_context *ctx)
This function initializes the specified AES 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.
#define MBEDTLS_DEPRECATED
void mbedtls_aes_xts_init(mbedtls_aes_xts_context *ctx)
This function initializes the specified AES XTS context.
struct mbedtls_aes_context mbedtls_aes_context
The AES context-type definition.
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_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the encryption key.
void mbedtls_aes_xts_free(mbedtls_aes_xts_context *ctx)
This function releases and clears the specified AES XTS context.