Minor code reordering and documentation adjustments.
[dragonfly.git] / sys / opencrypto / rijndael.h
blob5b16d4ca6005676842a746aaf7c293165e9a502c
1 /* $FreeBSD: src/sys/opencrypto/rijndael.h,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */
2 /* $DragonFly: src/sys/opencrypto/rijndael.h,v 1.2 2003/06/17 04:28:54 dillon Exp $ */
3 /* $OpenBSD: rijndael.h,v 1.7 2001/12/19 17:42:24 markus Exp $ */
5 /**
6 * rijndael-alg-fst.h
8 * @version 3.0 (December 2000)
10 * Optimised ANSI C code for the Rijndael cipher (now AES)
12 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
13 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
14 * @author Paulo Barreto <paulo.barreto@terra.com.br>
16 * This code is hereby placed in the public domain.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
19 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef __RIJNDAEL_H
31 #define __RIJNDAEL_H
33 #define MAXKC (256/32)
34 #define MAXKB (256/8)
35 #define MAXNR 14
37 typedef unsigned char u8;
38 typedef unsigned short u16;
39 typedef unsigned int u32;
41 /* The structure for key information */
42 typedef struct {
43 int decrypt;
44 int Nr; /* key-length-dependent number of rounds */
45 u32 ek[4*(MAXNR + 1)]; /* encrypt key schedule */
46 u32 dk[4*(MAXNR + 1)]; /* decrypt key schedule */
47 } rijndael_ctx;
49 void rijndael_set_key(rijndael_ctx *, u_char *, int, int);
50 void rijndael_decrypt(rijndael_ctx *, u_char *, u_char *);
51 void rijndael_encrypt(rijndael_ctx *, u_char *, u_char *);
53 #endif /* __RIJNDAEL_H */