1 /* Copyright (C) 2000-2009 Peter Selinger.
2 This file is part of ccrypt. It is free software and it is covered
3 by the GNU general public license. See the file COPYING for details. */
6 /* $Id: rijndael.h 258 2009-08-26 17:46:10Z selinger $ */
8 /* derived from original source: rijndael-alg-ref.h v2.0 August '99
9 * Reference ANSI C code for NIST competition
10 * authors: Paulo Barreto
19 typedef uint8_t word8;
20 typedef uint32_t word32;
22 /* a type to hold 32 bits accessible as 1 integer or 4 bytes */
27 typedef union word8x4_u word8x4;
29 #include "ao_aes_tables.h"
31 #define MAXBC (256/32)
32 #define MAXKC (256/32)
34 #define MAXRK ((MAXROUNDS+1)*MAXBC)
45 /* keys and blocks are externally treated as word32 arrays, to
46 make sure they are aligned on 4-byte boundaries on architectures
49 /* make a roundkey rkk from key. key must have appropriate size given
50 by keyBits. keyBits and blockBits may only be 128, 196, or
51 256. Returns non-zero if arguments are invalid. */
53 int xrijndaelKeySched(word32 key[], int keyBits, int blockBits,
56 /* encrypt, resp. decrypt, block using rijndael roundkey rkk. rkk must
57 have been created with xrijndaelKeySched. Size of block, in bits,
58 must be equal to blockBits parameter that was used to make rkk. In
59 all other cases, behavior is undefined - for reasons of speed, no
60 check for error conditions is done. */
62 void xrijndaelEncrypt(word32 block[], roundkey *rkk);
63 void xrijndaelDecrypt(word32 block[], roundkey *rkk);
66 #endif /* __RIJNDAEL_H */