1/* mvAes.h v2.0 August '99 2 * Reference ANSI C code 3 */ 4 5/* AES Cipher header file for ANSI C Submissions 6 Lawrence E. Bassham III 7 Computer Security Division 8 National Institute of Standards and Technology 9 10 April 15, 1998 11 12 This sample is to assist implementers developing to the Cryptographic 13API Profile for AES Candidate Algorithm Submissions. Please consult this 14document as a cross-reference. 15 16 ANY CHANGES, WHERE APPROPRIATE, TO INFORMATION PROVIDED IN THIS FILE 17MUST BE DOCUMENTED. CHANGES ARE ONLY APPROPRIATE WHERE SPECIFIED WITH 18THE STRING "CHANGE POSSIBLE". FUNCTION CALLS AND THEIR PARAMETERS CANNOT 19BE CHANGED. STRUCTURES CAN BE ALTERED TO ALLOW IMPLEMENTERS TO INCLUDE 20IMPLEMENTATION SPECIFIC INFORMATION. 21*/ 22 23/* Includes: 24 Standard include files 25*/ 26 27#include "mvOs.h" 28 29 30/* Error Codes - CHANGE POSSIBLE: inclusion of additional error codes */ 31 32/* Key direction is invalid, e.g., unknown value */ 33#define AES_BAD_KEY_DIR -1 34 35/* Key material not of correct length */ 36#define AES_BAD_KEY_MAT -2 37 38/* Key passed is not valid */ 39#define AES_BAD_KEY_INSTANCE -3 40 41/* Params struct passed to cipherInit invalid */ 42#define AES_BAD_CIPHER_MODE -4 43 44/* Cipher in wrong state (e.g., not initialized) */ 45#define AES_BAD_CIPHER_STATE -5 46 47#define AES_BAD_CIPHER_INSTANCE -7 48 49 50/* Function protoypes */ 51/* CHANGED: makeKey(): parameter blockLen added 52 this parameter is absolutely necessary if you want to 53 setup the round keys in a variable block length setting 54 cipherInit(): parameter blockLen added (for obvious reasons) 55 */ 56int aesMakeKey(MV_U8 *expandedKey, MV_U8 *keyMaterial, int keyLen, int blockLen); 57int aesBlockEncrypt128(MV_U8 mode, MV_U8 *IV, MV_U8 *expandedKey, int keyLen, 58 MV_U32 *plain, int numBlocks, MV_U32 *cipher); 59int aesBlockDecrypt128(MV_U8 mode, MV_U8 *IV, MV_U8 *expandedKey, int keyLen, 60 MV_U32 *plain, int numBlocks, MV_U32 *cipher); 61 62 63