41 # define AES_ENC_PREKEYED 44 # define AES_DEC_PREKEYED 47 # define AES_ENC_128_OTFK 50 # define AES_DEC_128_OTFK 53 # define AES_ENC_256_OTFK 56 # define AES_DEC_256_OTFK 61 #define N_BLOCK (N_ROW * N_COL) 62 #define N_MAX_ROUNDS 14 64 typedef uint8_t return_type;
70 typedef uint8_t length_type;
73 { uint8_t ksch[(N_MAX_ROUNDS + 1) * N_BLOCK];
85 #if defined( AES_ENC_PREKEYED ) || defined( AES_DEC_PREKEYED ) 101 #if defined( AES_ENC_PREKEYED ) 112 return_type
aes_encrypt(
const uint8_t in[N_BLOCK],
113 uint8_t out[N_BLOCK],
131 return_type aes_cbc_encrypt(
const uint8_t *in,
138 #if defined( AES_DEC_PREKEYED ) 149 return_type
aes_decrypt(
const uint8_t in[N_BLOCK],
150 uint8_t out[N_BLOCK],
168 return_type aes_cbc_decrypt(
const uint8_t *in,
195 #if defined( AES_ENC_128_OTFK ) 196 void aes_encrypt_128(
const uint8_t in[N_BLOCK],
197 uint8_t out[N_BLOCK],
198 const uint8_t key[N_BLOCK],
199 uint8_t o_key[N_BLOCK] );
202 #if defined( AES_DEC_128_OTFK ) 203 void aes_decrypt_128(
const uint8_t in[N_BLOCK],
204 uint8_t out[N_BLOCK],
205 const uint8_t key[N_BLOCK],
206 uint8_t o_key[N_BLOCK] );
209 #if defined( AES_ENC_256_OTFK ) 210 void aes_encrypt_256(
const uint8_t in[N_BLOCK],
211 uint8_t out[N_BLOCK],
212 const uint8_t key[2 * N_BLOCK],
213 uint8_t o_key[2 * N_BLOCK] );
216 #if defined( AES_DEC_256_OTFK ) 217 void aes_decrypt_256(
const uint8_t in[N_BLOCK],
218 uint8_t out[N_BLOCK],
219 const uint8_t key[2 * N_BLOCK],
220 uint8_t o_key[2 * N_BLOCK] );
return_type aes_encrypt_all(const uint8_t *in, uint8_t *out, uint32_t len, const aes_context ctx[1])
Encrypts a buffer of n x 16 bytes.
Definition: aes.c:599
return_type aes_encrypt(const uint8_t in[N_BLOCK], uint8_t out[N_BLOCK], const aes_context ctx[1])
Encrypts a single block of 16 bytes.
Definition: aes.c:572
return_type aes_decrypt(const uint8_t in[N_BLOCK], uint8_t out[N_BLOCK], const aes_context ctx[1])
Decrypts a single block of 16 bytes.
Definition: aes.c:643
return_type aes_set_key(const uint8_t key[], length_type keylen, aes_context ctx[1])
Sets the key for AES encryption/decryption.
Definition: aes.c:517
return_type aes_decrypt_all(const uint8_t *in, uint8_t *out, uint32_t len, const aes_context ctx[1])
Decrypts a buffer of n x 16 bytes.
Definition: aes.c:670