summaryrefslogtreecommitdiff
path: root/rijndael.h
diff options
context:
space:
mode:
Diffstat (limited to 'rijndael.h')
-rw-r--r--rijndael.h48
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 8typedef u_int8_t u1byte; /* an 8 bit unsigned character type */
16#define RIJNDAEL_DECRYPT 1 9typedef u_int16_t u2byte; /* a 16 bit unsigned integer type */
10typedef u_int32_t u4byte; /* a 32 bit unsigned integer type */
17 11
18typedef struct { 12typedef int8_t s1byte; /* an 8 bit signed character type */
19 int ROUNDS; /* key-length-dependent number of rounds */ 13typedef int16_t s2byte; /* a 16 bit signed integer type */
20 u_int8_t keySched[RIJNDAEL_MAXROUNDS+1][4][4]; 14typedef int32_t s4byte; /* a 32 bit signed integer type */
21} rijndael_key;
22 15
23int rijndael_encrypt(rijndael_key *key, u_int8_t a[16], u_int8_t b[16]); 16typedef struct _rijndael_ctx {
24int rijndael_decrypt(rijndael_key *key, u_int8_t a[16], u_int8_t b[16]); 17 u4byte k_len;
25int 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
29rijndael_ctx *rijndael_set_key __P((rijndael_ctx *, const u4byte *, u4byte, int));
30void rijndael_encrypt __P((rijndael_ctx *, const u4byte *, u4byte *));
31void rijndael_decrypt __P((rijndael_ctx *, const u4byte *, u4byte *));
32
33#endif /* _RIJNDAEL_H_ */