]> git.saurik.com Git - apple/security.git/blob - SecurityTests/cspxutils/utilLib/rijndael-alg-ref.h
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / cspxutils / utilLib / rijndael-alg-ref.h
1 /* rijndael-alg-ref.h v2.0 August '99
2 * Reference ANSI C code
3 * authors: Paulo Barreto
4 * Vincent Rijmen
5 */
6 #ifndef __RIJNDAEL_ALG_H
7 #define __RIJNDAEL_ALG_H
8
9 #ifdef __APPLE__
10 #define MIN_AES_KEY_BITS 128
11 #define MID_AES_KEY_BITS 192
12 #define MAX_AES_KEY_BITS 256
13 #define MAX_AES_KEY_BYTES (MAX_AES_KEY_BITS / 8)
14
15 #define MIN_AES_BLOCK_BITS 128
16 #define MID_AES_BLOCK_BITS 192
17 #define MAX_AES_BLOCK_BITS 256
18 #define MIN_AES_BLOCK_BYTES (MIN_AES_BLOCK_BITS / 8)
19
20 #endif
21 #define MAXBC (MAX_AES_BLOCK_BITS/32)
22 #define MAXKC (MAX_AES_KEY_BITS/32)
23 #define MAXROUNDS 14
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 typedef unsigned char word8;
30 typedef unsigned short word16;
31 typedef unsigned long word32;
32
33
34 int _rijndaelKeySched (word8 k[4][MAXKC], int keyBits, int blockBits,
35 word8 rk[MAXROUNDS+1][4][MAXBC]);
36 int _rijndaelEncrypt (word8 a[4][MAXBC], int keyBits, int blockBits,
37 word8 rk[MAXROUNDS+1][4][MAXBC]);
38 #ifndef __APPLE__
39 int rijndaelEncryptRound (word8 a[4][MAXBC], int keyBits, int blockBits,
40 word8 rk[MAXROUNDS+1][4][MAXBC], int rounds);
41 #endif
42 int _rijndaelDecrypt (word8 a[4][MAXBC], int keyBits, int blockBits,
43 word8 rk[MAXROUNDS+1][4][MAXBC]);
44 #ifndef __APPLE__
45 int rijndaelDecryptRound (word8 a[4][MAXBC], int keyBits, int blockBits,
46 word8 rk[MAXROUNDS+1][4][MAXBC], int rounds);
47 #endif
48
49 #ifdef __cplusplus
50 }
51 #endif
52
53 #endif /* __RIJNDAEL_ALG_H */