diff options
Diffstat (limited to 'rijndael.h')
-rw-r--r-- | rijndael.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/rijndael.h b/rijndael.h index c614bb188..53e74e0a8 100644 --- a/rijndael.h +++ b/rijndael.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rijndael.h,v 1.12 2001/12/19 07:18:56 deraadt Exp $ */ | 1 | /* $OpenBSD: rijndael.h,v 1.14 2014/04/29 15:42:07 markus Exp $ */ |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * rijndael-alg-fst.h | 4 | * rijndael-alg-fst.h |
@@ -25,27 +25,32 @@ | |||
25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
26 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ | 27 | */ |
28 | #ifndef __RIJNDAEL_H | 28 | #ifndef _PRIVATE_RIJNDAEL_H |
29 | #define __RIJNDAEL_H | 29 | #define _PRIVATE_RIJNDAEL_H |
30 | 30 | ||
31 | #define MAXKC (256/32) | 31 | #define AES_MAXKEYBITS (256) |
32 | #define MAXKB (256/8) | 32 | #define AES_MAXKEYBYTES (AES_MAXKEYBITS/8) |
33 | #define MAXNR 14 | 33 | /* for 256-bit keys, fewer for less */ |
34 | #define AES_MAXROUNDS 14 | ||
34 | 35 | ||
35 | typedef unsigned char u8; | 36 | typedef unsigned char u8; |
36 | typedef unsigned short u16; | 37 | typedef unsigned short u16; |
37 | typedef unsigned int u32; | 38 | typedef unsigned int u32; |
38 | 39 | ||
40 | int rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int); | ||
41 | void rijndaelEncrypt(const unsigned int [], int, const unsigned char [], | ||
42 | unsigned char []); | ||
43 | |||
39 | /* The structure for key information */ | 44 | /* The structure for key information */ |
40 | typedef struct { | 45 | typedef struct { |
41 | int decrypt; | 46 | int decrypt; |
42 | int Nr; /* key-length-dependent number of rounds */ | 47 | int Nr; /* key-length-dependent number of rounds */ |
43 | u32 ek[4*(MAXNR + 1)]; /* encrypt key schedule */ | 48 | u32 ek[4*(AES_MAXROUNDS + 1)]; /* encrypt key schedule */ |
44 | u32 dk[4*(MAXNR + 1)]; /* decrypt key schedule */ | 49 | u32 dk[4*(AES_MAXROUNDS + 1)]; /* decrypt key schedule */ |
45 | } rijndael_ctx; | 50 | } rijndael_ctx; |
46 | 51 | ||
47 | void rijndael_set_key(rijndael_ctx *, u_char *, int, int); | 52 | void rijndael_set_key(rijndael_ctx *, u_char *, int, int); |
48 | void rijndael_decrypt(rijndael_ctx *, u_char *, u_char *); | 53 | void rijndael_decrypt(rijndael_ctx *, u_char *, u_char *); |
49 | void rijndael_encrypt(rijndael_ctx *, u_char *, u_char *); | 54 | void rijndael_encrypt(rijndael_ctx *, u_char *, u_char *); |
50 | 55 | ||
51 | #endif /* __RIJNDAEL_H */ | 56 | #endif /* _PRIVATE_RIJNDAEL_H */ |