summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/crypto/rijndael.h13
-rw-r--r--sys/crypto/xform.c4
2 files changed, 9 insertions, 8 deletions
diff --git a/sys/crypto/rijndael.h b/sys/crypto/rijndael.h
index 190b4c5f555..f9811956f44 100644
--- a/sys/crypto/rijndael.h
+++ b/sys/crypto/rijndael.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rijndael.h,v 1.11 2005/05/25 05:47:53 markus Exp $ */
+/* $OpenBSD: rijndael.h,v 1.12 2007/05/27 05:43:17 tedu Exp $ */
/**
* rijndael-alg-fst.h
@@ -28,9 +28,10 @@
#ifndef __RIJNDAEL_H
#define __RIJNDAEL_H
-#define MAXKC (256/32)
-#define MAXKB (256/8)
-#define MAXNR 14
+#define AES_MAXKEYBITS (256)
+#define AES_MAXKEYBYTES (AES_MAXKEYBITS/8)
+/* for 256-bit keys, fewer for less */
+#define AES_MAXROUNDS 14
typedef unsigned char u8;
typedef unsigned short u16;
@@ -40,8 +41,8 @@ typedef unsigned int u32;
typedef struct {
int enc_only; /* context contains only encrypt schedule */
int Nr; /* key-length-dependent number of rounds */
- u32 ek[4*(MAXNR + 1)]; /* encrypt key schedule */
- u32 dk[4*(MAXNR + 1)]; /* decrypt key schedule */
+ u32 ek[4*(AES_MAXROUNDS + 1)]; /* encrypt key schedule */
+ u32 dk[4*(AES_MAXROUNDS + 1)]; /* decrypt key schedule */
} rijndael_ctx;
int rijndael_set_key(rijndael_ctx *, u_char *, int);
diff --git a/sys/crypto/xform.c b/sys/crypto/xform.c
index 7eee9e258e5..080fe302720 100644
--- a/sys/crypto/xform.c
+++ b/sys/crypto/xform.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xform.c,v 1.30 2007/02/19 08:55:41 hshoexer Exp $ */
+/* $OpenBSD: xform.c,v 1.31 2007/05/27 05:43:17 tedu Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -514,7 +514,7 @@ rijndael128_zerokey(u_int8_t **sched)
#define AESCTR_BLOCKSIZE 16
struct aes_ctr_ctx {
- u_int32_t ac_ek[4*(MAXNR + 1)];
+ u_int32_t ac_ek[4*(AES_MAXROUNDS + 1)];
u_int8_t ac_block[AESCTR_BLOCKSIZE];
int ac_nr;
};