1/*	$KAME: rijndael.h,v 1.6 2003/08/28 08:36:32 itojun Exp $	*/
2/*	$FreeBSD$	*/
3
4/**
5 * rijndael-alg-fst.h
6 *
7 * @version 3.0 (December 2000)
8 *
9 * Optimised ANSI C code for the Rijndael cipher (now AES)
10 *
11 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
12 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
13 * @author Paulo Barreto <paulo.barreto@terra.com.br>
14 *
15 * This code is hereby placed in the public domain.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#ifndef __RIJNDAEL_H
31#define	__RIJNDAEL_H
32
33#define RIJNDAEL_MAXKC	(256/32)
34#define RIJNDAEL_MAXKB	(256/8)
35#define RIJNDAEL_MAXNR	14
36
37typedef struct {
38	int	decrypt;
39	int	Nr;		/* key-length-dependent number of rounds */
40	uint32_t ek[4 * (RIJNDAEL_MAXNR + 1)];	/* encrypt key schedule */
41	uint32_t dk[4 * (RIJNDAEL_MAXNR + 1)];	/* decrypt key schedule */
42} rijndael_ctx;
43
44void	rijndael_set_key(rijndael_ctx *, const u_char *, int);
45void	rijndael_decrypt(const rijndael_ctx *, const u_char *, u_char *);
46void	rijndael_encrypt(const rijndael_ctx *, const u_char *, u_char *);
47
48int	rijndaelKeySetupEnc(u_int32_t [/*4*(Nr+1)*/], const u_int8_t [], int);
49int	rijndaelKeySetupDec(u_int32_t [/*4*(Nr+1)*/], const u_int8_t [], int);
50void	rijndaelEncrypt(const u_int32_t [/*4*(Nr+1)*/], int,
51	const u_int8_t[16], u_int8_t [16]);
52void	rijndaelDecrypt(const u_int32_t [/*4*(Nr+1)*/], int,
53	const u_int8_t [16], u_int8_t [16]);
54
55#endif /* __RIJNDAEL_H */
56