source: trunk/NativeCryptography/aes_core.h @ 1190

Last change on this file since 1190 was 1190, checked in by Sven Rech, 12 years ago

added original licence header to aes implementation

File size: 2.4 KB
Line 
1/* crypto/aes/aes_core.h -*- mode:C; c-file-style: "eay" -*- */
2/**
3 * @version 3.0 (December 2000)
4 *
5 * Optimised ANSI C code for the Rijndael cipher (now AES)
6 *
7 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
8 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
9 * @author Paulo Barreto <paulo.barreto@terra.com.br>
10 *
11 * This code is hereby placed in the public domain.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
14 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
17 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
20 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
22 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26/* Note: rewritten a little bit to provide error control and an OpenSSL-
27   compatible API */
28
29/* Note: Modified by Sven Rech for Cryptool 2 */
30
31#ifndef HEADER_AES_LOCL_H
32#define HEADER_AES_LOCL_H
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* __cplusplus */
37
38# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] <<  8) ^ ((u32)(pt)[3]))
39# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >>  8); (ct)[3] = (u8)(st); }
40
41typedef unsigned int u32;
42typedef unsigned short u16;
43typedef unsigned char u8;
44
45#define MAXKC   (256/32)
46#define MAXKB   (256/8)
47#define MAXNR   14
48
49
50
51/* Because array size can't be a const in C, the following two are macros.
52   Both sizes are in bytes. */
53#define AES_MAXNR 14
54#define AES_BLOCK_SIZE 16
55
56/* This should be a hidden type, but EVP requires that the size be known */
57struct aes_key_st {
58    unsigned int rd_key[4 *(AES_MAXNR + 1)];
59    int rounds;
60};
61typedef struct aes_key_st AES_KEY;
62
63
64void AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
65int AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
66
67#ifdef __cplusplus
68}
69#endif /* __cplusplus */
70
71#endif /* !HEADER_AES_LOCL_H */
Note: See TracBrowser for help on using the repository browser.