summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander von Gernler <grunk@cvs.openbsd.org>2007-02-21 19:25:41 +0000
committerAlexander von Gernler <grunk@cvs.openbsd.org>2007-02-21 19:25:41 +0000
commit2fa0cec173a43a2a9dbd70ddadbfb85f0a695d5a (patch)
tree93dc8b6ffa4dedd341ac82f4db9c8662562df510 /sys
parente1121c3e98ac12742dde33abd52c3c2e15a14b10 (diff)
Don't use arbitrary 128 bytes as size of the blf key array if we know exactly
how much blowfish takes at max, which is 72 bytes. Also define a constant for this in the include file, suggested by ray@. ok pedro@ thib@ tedu@
Diffstat (limited to 'sys')
-rw-r--r--sys/crypto/blf.h3
-rw-r--r--sys/dev/vnd.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/sys/crypto/blf.h b/sys/crypto/blf.h
index 5b978e28947..79e832ca1a9 100644
--- a/sys/crypto/blf.h
+++ b/sys/crypto/blf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: blf.h,v 1.5 2002/07/02 19:38:54 nate Exp $ */
+/* $OpenBSD: blf.h,v 1.6 2007/02/21 19:25:40 grunk Exp $ */
/*
* Blowfish - a fast block cipher designed by Bruce Schneier
@@ -44,6 +44,7 @@
#define BLF_N 16 /* Number of Subkeys */
#define BLF_MAXKEYLEN ((BLF_N-2)*4) /* 448 bits */
+#define BLF_MAXUTILIZED ((BLF_N+2)*4) /* 576 bits */
/* Blowfish context */
typedef struct BlowfishContext {
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 9dc37757c22..da2c15b60f4 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.68 2007/02/01 01:02:05 pedro Exp $ */
+/* $OpenBSD: vnd.c,v 1.69 2007/02/21 19:25:40 grunk Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -773,7 +773,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
}
if (vio->vnd_keylen > 0) {
- char key[128];
+ char key[BLF_MAXUTILIZED];
if (vio->vnd_keylen > sizeof(key))
vio->vnd_keylen = sizeof(key);