aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/aesGladman/aes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/aesGladman/aes.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/aesGladman/aes.h137
1 files changed, 137 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/aesGladman/aes.h b/src/others/irrlicht-1.8.1/source/Irrlicht/aesGladman/aes.h
new file mode 100644
index 0000000..127c886
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/aesGladman/aes.h
@@ -0,0 +1,137 @@
1/*
2 ---------------------------------------------------------------------------
3 Copyright (c) 2003, Dr Brian Gladman < >, Worcester, UK.
4 All rights reserved.
5
6 LICENSE TERMS
7
8 The free distribution and use of this software in both source and binary
9 form is allowed (with or without changes) provided that:
10
11 1. distributions of this source code include the above copyright
12 notice, this list of conditions and the following disclaimer;
13
14 2. distributions in binary form include the above copyright
15 notice, this list of conditions and the following disclaimer
16 in the documentation and/or other associated materials;
17
18 3. the copyright holder's name is not used to endorse products
19 built using this software without specific written permission.
20
21 ALTERNATIVELY, provided that this notice is retained in full, this product
22 may be distributed under the terms of the GNU General Public License (GPL),
23 in which case the provisions of the GPL apply INSTEAD OF those given above.
24
25 DISCLAIMER
26
27 This software is provided 'as is' with no explicit or implied warranties
28 in respect of its properties, including, but not limited to, correctness
29 and/or fitness for purpose.
30 ---------------------------------------------------------------------------
31 Issue Date: 26/08/2003
32
33 This file contains the definitions required to use AES in C. See aesopt.h
34 for optimisation details.
35*/
36
37#ifndef _AES_H
38#define _AES_H
39
40#include "irrMath.h"
41
42#define AES_128 /* define if AES with 128 bit keys is needed */
43#define AES_192 /* define if AES with 192 bit keys is needed */
44#define AES_256 /* define if AES with 256 bit keys is needed */
45#define AES_VAR /* define if a variable key size is needed */
46
47/* The following must also be set in assembler files if being used */
48
49#define AES_ENCRYPT /* if support for encryption is needed */
50#define AES_DECRYPT /* if support for decryption is needed */
51#define AES_ERR_CHK /* for parameter checks & error return codes */
52
53typedef irr::u8 aes_08t;
54typedef irr::u32 aes_32t;
55
56#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */
57#define N_COLS 4 /* the number of columns in the state */
58
59/* a maximum of 60 32-bit words are needed for the key schedule */
60#define KS_LENGTH 64
61
62#ifdef AES_ERR_CHK
63#define aes_ret int
64#define aes_good 0
65#define aes_error -1
66#else
67#define aes_ret void
68#endif
69
70#ifndef AES_DLL /* implement normal/DLL functions */
71#define aes_rval aes_ret
72#else
73#define aes_rval aes_ret __declspec(dllexport) _stdcall
74#endif
75
76/* This routine must be called before first use if non-static */
77/* tables are being used */
78
79void gen_tabs(void);
80
81/* The key length (klen) is input in bytes when it is in the range */
82/* 16 <= klen <= 32 or in bits when in the range 128 <= klen <= 256 */
83
84#ifdef AES_ENCRYPT
85
86typedef struct
87{
88 aes_32t ks[KS_LENGTH];
89} aes_encrypt_ctx;
90
91#if defined(AES_128) || defined(AES_VAR)
92aes_rval aes_encrypt_key128(const void *in_key, aes_encrypt_ctx cx[1]);
93#endif
94
95#if defined(AES_192) || defined(AES_VAR)
96aes_rval aes_encrypt_key192(const void *in_key, aes_encrypt_ctx cx[1]);
97#endif
98
99#if defined(AES_256) || defined(AES_VAR)
100aes_rval aes_encrypt_key256(const void *in_key, aes_encrypt_ctx cx[1]);
101#endif
102
103#if defined(AES_VAR)
104aes_rval aes_encrypt_key(const void *in_key, int key_len, aes_encrypt_ctx cx[1]);
105#endif
106
107aes_rval aes_encrypt(const void *in_blk, void *out_blk, const aes_encrypt_ctx cx[1]);
108#endif
109
110#ifdef AES_DECRYPT
111
112typedef struct
113{
114 aes_32t ks[KS_LENGTH];
115} aes_decrypt_ctx;
116
117#if defined(AES_128) || defined(AES_VAR)
118aes_rval aes_decrypt_key128(const void *in_key, aes_decrypt_ctx cx[1]);
119#endif
120
121#if defined(AES_192) || defined(AES_VAR)
122aes_rval aes_decrypt_key192(const void *in_key, aes_decrypt_ctx cx[1]);
123#endif
124
125#if defined(AES_256) || defined(AES_VAR)
126aes_rval aes_decrypt_key256(const void *in_key, aes_decrypt_ctx cx[1]);
127#endif
128
129#if defined(AES_VAR)
130aes_rval aes_decrypt_key(const void *in_key, int key_len, aes_decrypt_ctx cx[1]);
131#endif
132
133aes_rval aes_decrypt(const void *in_blk, void *out_blk, const aes_decrypt_ctx cx[1]);
134#endif
135
136#endif
137