aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-17 20:27:48 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-17 20:27:48 +0200
commit364abc22b5e13497f1c5dc9fecb39e19576701a4 (patch)
treeb441303ef59832d45fa555ee2bf3e52f7c13980c
parentMerge tag 'mac80211-for-davem-2017-10-16' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211 (diff)
downloadlinux-dev-364abc22b5e13497f1c5dc9fecb39e19576701a4.tar.xz
linux-dev-364abc22b5e13497f1c5dc9fecb39e19576701a4.zip
mac80211: use constant time comparison with keysjd/memcmp-wpa
Otherwise we risk leaking information via timing side channel. Fixes: fdf7cb4185b6 ("mac80211: accept key reinstall without changing anything") Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--net/mac80211/key.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index ae995c8480db..035d16fe926e 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -19,6 +19,7 @@
#include <linux/slab.h>
#include <linux/export.h>
#include <net/mac80211.h>
+#include <crypto/algapi.h>
#include <asm/unaligned.h>
#include "ieee80211_i.h"
#include "driver-ops.h"
@@ -635,7 +636,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
* new version of the key to avoid nonce reuse or replay issues.
*/
if (old_key && key->conf.keylen == old_key->conf.keylen &&
- !memcmp(key->conf.key, old_key->conf.key, key->conf.keylen)) {
+ !crypto_memneq(key->conf.key, old_key->conf.key, key->conf.keylen)) {
ieee80211_key_free_unused(key);
ret = 0;
goto out;