OpenBSD CVS

CVS log for src/sys/net80211/ieee80211_crypto_tkip.c


[BACK] Up to [local] / src / sys / net80211

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.33 / (download) - annotate - [select for diffs], Wed Mar 10 10:21:48 2021 UTC (3 years, 3 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, HEAD
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

spelling

ok gnezdo@ semarie@ mpi@

Revision 1.32 / (download) - annotate - [select for diffs], Wed Jul 15 22:49:07 2020 UTC (3 years, 10 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.31: +6 -6 lines
Diff to previous 1.31 (colored)

ieee80211: track micfail timeout with getuptime(9) instead of ticks

With input from stsp@.

ok stsp@

Revision 1.31 / (download) - annotate - [select for diffs], Fri May 15 14:21:09 2020 UTC (4 years ago) by stsp
Branch: MAIN
Changes since 1.30: +44 -19 lines
Diff to previous 1.30 (colored)

Fix CCMP replay check with 11n Rx aggregation and CCMP hardware offloading.

So far, drivers using hardware CCMP decryption were expected to keep the
most recently seen CCMP packet number (PN) up-to-date, and to discard frames
with lower PNs as replays.

A-MPDU subframes may legitimately arrive out of order, and the drivers skipped
CCMP replay checking for such frames. Re-ordering happens in ieee80211_inputm(),
after the driver is done with a frame. Drivers cannot tell replayed frames
apart from legitimate out-of-order retransmissions.

To fix this, update the PN value in ieee80211_inputm() after subframes have
been reordered into their proper sequence. Drivers still perform replay checks
but they no longer have to worry about updating the last seen PN value.

The 802.11 spec confirms that replay checking is supposed to happen after
A-MPDU re-ordering.

Tested by jmc@, benno@, solene@, and myself with the following drivers:
  athn(4), iwn(4), iwm(4), wpi(4), urtwn(4)

ok solene@

Revision 1.30 / (download) - annotate - [select for diffs], Fri Nov 9 14:14:31 2018 UTC (5 years, 7 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

M_LEADINGSPACE() and M_TRAILINGSPACE() are just wrappers for
m_leadingspace() and m_trailingspace(). Convert all callers to call
directly the functions and remove the defines.
OK krw@, mpi@

Revision 1.29 / (download) - annotate - [select for diffs], Sat Jun 3 11:58:10 2017 UTC (7 years ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.28: +3 -1 lines
Diff to previous 1.28 (colored)

Explicitly zero out the wepseed for TKIP and WEP.

ok stsp

Revision 1.28 / (download) - annotate - [select for diffs], Thu Mar 23 04:10:10 2017 UTC (7 years, 2 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.27: +5 -3 lines
Diff to previous 1.27 (colored)

Use explicit_bzero() to wipe out key material and add some sizes to free().

ok stsp

Revision 1.27 / (download) - annotate - [select for diffs], Sun Dec 18 08:00:20 2016 UTC (7 years, 5 months ago) by stsp
Branch: MAIN
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

Set the maximum TKIP countermeasure timeout to 90 seconds instead of 120.
Waiting more time does not buy us anything and makes a denial of service
a tiny bit easier.
Suggested by Mathy Vanhoef.

Revision 1.26 / (download) - annotate - [select for diffs], Sat Dec 17 18:35:54 2016 UTC (7 years, 5 months ago) by stsp
Branch: MAIN
Changes since 1.25: +24 -4 lines
Diff to previous 1.25 (colored)

Complete our half-done implementation of TKIP countermeasures in hostap mode.

The previous code would disable the AP until next reboot upon MIC failure.
Instead, disable the AP for 60 seconds, as required by the 802.11 standard.
I randomly added a bit of time (up to 120 seconds total) just because we can.

Problem reported by Mathy Vanhoef, thanks!
ok deraadt@
random input reyk@

Revision 1.25 / (download) - annotate - [select for diffs], Tue Nov 24 13:45:06 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.24: +1 -2 lines
Diff to previous 1.24 (colored)

No need to include <net/if_arp.h>

This header is only needed because <netinet/if_ether.h> declares a
structure that needs it.  But it turns out that <net/if.h> already
includes it as workaround.

A proper solution would be to stop declarting "struct ether_arp"
there.  But no driver should need this header.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Jul 15 22:16:42 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.23: +3 -5 lines
Diff to previous 1.23 (colored)

m_freem() can handle NULL, do not check for this condition beforehands.
ok stsp mpi

Revision 1.23 / (download) - annotate - [select for diffs], Tue Dec 23 03:24:08 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.22: +1 -3 lines
Diff to previous 1.22 (colored)

unifdef some more INET. v4 4life.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jul 12 18:44:22 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Nov 21 16:16:08 2013 UTC (10 years, 6 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.20: +1 -2 lines
Diff to previous 1.20 (colored)

Remove unneeded include.

ok deraadt@

Revision 1.20 / (download) - annotate - [select for diffs], Thu Nov 14 11:36:32 2013 UTC (10 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

improve maths and conditionals around ticks to cope with wraparound better.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Apr 5 11:48:28 2011 UTC (13 years, 2 months ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

Passing M_WAITOK to mbuf functions is supposed to be a contract between
the caller and the function that the function will not fail to allocate
memory and return a NULL pointer. However, m_dup_pkthdr() violates
this contract, making it possible for functions that pass M_WAITOK to
be surprised in ways that hurt.

Fix this by passing the wait flag all the way down the functions that
actually do the allocation for m_dup_pkthdr() so that we won't be
surprised.

man page update forthcoming

ok claudio@

Revision 1.18 / (download) - annotate - [select for diffs], Tue Jul 20 15:36:03 2010 UTC (13 years, 10 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

Switch some obvious network stack MAC comparisons from bcmp() to
timingsafe_bcmp().

ok deraadt@; committed over WPA.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Oct 30 20:32:25 2009 UTC (14 years, 7 months ago) by damien
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

missing \n in log() message.

from Jurjen Oskam.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Sep 24 16:03:10 2009 UTC (14 years, 8 months ago) by damien
Branch: MAIN
Changes since 1.15: +3 -7 lines
Diff to previous 1.15 (colored)

do not call m_free(n0) followed by m_freem(n0) when m_dup_pkthdr()
call fails.  this double-free was introduced with the M_DUP_PKTHRD
to m_dup_pkthdr change that got committed before I had a chance to
review it.

Revision 1.15 / (download) - annotate - [select for diffs], Sun Sep 13 14:42:52 2009 UTC (14 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.14: +9 -3 lines
Diff to previous 1.14 (colored)

M_DUP_PKTHDR() define -> m_dup_pkthdr() function to properly deal
with m_tag_copy_chain() failures.

Use m_defrag() to eliminate hand rolled defragging of mbufs and
some uses of M_DUP_PKTHDR().

Original diff from thib@, claudio@'s feedback integrated by me.

Tests kevlo@ claudio@, "reads ok" blambert@

ok thib@ claudio@, "m_defrag() bits ok" kettenis@

Revision 1.14 / (download) - annotate - [select for diffs], Thu Apr 16 18:32:24 2009 UTC (15 years, 1 month ago) by damien
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.13: +7 -4 lines
Diff to previous 1.13 (colored)

make TKIP TSC start at 1 (instead of 0) to match the standard.
many implementations (including ours) will drop frames with a
TSC equal to 0 (they are considered replayed frames.)

Revision 1.13 / (download) - annotate - [select for diffs], Tue Apr 14 17:43:26 2009 UTC (15 years, 2 months ago) by damien
Branch: MAIN
Changes since 1.12: +12 -10 lines
Diff to previous 1.12 (colored)

do not cache the computed TTAK unless MIC has been verified.
this prevents an attacker from changing the TTAK (DoS attack) by
sending a frame with a large TSC but with a bad ICV and/or MIC.
now an attacker can only invalidate the cached TTAK.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Dec 3 17:25:41 2008 UTC (15 years, 6 months ago) by damien
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

typos in comments - no binary change.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Nov 13 13:42:35 2008 UTC (15 years, 7 months ago) by djm
Branch: MAIN
Changes since 1.10: +6 -3 lines
Diff to previous 1.10 (colored)

use different TSCs when sending the two MIC failure report frames
to our AP as we enter TKIP countermeasures by caching the TSC of
the last frame to fail the MIC; prompted by and ok damien@

Revision 1.10 / (download) - annotate - [select for diffs], Thu Nov 13 08:37:19 2008 UTC (15 years, 7 months ago) by djm
Branch: MAIN
Changes since 1.9: +20 -7 lines
Diff to previous 1.9 (colored)

Mitigate the new WPA attack described in Beck, M. and Tews S. "Practical
attacks against WEP and WPA". The attack works by using the MIC failure
notification messages sent station->AP on MIC failure as an oracle to
verify guesses to reverse the CRC.

To stop this, we can skip sending these notify frames except when we
are going into "countermeasures" mode (drop the AP association, do not
process traffic for 60s). When we go into countermeasures, I send two
MIC failure notifications in a row - this should force the AP into
countermeasures too.

ok damien@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Sep 27 15:00:08 2008 UTC (15 years, 8 months ago) by damien
Branch: MAIN
Changes since 1.8: +9 -33 lines
Diff to previous 1.8 (colored)

Add some inline functions to test the presence of optional 802.11
header fields (Sequence Control, Address 4, QoS Control, +HTC) and
use them where appropriate.

Add ieee80211_get_qos() inline function to extract the QoS control
field of an 802.11 header instead of duplicating the same scary
code everywhere (the location of this field depends on the presence
of an Address 4 field).

Export ieee80211_up_to_ac() so that drivers can select the access
category to use based on the TID subfield of the QoS Control field.

Define more QoS-related bits for the RSN Capabilities field of RSN IE
(will be used later).

Revision 1.8 / (download) - annotate - [select for diffs], Wed Aug 27 09:05:04 2008 UTC (15 years, 9 months ago) by damien
Branch: MAIN
Changes since 1.7: +16 -5 lines
Diff to previous 1.7 (colored)

introduce new IEEE80211_STA_ONLY kernel option that can be set to
remove IBSS and HostAP support from net80211 and 802.11 drivers.
it can be used to shrink RAMDISK kernels for instance (like what
was done for wi(4)).
it also has the benefit of highlighting what is specific to IBSS
and HostAP modes in the code.
the cost is that we now have two code paths to maintain.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Aug 12 16:45:44 2008 UTC (15 years, 10 months ago) by damien
Branch: MAIN
Changes since 1.6: +10 -8 lines
Diff to previous 1.6 (colored)

maintain a count of TKIP and CCMP replayed frames.
some cleanup while i'm here.

Revision 1.6 / (download) - annotate - [select for diffs], Tue Aug 12 16:21:46 2008 UTC (15 years, 10 months ago) by damien
Branch: MAIN
Changes since 1.5: +25 -5 lines
Diff to previous 1.5 (colored)

retrieve the TID from QoS frames to use with the appropriate
replay counter.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Aug 12 16:14:45 2008 UTC (15 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

use MINCLSIZE to decide wether we need to allocate an mbuf cluster instead
of MLEM, damien ok

Revision 1.4 / (download) - annotate - [select for diffs], Sat Jul 26 12:36:15 2008 UTC (15 years, 10 months ago) by damien
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.3: +18 -14 lines
Diff to previous 1.3 (colored)

call Phase1 every 2**16 frames instead of calling it for every frame.
properly handle frames with an address 4 field (required for future work).
remove useless #includes.

Revision 1.3 / (download) - annotate - [select for diffs], Sat Apr 26 19:59:24 2008 UTC (16 years, 1 month ago) by damien
Branch: MAIN
Changes since 1.2: +19 -16 lines
Diff to previous 1.2 (colored)

small optimization of TKIP mixing phase 2 (for little-endian architectures).

Revision 1.2 / (download) - annotate - [select for diffs], Fri Apr 18 09:16:14 2008 UTC (16 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.1: +5 -5 lines
Diff to previous 1.1 (colored)

extend the if_ethersubr.c crc functions to support updating a running
crc in addition to the existing "oneshot" mode and use them to replace
ieee80211_crc_update() with the new ether_crc32_le_update(). Saves 1k
kernel bss + some code.

Mark the new ether_crc32_[lb]e_update functions as __pure for a
~25x speedup (on my i386 at least).

feedback and ok damien@

Revision 1.1 / (download) - annotate - [select for diffs], Wed Apr 16 18:32:15 2008 UTC (16 years, 1 month ago) by damien
Branch: MAIN

Kernel implementation of the 4-way handshake and group-key
handshake protocols (both supplicant and authenticator state
machines) as defined in the IEEE 802.11i standard.

Software implementation of the TKIP (Temporal Key Integrity
Protocol) and CCMP (CTR with CBC-MAC Protocol) protocols.

This diff doesn't implement any of the 802.1X authentication
protocols and thus only PSK authentication (using pre-shared
keys) is currently supported.

In concrete terms, this adds support for WPA-PSK and WPA2-PSK
protocols, both in station and hostap modes.

The following drivers are marked as WPA-capable and should
work:  bwi(4), malo(4), ral(4), iwn(4), wpi(4), ural(4),
rum(4), upgt(4), and zyd(4)

The following options have been added to ifconfig(8):
wpa, wpapsk, wpaprotos, wpaakms, wpaciphers, wpagroupcipher

wpa-psk(8) can be used to generate keys from passphrases.

tested by many@
ok deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.