diff options
Diffstat (limited to 'rijndael.h')
-rw-r--r-- | rijndael.h | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/rijndael.h b/rijndael.h index 75853cfff..09c425742 100644 --- a/rijndael.h +++ b/rijndael.h | |||
@@ -1,27 +1,33 @@ | |||
1 | /* | 1 | #ifndef _RIJNDAEL_H_ |
2 | * rijndael-alg-fst.h v2.4 April '2000 | 2 | #define _RIJNDAEL_H_ |
3 | * rijndael-api-fst.h v2.4 April '2000 | ||
4 | * | ||
5 | * Optimised ANSI C code | ||
6 | * | ||
7 | */ | ||
8 | 3 | ||
9 | #ifndef RIJNDAEL_H | 4 | #include "config.h" |
10 | #define RIJNDAEL_H | ||
11 | 5 | ||
12 | #define RIJNDAEL_MAXKC (256/32) | 6 | /* 1. Standard types for AES cryptography source code */ |
13 | #define RIJNDAEL_MAXROUNDS 14 | ||
14 | 7 | ||
15 | #define RIJNDAEL_ENCRYPT 0 | 8 | typedef u_int8_t u1byte; /* an 8 bit unsigned character type */ |
16 | #define RIJNDAEL_DECRYPT 1 | 9 | typedef u_int16_t u2byte; /* a 16 bit unsigned integer type */ |
10 | typedef u_int32_t u4byte; /* a 32 bit unsigned integer type */ | ||
17 | 11 | ||
18 | typedef struct { | 12 | typedef int8_t s1byte; /* an 8 bit signed character type */ |
19 | int ROUNDS; /* key-length-dependent number of rounds */ | 13 | typedef int16_t s2byte; /* a 16 bit signed integer type */ |
20 | u_int8_t keySched[RIJNDAEL_MAXROUNDS+1][4][4]; | 14 | typedef int32_t s4byte; /* a 32 bit signed integer type */ |
21 | } rijndael_key; | ||
22 | 15 | ||
23 | int rijndael_encrypt(rijndael_key *key, u_int8_t a[16], u_int8_t b[16]); | 16 | typedef struct _rijndael_ctx { |
24 | int rijndael_decrypt(rijndael_key *key, u_int8_t a[16], u_int8_t b[16]); | 17 | u4byte k_len; |
25 | int rijndael_makekey(rijndael_key *key, int direction, int keyLen, u_int8_t *keyMaterial); | 18 | int decrypt; |
19 | u4byte e_key[64]; | ||
20 | u4byte d_key[64]; | ||
21 | } rijndael_ctx; | ||
26 | 22 | ||
27 | #endif | 23 | |
24 | /* 2. Standard interface for AES cryptographic routines */ | ||
25 | |||
26 | /* These are all based on 32 bit unsigned values and will therefore */ | ||
27 | /* require endian conversions for big-endian architectures */ | ||
28 | |||
29 | rijndael_ctx *rijndael_set_key __P((rijndael_ctx *, const u4byte *, u4byte, int)); | ||
30 | void rijndael_encrypt __P((rijndael_ctx *, const u4byte *, u4byte *)); | ||
31 | void rijndael_decrypt __P((rijndael_ctx *, const u4byte *, u4byte *)); | ||
32 | |||
33 | #endif /* _RIJNDAEL_H_ */ | ||