diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2002-04-01 18:55:06 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2002-04-01 18:55:06 +0000 |
commit | 487633e7a629132dc19826cc8b53ca4113b6ea74 (patch) | |
tree | 8e452305ed88abe7c5bba25265a4dd1c55b21685 /sys/dev | |
parent | e4ee9c0932795f5f7bd0a2b1db83956734a152d8 (diff) |
skip bad IVs; ok provos@/deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/if_wi.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index 73d65167384..36cfb8c2a44 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.35 2002/04/01 07:12:05 millert Exp $ */ +/* $OpenBSD: if_wi.c,v 1.36 2002/04/01 18:55:05 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.35 2002/04/01 07:12:05 millert Exp $"; + "$OpenBSD: if_wi.c,v 1.36 2002/04/01 18:55:05 markus Exp $"; #endif /* lint */ #ifdef foo @@ -1583,8 +1583,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 - sc->wi_icv++; /* XXX better IV needed */ + } 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++; /* prepend 24bit IV to tx key, byte order does not matter */ key[0] = sc->wi_icv >> 16; |