summaryrefslogtreecommitdiff
path: root/sys/opencrypto/cryptosoft.c
diff options
context:
space:
mode:
authordrochner <drochner@NetBSD.org>2011-05-21 10:04:03 +0000
committerdrochner <drochner@NetBSD.org>2011-05-21 10:04:03 +0000
commit5fe126fa1839dd743098093fb3c48edeab033e14 (patch)
tree1e41cc151027d3531d407696bb728503227dbdc7 /sys/opencrypto/cryptosoft.c
parentfb200f247da86807cf7b9ee4599f7869f118c0f0 (diff)
fix a logics bug (which has been here from the beginning) which made
that only 96 random bits were used for IV generation, this caused eg that the last 4 bytes of the IV in ESP/AES-CBC were constant, leaking kernel memory affects FAST_IPSEC only
Diffstat (limited to 'sys/opencrypto/cryptosoft.c')
-rw-r--r--sys/opencrypto/cryptosoft.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c
index 5f0bf307dce..700e5b1cbfd 100644
--- a/sys/opencrypto/cryptosoft.c
+++ b/sys/opencrypto/cryptosoft.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cryptosoft.c,v 1.30 2011/05/05 17:44:39 drochner Exp $ */
+/* $NetBSD: cryptosoft.c,v 1.31 2011/05/21 10:04:03 drochner Exp $ */
/* $FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $ */
/* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.30 2011/05/05 17:44:39 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.31 2011/05/21 10:04:03 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -95,7 +95,7 @@ swcr_encdec(struct cryptodesc *crd, const struct swcr_data *sw, void *bufv,
else {
/* Get random IV */
for (i = 0;
- i + sizeof (u_int32_t) < EALG_MAX_BLOCK_LEN;
+ i + sizeof (u_int32_t) <= EALG_MAX_BLOCK_LEN;
i += sizeof (u_int32_t)) {
u_int32_t temp = arc4random();