Fix.
[shishi.git] / crypto / aes.h
blob87464cf48022ecaaebd8b938d71351bf180c3a8a
1 /* aes.h
3 * The aes/rijndael block cipher.
4 */
6 /* nettle, low-level cryptographics library
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.
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.
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., 59 Temple Place - Suite 330, Boston,
23 * MA 02111-1307, USA.
26 #ifndef NETTLE_AES_H_INCLUDED
27 #define NETTLE_AES_H_INCLUDED
29 #include <inttypes.h>
31 /* Name mangling */
32 #define aes_set_encrypt_key nettle_aes_set_encrypt_key
33 #define aes_set_decrypt_key nettle_aes_set_decrypt_key
34 #define aes_encrypt nettle_aes_encrypt
35 #define aes_decrypt nettle_aes_decrypt
37 #define AES_BLOCK_SIZE 16
39 /* Variable key size between 128 and 256 bits. But the only valid
40 * values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
41 #define AES_MIN_KEY_SIZE 16
42 #define AES_MAX_KEY_SIZE 32
44 #define AES_KEY_SIZE 32
46 struct aes_ctx
48 uint32_t keys[60]; /* maximum size of key schedule */
49 unsigned nrounds; /* number of rounds to use for our key size */
52 void
53 aes_set_encrypt_key(struct aes_ctx *ctx,
54 unsigned length, const uint8_t *key);
55 void
56 aes_set_decrypt_key(struct aes_ctx *ctx,
57 unsigned length, const uint8_t *key);
59 void
60 aes_encrypt(struct aes_ctx *ctx,
61 unsigned length, uint8_t *dst,
62 const uint8_t *src);
63 void
64 aes_decrypt(struct aes_ctx *ctx,
65 unsigned length, uint8_t *dst,
66 const uint8_t *src);
68 #endif /* NETTLE_AES_H_INCLUDED */