mbed TLS v2.2.0
Data Structures | Macros | Functions

Detailed Description

CRYPTO hardware accelerated AES block cipher.

Collaboration diagram for AES block cipher:

Data Structures

struct  mbedtls_aes_context
 AES context structure. More...
 

Macros

#define MBEDTLS_AES_ENCRYPT   1
 
#define MBEDTLS_AES_DECRYPT   0
 
#define MBEDTLS_ERR_AES_NOT_SUPPORTED   ((int)MBEDTLS_ECODE_AESDRV_NOT_SUPPORTED)
 
#define MBEDTLS_ERR_AES_AUTHENTICATION_FAILED   ((int)MBEDTLS_ECODE_AESDRV_AUTHENTICATION_FAILED)
 
#define MBEDTLS_ERR_AES_OUT_OF_RESOURCES   ((int)MBEDTLS_ECODE_AESDRV_OUT_OF_RESOURCES)
 
#define MBEDTLS_ERR_AES_INVALID_PARAM   ((int)MBEDTLS_ECODE_AESDRV_INVALID_PARAM)
 

Functions

void mbedtls_aes_init (mbedtls_aes_context *ctx)
 Initialize AES context. More...
 
void mbedtls_aes_free (mbedtls_aes_context *ctx)
 Clear AES context. More...
 
int mbedtls_aes_setkey_enc (mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
 AES key schedule (encryption) More...
 
int mbedtls_aes_setkey_dec (mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
 AES key schedule (decryption) More...
 
int mbedtls_aes_crypt_ecb (mbedtls_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
 AES-ECB block encryption/decryption. More...
 
int mbedtls_aes_self_test (int verbose)
 Checkup routine. More...
 

Macro Definition Documentation

#define MBEDTLS_AES_DECRYPT   0

Definition at line 50 of file aes_alt.h.

#define MBEDTLS_AES_ENCRYPT   1

Definition at line 49 of file aes_alt.h.

#define MBEDTLS_ERR_AES_AUTHENTICATION_FAILED   ((int)MBEDTLS_ECODE_AESDRV_AUTHENTICATION_FAILED)

Definition at line 54 of file aes_alt.h.

#define MBEDTLS_ERR_AES_INVALID_PARAM   ((int)MBEDTLS_ECODE_AESDRV_INVALID_PARAM)

Definition at line 56 of file aes_alt.h.

#define MBEDTLS_ERR_AES_NOT_SUPPORTED   ((int)MBEDTLS_ECODE_AESDRV_NOT_SUPPORTED)

Definition at line 53 of file aes_alt.h.

#define MBEDTLS_ERR_AES_OUT_OF_RESOURCES   ((int)MBEDTLS_ECODE_AESDRV_OUT_OF_RESOURCES)

Definition at line 55 of file aes_alt.h.

Function Documentation

int mbedtls_aes_crypt_ecb ( mbedtls_aes_context ctx,
int  mode,
const unsigned char  input[16],
unsigned char  output[16] 
)

AES-ECB block encryption/decryption.

Parameters
ctxAES context
modeMBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
input16-byte input block
output16-byte output block
Returns
0 if successful
void mbedtls_aes_free ( mbedtls_aes_context ctx)

Clear AES context.

Parameters
ctxAES context to be cleared
void mbedtls_aes_init ( mbedtls_aes_context ctx)

Initialize AES context.

Parameters
ctxAES context to be initialized
int mbedtls_aes_self_test ( int  verbose)

Checkup routine.

Returns
0 if successful, or 1 if the test failed
int mbedtls_aes_setkey_dec ( mbedtls_aes_context ctx,
const unsigned char *  key,
unsigned int  keybits 
)

AES key schedule (decryption)

Parameters
ctxAES context to be initialized
keydecryption key
keybitsmust be 128, 192 or 256
Returns
0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
int mbedtls_aes_setkey_enc ( mbedtls_aes_context ctx,
const unsigned char *  key,
unsigned int  keybits 
)

AES key schedule (encryption)

Parameters
ctxAES context to be initialized
keyencryption key
keybitsmust be 128, 192 or 256
Returns
0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH