30#define AES_BLOCKLEN 16
32#if defined(AES256) && (AES256 == 1)
34 #define AES_keyExpSize 240
35#elif defined(AES192) && (AES192 == 1)
37 #define AES_keyExpSize 208
40 #define AES_keyExpSize 176
45 uint8_t RoundKey[AES_keyExpSize];
46#if (defined(CBC) && (CBC == 1)) || (defined(CTR) && (CTR == 1))
47 uint8_t Iv[AES_BLOCKLEN];
51void AES_init_ctx(
struct AES_ctx* ctx,
const uint8_t* key);
52#if (defined(CBC) && (CBC == 1)) || (defined(CTR) && (CTR == 1))
53void AES_init_ctx_iv(
struct AES_ctx* ctx,
const uint8_t* key,
const uint8_t* iv);
54void AES_ctx_set_iv(
struct AES_ctx* ctx,
const uint8_t* iv);
57#if defined(ECB) && (ECB == 1)
61void AES_ECB_encrypt(
const struct AES_ctx* ctx, uint8_t* buf);
62void AES_ECB_decrypt(
const struct AES_ctx* ctx, uint8_t* buf);
67#if defined(CBC) && (CBC == 1)
72void AES_CBC_encrypt_buffer(
struct AES_ctx* ctx, uint8_t* buf, uint32_t length);
73void AES_CBC_decrypt_buffer(
struct AES_ctx* ctx, uint8_t* buf, uint32_t length);
78#if defined(CTR) && (CTR == 1)
85void AES_CTR_xcrypt_buffer(
struct AES_ctx* ctx, uint8_t* buf, uint32_t length);