3 * The aes/rijndael block cipher.
6 /* nettle, low-level cryptographics library
8 * Copyright (C) 2001 Niels Möller
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., 51 Franklin Street, Fifth Floor, Boston,
26 #ifndef NETTLE_AES_H_INCLUDED
27 #define NETTLE_AES_H_INCLUDED
29 #include "nettle-types.h"
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
42 #define AES_BLOCK_SIZE 16
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
49 #define AES_KEY_SIZE 32
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
56 uint32_t keys
[60]; /* maximum size of key schedule */
57 unsigned nrounds
; /* number of rounds to use for our key size */
61 aes_set_encrypt_key(struct aes_ctx
*ctx
,
62 unsigned length
, const uint8_t *key
);
65 aes_set_decrypt_key(struct aes_ctx
*ctx
,
66 unsigned length
, const uint8_t *key
);
69 aes_invert_key(struct aes_ctx
*dst
,
70 const struct aes_ctx
*src
);
73 aes_encrypt(const struct aes_ctx
*ctx
,
74 unsigned length
, uint8_t *dst
,
77 aes_decrypt(const struct aes_ctx
*ctx
,
78 unsigned length
, uint8_t *dst
,
85 #endif /* NETTLE_AES_H_INCLUDED */