00001 /** 00002 * rijndael-alg-fst.h 00003 * 00004 * @version 3.0 (December 2000) 00005 * 00006 * Optimised ANSI C code for the Rijndael cipher (now AES) 00007 * 00008 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> 00009 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> 00010 * @author Paulo Barreto <paulo.barreto@terra.com.br> 00011 * 00012 * This code is hereby placed in the public domain. 00013 * 00014 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS 00015 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00016 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00017 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE 00018 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00019 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00020 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 00021 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00022 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 00023 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00024 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00025 */ 00026 #ifndef __RIJNDAEL_ALG_FST_H 00027 #define __RIJNDAEL_ALG_FST_H 00028 00029 #define MAXKC (256/32) 00030 #define MAXKB (256/8) 00031 #define MAXNR 14 00032 00033 typedef unsigned char u8; 00034 typedef unsigned short u16; 00035 typedef unsigned int u32; 00036 00037 int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits); 00038 int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits); 00039 void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]); 00040 void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]); 00041 00042 #ifdef INTERMEDIATE_VALUE_KAT 00043 void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds); 00044 void rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds); 00045 #endif /* INTERMEDIATE_VALUE_KAT */ 00046 00047 #endif /* __RIJNDAEL_ALG_FST_H */