xref: /openbsd/sys/crypto/rijndael.h (revision 8875bbf2)
1*8875bbf2Smarkus /**
2*8875bbf2Smarkus  * rijndael-alg-fst.h
3*8875bbf2Smarkus  *
4*8875bbf2Smarkus  * @version 3.0 (December 2000)
5*8875bbf2Smarkus  *
6*8875bbf2Smarkus  * Optimised ANSI C code for the Rijndael cipher (now AES)
7*8875bbf2Smarkus  *
8*8875bbf2Smarkus  * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
9*8875bbf2Smarkus  * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
10*8875bbf2Smarkus  * @author Paulo Barreto <paulo.barreto@terra.com.br>
11*8875bbf2Smarkus  *
12*8875bbf2Smarkus  * This code is hereby placed in the public domain.
13*8875bbf2Smarkus  *
14*8875bbf2Smarkus  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
15*8875bbf2Smarkus  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16*8875bbf2Smarkus  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*8875bbf2Smarkus  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
18*8875bbf2Smarkus  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19*8875bbf2Smarkus  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20*8875bbf2Smarkus  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21*8875bbf2Smarkus  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22*8875bbf2Smarkus  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23*8875bbf2Smarkus  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24*8875bbf2Smarkus  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2506ed33c6Sstevesk  */
26*8875bbf2Smarkus #ifndef __RIJNDAEL_H
27*8875bbf2Smarkus #define __RIJNDAEL_H
285df83cf4Sderaadt 
29*8875bbf2Smarkus #define MAXKC	(256/32)
30*8875bbf2Smarkus #define MAXKB	(256/8)
31*8875bbf2Smarkus #define MAXNR	14
326b24b8a0Sprovos 
33*8875bbf2Smarkus typedef unsigned char	u8;
34*8875bbf2Smarkus typedef unsigned short	u16;
35*8875bbf2Smarkus typedef unsigned int	u32;
366b24b8a0Sprovos 
37*8875bbf2Smarkus /*  The structure for key information */
38*8875bbf2Smarkus typedef struct {
396b24b8a0Sprovos 	int	decrypt;
40*8875bbf2Smarkus 	int	Nr;			/* key-length-dependent number of rounds */
41*8875bbf2Smarkus 	u32	ek[4*(MAXNR + 1)];	/* encrypt key schedule */
42*8875bbf2Smarkus 	u32	dk[4*(MAXNR + 1)];	/* decrypt key schedule */
436b24b8a0Sprovos } rijndael_ctx;
446b24b8a0Sprovos 
45*8875bbf2Smarkus void	 rijndael_set_key(rijndael_ctx *, u_char *, int, int);
46*8875bbf2Smarkus void	 rijndael_decrypt(rijndael_ctx *, u_char *, u_char *);
47*8875bbf2Smarkus void	 rijndael_encrypt(rijndael_ctx *, u_char *, u_char *);
486b24b8a0Sprovos 
49*8875bbf2Smarkus #endif /* __RIJNDAEL_H */
50