/* rijndael-api-ref.c v2.1 April 2000 * Reference ANSI C code * authors: v2.0 Paulo Barreto * Vincent Rijmen, K.U.Leuven * v2.1 Vincent Rijmen, K.U.Leuven * * This code is placed in the public domain. */ #include "mvOs.h" #include "mvAes.h" #include "mvAesAlg.h" /* Defines: Add any additional defines you need */ #define MODE_ECB 1 /* Are we ciphering in ECB mode? */ #define MODE_CBC 2 /* Are we ciphering in CBC mode? */ #define MODE_CFB1 3 /* Are we ciphering in 1-bit CFB mode? */ int aesMakeKey(MV_U8 *expandedKey, MV_U8 *keyMaterial, int keyLen, int blockLen) { MV_U8 W[MAXROUNDS+1][4][MAXBC]; MV_U8 k[4][MAXKC]; MV_U8 j; int i, rounds, KC; if (expandedKey == NULL) { return AES_BAD_KEY_INSTANCE; } if (!((keyLen == 128) || (keyLen == 192) || (keyLen == 256))) { return AES_BAD_KEY_MAT; } if (keyMaterial == NULL) { return AES_BAD_KEY_MAT; } /* initialize key schedule: */ for(i=0; i