Ben Lindstrom | ddb4f24 | 2001-05-10 23:26:11 +0000 | [diff] [blame] | 1 | /* $OpenBSD: rijndael.h,v 1.8 2001/05/09 23:01:31 markus Exp $ */ |
Ben Lindstrom | b22c2b8 | 2001-03-05 06:50:47 +0000 | [diff] [blame] | 2 | |
| 3 | /* This is an independent implementation of the encryption algorithm: */ |
| 4 | /* */ |
| 5 | /* RIJNDAEL by Joan Daemen and Vincent Rijmen */ |
| 6 | /* */ |
| 7 | /* which is a candidate algorithm in the Advanced Encryption Standard */ |
| 8 | /* programme of the US National Institute of Standards and Technology. */ |
| 9 | /* */ |
| 10 | /* Copyright in this implementation is held by Dr B R Gladman but I */ |
| 11 | /* hereby give permission for its free direct or derivative use subject */ |
| 12 | /* to acknowledgment of its origin and compliance with any conditions */ |
| 13 | /* that the originators of the algorithm place on its exploitation. */ |
| 14 | /* */ |
| 15 | /* Dr Brian Gladman (gladman@seven77.demon.co.uk) 14th January 1999 */ |
Ben Lindstrom | 36579d3 | 2001-01-29 07:39:26 +0000 | [diff] [blame] | 16 | |
Ben Lindstrom | fa1b3d0 | 2000-12-10 01:55:37 +0000 | [diff] [blame] | 17 | #ifndef _RIJNDAEL_H_ |
| 18 | #define _RIJNDAEL_H_ |
Damien Miller | 874d77b | 2000-10-14 16:23:11 +1100 | [diff] [blame] | 19 | |
Ben Lindstrom | fa1b3d0 | 2000-12-10 01:55:37 +0000 | [diff] [blame] | 20 | #include "config.h" |
Damien Miller | 5993935 | 2000-10-15 12:21:32 +1100 | [diff] [blame] | 21 | |
Ben Lindstrom | fa1b3d0 | 2000-12-10 01:55:37 +0000 | [diff] [blame] | 22 | /* 1. Standard types for AES cryptography source code */ |
Damien Miller | 874d77b | 2000-10-14 16:23:11 +1100 | [diff] [blame] | 23 | |
Ben Lindstrom | fa1b3d0 | 2000-12-10 01:55:37 +0000 | [diff] [blame] | 24 | typedef u_int8_t u1byte; /* an 8 bit unsigned character type */ |
| 25 | typedef u_int16_t u2byte; /* a 16 bit unsigned integer type */ |
| 26 | typedef u_int32_t u4byte; /* a 32 bit unsigned integer type */ |
Damien Miller | 874d77b | 2000-10-14 16:23:11 +1100 | [diff] [blame] | 27 | |
Ben Lindstrom | fa1b3d0 | 2000-12-10 01:55:37 +0000 | [diff] [blame] | 28 | typedef int8_t s1byte; /* an 8 bit signed character type */ |
| 29 | typedef int16_t s2byte; /* a 16 bit signed integer type */ |
| 30 | typedef int32_t s4byte; /* a 32 bit signed integer type */ |
Damien Miller | 874d77b | 2000-10-14 16:23:11 +1100 | [diff] [blame] | 31 | |
Ben Lindstrom | fa1b3d0 | 2000-12-10 01:55:37 +0000 | [diff] [blame] | 32 | typedef struct _rijndael_ctx { |
| 33 | u4byte k_len; |
| 34 | int decrypt; |
| 35 | u4byte e_key[64]; |
| 36 | u4byte d_key[64]; |
| 37 | } rijndael_ctx; |
Damien Miller | 874d77b | 2000-10-14 16:23:11 +1100 | [diff] [blame] | 38 | |
Ben Lindstrom | fa1b3d0 | 2000-12-10 01:55:37 +0000 | [diff] [blame] | 39 | |
| 40 | /* 2. Standard interface for AES cryptographic routines */ |
| 41 | |
| 42 | /* These are all based on 32 bit unsigned values and will therefore */ |
| 43 | /* require endian conversions for big-endian architectures */ |
| 44 | |
Ben Lindstrom | ddb4f24 | 2001-05-10 23:26:11 +0000 | [diff] [blame] | 45 | rijndael_ctx * |
| 46 | rijndael_set_key __P((rijndael_ctx *, const u4byte *, const u4byte, int)); |
Ben Lindstrom | fa1b3d0 | 2000-12-10 01:55:37 +0000 | [diff] [blame] | 47 | void rijndael_encrypt __P((rijndael_ctx *, const u4byte *, u4byte *)); |
| 48 | void rijndael_decrypt __P((rijndael_ctx *, const u4byte *, u4byte *)); |
| 49 | |
| 50 | #endif /* _RIJNDAEL_H_ */ |