72 #if !defined(MBEDTLS_CONFIG_FILE) 75 #include MBEDTLS_CONFIG_FILE 82 #define MBEDTLS_AES_ENCRYPT 1 83 #define MBEDTLS_AES_DECRYPT 0 86 #define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH -0x0020 87 #define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH -0x0022 90 #define MBEDTLS_ERR_AES_BAD_INPUT_DATA -0x0021 93 #define MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE -0x0023 96 #define MBEDTLS_ERR_AES_HW_ACCEL_FAILED -0x0025 98 #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \ 99 !defined(inline) && !defined(__cplusplus) 100 #define inline __inline 107 #if !defined(MBEDTLS_AES_ALT) 129 #if defined(MBEDTLS_CIPHER_MODE_XTS) 165 #if defined(MBEDTLS_CIPHER_MODE_XTS) 202 unsigned int keybits );
220 unsigned int keybits );
222 #if defined(MBEDTLS_CIPHER_MODE_XTS) 240 const unsigned char *key,
241 unsigned int keybits );
260 const unsigned char *key,
261 unsigned int keybits );
289 const unsigned char input[16],
290 unsigned char output[16] );
292 #if defined(MBEDTLS_CIPHER_MODE_CBC) 337 unsigned char iv[16],
338 const unsigned char *input,
339 unsigned char *output );
342 #if defined(MBEDTLS_CIPHER_MODE_XTS) 381 const unsigned char data_unit[16],
382 const unsigned char *input,
383 unsigned char *output );
386 #if defined(MBEDTLS_CIPHER_MODE_CFB) 430 unsigned char iv[16],
431 const unsigned char *input,
432 unsigned char *output );
473 unsigned char iv[16],
474 const unsigned char *input,
475 unsigned char *output );
478 #if defined(MBEDTLS_CIPHER_MODE_OFB) 527 unsigned char iv[16],
528 const unsigned char *input,
529 unsigned char *output );
533 #if defined(MBEDTLS_CIPHER_MODE_CTR) 613 unsigned char nonce_counter[16],
614 unsigned char stream_block[16],
615 const unsigned char *input,
616 unsigned char *output );
631 const unsigned char input[16],
632 unsigned char output[16] );
646 const unsigned char input[16],
647 unsigned char output[16] );
649 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 650 #if defined(MBEDTLS_DEPRECATED_WARNING) 651 #define MBEDTLS_DEPRECATED __attribute__((deprecated)) 653 #define MBEDTLS_DEPRECATED 666 const unsigned char input[16],
667 unsigned char output[16] );
680 const unsigned char input[16],
681 unsigned char output[16] );
683 #undef MBEDTLS_DEPRECATED 687 #if defined(MBEDTLS_SELF_TEST)
mbedtls_aes_context crypt
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_self_test(int verbose)
Checkup routine.
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_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. ...
#define MBEDTLS_DEPRECATED
Configuration options (set of defines)
void mbedtls_aes_init(mbedtls_aes_context *ctx)
This function initializes the specified AES context.
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_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...
void mbedtls_aes_xts_init(mbedtls_aes_xts_context *ctx)
This function initializes the specified AES XTS context.
The AES XTS context-type definition.
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_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_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_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
This function sets the decryption key.
void mbedtls_aes_xts_free(mbedtls_aes_xts_context *ctx)
This function releases and clears the specified AES XTS context.
mbedtls_aes_context tweak
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_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_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_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.
The AES context-type definition.
struct mbedtls_aes_xts_context mbedtls_aes_xts_context
The AES XTS context-type definition.
struct mbedtls_aes_context mbedtls_aes_context
The AES context-type definition.
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...
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.