summaryrefslogtreecommitdiff
path: root/aes.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2013-05-22 20:14:14 +0200
committerNiels Möller <nisse@lysator.liu.se>2013-05-22 20:14:14 +0200
commitb27be3a688b814832b965b15680f9ccd053a0753 (patch)
tree0260c2beb0a3854928b22327ca7a6eaaeb8abea8 /aes.h
parentd6fadad818952700af8460399feb0cd5bad899cc (diff)
downloadnettle-b27be3a688b814832b965b15680f9ccd053a0753.tar.gz
New internal functions _aes_set_key and _aes_invert.
Diffstat (limited to 'aes.h')
-rw-r--r--aes.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/aes.h b/aes.h
index d26c0013..95f7aa5d 100644
--- a/aes.h
+++ b/aes.h
@@ -41,20 +41,24 @@ extern "C" {
#define AES_BLOCK_SIZE 16
+#define AES128_KEY_SIZE 16
+#define AES192_KEY_SIZE 24
+#define AES256_KEY_SIZE 32
+#define _AES128_ROUNDS 10
+#define _AES192_ROUNDS 12
+#define _AES256_ROUNDS 14
+
/* Variable key size between 128 and 256 bits. But the only valid
* values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
-#define AES_MIN_KEY_SIZE 16
-#define AES_MAX_KEY_SIZE 32
+#define AES_MIN_KEY_SIZE AES128_KEY_SIZE
+#define AES_MAX_KEY_SIZE AES256_KEY_SIZE
#define AES_KEY_SIZE 32
-/* FIXME: Change to put nrounds first, to make it possible to use a
- truncated ctx struct, with less subkeys, for the shorter key
- sizes? */
struct aes_ctx
{
unsigned rounds; /* number of rounds to use for our key size */
- uint32_t keys[60]; /* maximum size of key schedule */
+ uint32_t keys[4*(_AES256_ROUNDS + 1)]; /* maximum size of key schedule */
};
void