mac80211: don't compare TKIP TX MIC key in reinstall prevention
authorJohannes Berg <johannes.berg@intel.com>
Tue, 24 Oct 2017 19:12:13 +0000 (21:12 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 26 Nov 2017 13:51:11 +0000 (13:51 +0000)
commit3599fa6eb4415945063710c7be20c74ce6f2e3b4
tree6db4ad882e4206e98bb2b7ed797f878afb91a6b2
parentd7d24810ac55e2f3fb213d6acf80016a0d337c50
mac80211: don't compare TKIP TX MIC key in reinstall prevention

commit cfbb0d90a7abb289edc91833d0905931f8805f12 upstream.

For the reinstall prevention, the code I had added compares the
whole key. It turns out though that iwlwifi firmware doesn't
provide the TKIP TX MIC key as it's not needed in client mode,
and thus the comparison will always return false.

For client mode, thus always zero out the TX MIC key part before
doing the comparison in order to avoid accepting the reinstall
of the key with identical encryption and RX MIC key, but not the
same TX MIC key (since the supplicant provides the real one.)

Fixes: fdf7cb4185b6 ("mac80211: accept key reinstall without changing anything")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[bwh: Backported to 3.2:
 - Keep using memcmp() as we don't have crypto_memneq()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/mac80211/key.c