35# define AES_ENC_PREKEYED
38# define AES_DEC_PREKEYED
41# define AES_ENC_128_OTFK
44# define AES_DEC_128_OTFK
47# define AES_ENC_256_OTFK
50# define AES_DEC_256_OTFK
55#define N_BLOCK (N_ROW * N_COL)
56#define N_MAX_ROUNDS 14
58typedef unsigned char uint_8t;
60typedef uint_8t return_type;
66typedef uint_8t length_type;
69{ uint_8t ksch[(N_MAX_ROUNDS + 1) * N_BLOCK];
81#if defined( AES_ENC_PREKEYED ) || defined( AES_DEC_PREKEYED )
83return_type aes_set_key(
const unsigned char key[],
88#if defined( AES_ENC_PREKEYED )
90return_type aes_encrypt(
const unsigned char in[N_BLOCK],
91 unsigned char out[N_BLOCK],
94return_type aes_cbc_encrypt(
const unsigned char *in,
97 unsigned char iv[N_BLOCK],
101#if defined( AES_DEC_PREKEYED )
103return_type aes_decrypt(
const unsigned char in[N_BLOCK],
104 unsigned char out[N_BLOCK],
107return_type aes_cbc_decrypt(
const unsigned char *in,
110 unsigned char iv[N_BLOCK],
134#if defined( AES_ENC_128_OTFK )
135void aes_encrypt_128(
const unsigned char in[N_BLOCK],
136 unsigned char out[N_BLOCK],
137 const unsigned char key[N_BLOCK],
138 uint_8t o_key[N_BLOCK] );
141#if defined( AES_DEC_128_OTFK )
142void aes_decrypt_128(
const unsigned char in[N_BLOCK],
143 unsigned char out[N_BLOCK],
144 const unsigned char key[N_BLOCK],
145 unsigned char o_key[N_BLOCK] );
148#if defined( AES_ENC_256_OTFK )
149void aes_encrypt_256(
const unsigned char in[N_BLOCK],
150 unsigned char out[N_BLOCK],
151 const unsigned char key[2 * N_BLOCK],
152 unsigned char o_key[2 * N_BLOCK] );
155#if defined( AES_DEC_256_OTFK )
156void aes_decrypt_256(
const unsigned char in[N_BLOCK],
157 unsigned char out[N_BLOCK],
158 const unsigned char key[2 * N_BLOCK],
159 unsigned char o_key[2 * N_BLOCK] );