AES
[Symmetric Ciphers]

Defines

#define C4E_AES128_CTX_SIZE
#define C4E_AES192_CTX_SIZE
#define C4E_AES256_CTX_SIZE
#define C4E_AES_MAX_CTX_SIZE
#define C4E_AES128_KEY_SIZE
#define C4E_AES192_KEY_SIZE
#define C4E_AES256_KEY_SIZE
#define C4E_AES_BLOCK_SIZE

Typedefs

typedef C4eArchUint8 C4eAesState
 AES state element.

Functions

void c4e_aes_setup (C4eCipherId algo, C4E_CONST C4eArchUint8 *key, C4eAesState *ctx)
 KeyExpansion primitive according to FIPS 197, 5.2
void c4e_aes_encrypt (C4eCipherId algo, C4eAesState *C4E_RESTRICT ctx, C4E_CONST C4eArchUint8 *C4E_RESTRICT plain, C4eArchUint8 *C4E_RESTRICT cipher)
 AES encryption algorithm according to FIPS 197.
void c4e_aes_decrypt (C4eCipherId algo, C4eAesState *C4E_RESTRICT ctx, C4E_CONST C4eArchUint8 *C4E_RESTRICT cipher, C4eArchUint8 *C4E_RESTRICT plain)
 AES decryption algorithm according to FIPS 197.

Define Documentation

#define C4E_AES128_CTX_SIZE

AES-128 context size in C4eAesState elements.

Definition at line 66 of file c4e_aes.h.

#define C4E_AES192_CTX_SIZE

AES-192 context size in C4eAesState elements.

Definition at line 71 of file c4e_aes.h.

#define C4E_AES256_CTX_SIZE

AES-256 context size in C4eAesState elements.

Definition at line 76 of file c4e_aes.h.

#define C4E_AES_MAX_CTX_SIZE

Maximum size of an AES context.

Definition at line 81 of file c4e_aes.h.

#define C4E_AES128_KEY_SIZE

AES-128 key size in bytes.

Definition at line 84 of file c4e_aes.h.

#define C4E_AES192_KEY_SIZE

AES-192 key size in bytes.

Definition at line 85 of file c4e_aes.h.

#define C4E_AES256_KEY_SIZE

AES-256 key size in bytes.

Definition at line 86 of file c4e_aes.h.

#define C4E_AES_BLOCK_SIZE

AES block size in bytes.

Definition at line 89 of file c4e_aes.h.


Typedef Documentation

AES state element.

This type corresponds to AES state element $ s_{r,c} $ with 32-bit width. Without a 32-bit data type available this type holds $ s_{0,c},\dots,s_{4,c} $, with $ s_{4,c} $ in the least significant byte and $ s_{0,c} $ in the most significant byte.

Definition at line 107 of file c4e_aes.h.


Function Documentation

void c4e_aes_setup ( C4eCipherId  algo,
C4E_CONST C4eArchUint8 key,
C4eAesState ctx 
)

KeyExpansion primitive according to FIPS 197, 5.2

Parameters:
[in] algo AES algorithm type (with respect to key length)
[in] key Key, with implicit length:

[out] ctx Context to be supplied to c4e_aes_encrypt() or c4e_aes_decrypt().
See also:
C4E_AES128_CTX_SIZE, C4E_AES192_CTX_SIZE, C4E_AES256_CTX_SIZE, C4E_AES_MAX_CTX_SIZE
void c4e_aes_encrypt ( C4eCipherId  algo,
C4eAesState *C4E_RESTRICT  ctx,
C4E_CONST C4eArchUint8 *C4E_RESTRICT  plain,
C4eArchUint8 *C4E_RESTRICT  cipher 
)

AES encryption algorithm according to FIPS 197.

Precondition:
c4e_aes_setup()
Bibliography:
Advanced Encryption Standard (AES). FIPS Publication 197, National Institute of Standards and Technology, 2001.
Parameters:
[in] algo One of the AES algorithm identifiers.
[in,out] ctx Context as prepared by c4e_aes_setup()
[in] plain Pointer to plaintext block of C4E_AES_BLOCK_SIZE bytes
[out] cipher Pointer to memory buffer of C4E_AES_BLOCK_SIZE bytes, which gets the ciphertext block.
void c4e_aes_decrypt ( C4eCipherId  algo,
C4eAesState *C4E_RESTRICT  ctx,
C4E_CONST C4eArchUint8 *C4E_RESTRICT  cipher,
C4eArchUint8 *C4E_RESTRICT  plain 
)

AES decryption algorithm according to FIPS 197.

Precondition:
c4e_aes_setup()
Bibliography:
Advanced Encryption Standard (AES). FIPS Publication 197, National Institute of Standards and Technology, 2001.
Parameters:
[in] algo One of the AES algorithm identifiers.
[in,out] ctx Context as prepared by c4e_aes_setup()
[in] cipher Pointer to ciphertext block of C4E_AES_BLOCK_SIZE bytes
[out] plain Pointer to memory buffer of C4E_AES_BLOCK_SIZE bytes, which gets the plaintext block.