[SHELL-EXPERIMENTS]
[reactos.git] / include / reactos / libs / gnutls / nettle / aes.h
1 /* aes.h
2 *
3 * The aes/rijndael block cipher.
4 */
5
6 /* nettle, low-level cryptographics library
7 *
8 * Copyright (C) 2001 Niels Möller
9 *
10 * The nettle library is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or (at your
13 * option) any later version.
14 *
15 * The nettle library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with the nettle library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 * MA 02111-1301, USA.
24 */
25
26 #ifndef NETTLE_AES_H_INCLUDED
27 #define NETTLE_AES_H_INCLUDED
28
29 #include "nettle-types.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /* Name mangling */
36 #define aes_set_encrypt_key nettle_aes_set_encrypt_key
37 #define aes_set_decrypt_key nettle_aes_set_decrypt_key
38 #define aes_invert_key nettle_aes_invert_key
39 #define aes_encrypt nettle_aes_encrypt
40 #define aes_decrypt nettle_aes_decrypt
41
42 #define AES_BLOCK_SIZE 16
43
44 /* Variable key size between 128 and 256 bits. But the only valid
45 * values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
46 #define AES_MIN_KEY_SIZE 16
47 #define AES_MAX_KEY_SIZE 32
48
49 #define AES_KEY_SIZE 32
50
51 /* FIXME: Change to put nrounds first, to make it possible to use a
52 truncated ctx struct, with less subkeys, for the shorter key
53 sizes? */
54 struct aes_ctx {
55 uint32_t keys[60]; /* maximum size of key schedule */
56 unsigned nrounds; /* number of rounds to use for our key size */
57 };
58
59 void
60 aes_set_encrypt_key(struct aes_ctx *ctx,
61 unsigned length, const uint8_t * key);
62
63 void
64 aes_set_decrypt_key(struct aes_ctx *ctx,
65 unsigned length, const uint8_t * key);
66
67 void
68 aes_invert_key(struct aes_ctx *dst, const struct aes_ctx *src);
69
70 void
71 aes_encrypt(const struct aes_ctx *ctx,
72 unsigned length, uint8_t * dst, const uint8_t * src);
73 void
74 aes_decrypt(const struct aes_ctx *ctx,
75 unsigned length, uint8_t * dst, const uint8_t * src);
76
77 #ifdef __cplusplus
78 }
79 #endif
80 #endif /* NETTLE_AES_H_INCLUDED */