summaryrefslogtreecommitdiff
path: root/sys/dev/ic/if_wi.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2002-04-01 20:42:19 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2002-04-01 20:42:19 +0000
commit246c86203a49af3f344ad123f32dc598d4a9a29e (patch)
treeb52eaf99094862262e3164842894ff16d27647cd /sys/dev/ic/if_wi.c
parent745cd82947e8bccffc1777b49c892ac8c64a9d5f (diff)
always check for bad IVs
Diffstat (limited to 'sys/dev/ic/if_wi.c')
-rw-r--r--sys/dev/ic/if_wi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index 25cabc8ca39..6bc68d0172a 100644
--- a/sys/dev/ic/if_wi.c
+++ b/sys/dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.37 2002/04/01 20:38:36 millert Exp $ */
+/* $OpenBSD: if_wi.c,v 1.38 2002/04/01 20:42:18 markus Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -124,7 +124,7 @@ u_int32_t widebug = WIDEBUG;
#if !defined(lint) && !defined(__OpenBSD__)
static const char rcsid[] =
- "$OpenBSD: if_wi.c,v 1.37 2002/04/01 20:38:36 millert Exp $";
+ "$OpenBSD: if_wi.c,v 1.38 2002/04/01 20:42:18 markus Exp $";
#endif /* lint */
#ifdef foo
@@ -1585,15 +1585,15 @@ wi_do_hostencrypt(struct wi_softc *sc, caddr_t buf, int len)
if (!sc->wi_icv_flag) {
sc->wi_icv = arc4random();
sc->wi_icv_flag++;
- } else if (sc->wi_icv >= 0x03ff00 &&
- (sc->wi_icv & 0xf8ff00) == 0x00ff00) {
- /*
- * Skip 'bad' IVs from Fluhrer/Mantin/Shamir:
- * (B, 255, N) with 3 <= B < 8
- */
- sc->wi_icv += 0x000100;
} else
sc->wi_icv++;
+ /*
+ * Skip 'bad' IVs from Fluhrer/Mantin/Shamir:
+ * (B, 255, N) with 3 <= B < 8
+ */
+ if (sc->wi_icv >= 0x03ff00 &&
+ (sc->wi_icv & 0xf8ff00) == 0x00ff00)
+ sc->wi_icv += 0x000100;
/* prepend 24bit IV to tx key, byte order does not matter */
key[0] = sc->wi_icv >> 16;