1 /* $OpenBSD: rijndael.h,v 1.7 2001/03/01 03:38:33 deraadt Exp $ */ 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 */ 16 17 #ifndef _RIJNDAEL_H_ 18 #define _RIJNDAEL_H_ 19 20 /* 1. Standard types for AES cryptography source code */ 21 22 typedef u_int8_t u1byte; /* an 8 bit unsigned character type */ 23 typedef u_int16_t u2byte; /* a 16 bit unsigned integer type */ 24 typedef u_int32_t u4byte; /* a 32 bit unsigned integer type */ 25 26 typedef int8_t s1byte; /* an 8 bit signed character type */ 27 typedef int16_t s2byte; /* a 16 bit signed integer type */ 28 typedef int32_t s4byte; /* a 32 bit signed integer type */ 29 30 typedef struct _rijndael_ctx { 31 u4byte k_len; 32 int decrypt; 33 u4byte e_key[64]; 34 u4byte d_key[64]; 35 } rijndael_ctx; 36 37 38 /* 2. Standard interface for AES cryptographic routines */ 39 40 /* These are all based on 32 bit unsigned values and will therefore */ 41 /* require endian conversions for big-endian architectures */ 42 43 rijndael_ctx *rijndael_set_key __P((rijndael_ctx *, const u4byte *, u4byte, int)); 44 void rijndael_encrypt __P((rijndael_ctx *, const u4byte *, u4byte *)); 45 void rijndael_decrypt __P((rijndael_ctx *, const u4byte *, u4byte *)); 46 47 #endif /* _RIJNDAEL_H_ */ 48