From: Jason A. Donenfeld Date: Tue, 17 Oct 2017 18:32:07 +0000 (+0200) Subject: mac80211: use constant time comparison with keys X-Git-Tag: v3.18.82~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=32025b5c58605cdc0552d7976d010f10fa13f28a;p=thirdparty%2Fkernel%2Fstable.git mac80211: use constant time comparison with keys commit 2bdd713b92a9cade239d3c7d15205a09f556624d upstream. Otherwise we risk leaking information via timing side channel. Fixes: fdf7cb4185b6 ("mac80211: accept key reinstall without changing anything") Signed-off-by: Jason A. Donenfeld Signed-off-by: Johannes Berg Cc: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 8f794436b0289..54dfbaac8be65 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "ieee80211_i.h" #include "driver-ops.h" @@ -501,7 +502,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;