blob: 18a4d805e1ea1085e88cd2b05cfadd5ef8a2a0b5 [file] [log] [blame]
Ben Lindstromd5e1c042001-09-14 23:09:29 +00001/* $OpenBSD: rijndael.h,v 1.11 2001/09/13 09:48:39 markus Exp $ */
2
Ben Lindstrom319fc732001-09-14 02:47:33 +00003/**
4 * rijndael-alg-fst.h
5 *
6 * @version 3.0 (December 2000)
7 *
8 * Optimised ANSI C code for the Rijndael cipher (now AES)
9 *
10 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
11 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
12 * @author Paulo Barreto <paulo.barreto@terra.com.br>
13 *
14 * This code is hereby placed in the public domain.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
17 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28#ifndef __RIJNDAEL_H
29#define __RIJNDAEL_H
Ben Lindstromb22c2b82001-03-05 06:50:47 +000030
Ben Lindstrom319fc732001-09-14 02:47:33 +000031#define MAXKC (256/32)
32#define MAXKB (256/8)
33#define MAXNR 14
Ben Lindstrom0256e8b2001-08-06 21:24:11 +000034
Ben Lindstrom319fc732001-09-14 02:47:33 +000035typedef unsigned char u8;
36typedef unsigned short u16;
37typedef unsigned int u32;
Ben Lindstrom0256e8b2001-08-06 21:24:11 +000038
Ben Lindstrom319fc732001-09-14 02:47:33 +000039/* The structure for key information */
40typedef struct {
41 int decrypt;
42 int Nr; /* key-length-dependent number of rounds */
43 u32 ek[4*(MAXNR + 1)]; /* encrypt key schedule */
44 u32 dk[4*(MAXNR + 1)]; /* decrypt key schedule */
Ben Lindstromfa1b3d02000-12-10 01:55:37 +000045} rijndael_ctx;
Damien Miller874d77b2000-10-14 16:23:11 +110046
Ben Lindstrom319fc732001-09-14 02:47:33 +000047void rijndael_set_key(rijndael_ctx *, u_char *, int, int);
48void rijndael_decrypt(rijndael_ctx *, u_char *, u_char *);
49void rijndael_encrypt(rijndael_ctx *, u_char *, u_char *);
Ben Lindstromfa1b3d02000-12-10 01:55:37 +000050
Ben Lindstrom319fc732001-09-14 02:47:33 +000051#endif /* __RIJNDAEL_H */