1*b3f26ac6Smarkus /* $OpenBSD: rijndael.h,v 1.6 2001/09/13 09:48:39 markus Exp $ */ 2*b3f26ac6Smarkus 38875bbf2Smarkus /** 48875bbf2Smarkus * rijndael-alg-fst.h 58875bbf2Smarkus * 68875bbf2Smarkus * @version 3.0 (December 2000) 78875bbf2Smarkus * 88875bbf2Smarkus * Optimised ANSI C code for the Rijndael cipher (now AES) 98875bbf2Smarkus * 108875bbf2Smarkus * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> 118875bbf2Smarkus * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> 128875bbf2Smarkus * @author Paulo Barreto <paulo.barreto@terra.com.br> 138875bbf2Smarkus * 148875bbf2Smarkus * This code is hereby placed in the public domain. 158875bbf2Smarkus * 168875bbf2Smarkus * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS 178875bbf2Smarkus * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 188875bbf2Smarkus * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 198875bbf2Smarkus * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE 208875bbf2Smarkus * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 218875bbf2Smarkus * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 228875bbf2Smarkus * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 238875bbf2Smarkus * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 248875bbf2Smarkus * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 258875bbf2Smarkus * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 268875bbf2Smarkus * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2706ed33c6Sstevesk */ 288875bbf2Smarkus #ifndef __RIJNDAEL_H 298875bbf2Smarkus #define __RIJNDAEL_H 305df83cf4Sderaadt 318875bbf2Smarkus #define MAXKC (256/32) 328875bbf2Smarkus #define MAXKB (256/8) 338875bbf2Smarkus #define MAXNR 14 346b24b8a0Sprovos 358875bbf2Smarkus typedef unsigned char u8; 368875bbf2Smarkus typedef unsigned short u16; 378875bbf2Smarkus typedef unsigned int u32; 386b24b8a0Sprovos 398875bbf2Smarkus /* The structure for key information */ 408875bbf2Smarkus typedef struct { 416b24b8a0Sprovos int decrypt; 428875bbf2Smarkus int Nr; /* key-length-dependent number of rounds */ 438875bbf2Smarkus u32 ek[4*(MAXNR + 1)]; /* encrypt key schedule */ 448875bbf2Smarkus u32 dk[4*(MAXNR + 1)]; /* decrypt key schedule */ 456b24b8a0Sprovos } rijndael_ctx; 466b24b8a0Sprovos 478875bbf2Smarkus void rijndael_set_key(rijndael_ctx *, u_char *, int, int); 488875bbf2Smarkus void rijndael_decrypt(rijndael_ctx *, u_char *, u_char *); 498875bbf2Smarkus void rijndael_encrypt(rijndael_ctx *, u_char *, u_char *); 506b24b8a0Sprovos 518875bbf2Smarkus #endif /* __RIJNDAEL_H */ 52