Skip to content

Commit 38762a5

Browse files
zx2c4gregkh
authored andcommitted
mac80211: use constant time comparison with keys
commit 2bdd713 upstream. Otherwise we risk leaking information via timing side channel. Fixes: fdf7cb4 ("mac80211: accept key reinstall without changing anything") Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Cc: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2586fa0 commit 38762a5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

net/mac80211/key.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/slab.h>
2020
#include <linux/export.h>
2121
#include <net/mac80211.h>
22+
#include <crypto/algapi.h>
2223
#include <asm/unaligned.h>
2324
#include "ieee80211_i.h"
2425
#include "driver-ops.h"
@@ -634,7 +635,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
634635
* new version of the key to avoid nonce reuse or replay issues.
635636
*/
636637
if (old_key && key->conf.keylen == old_key->conf.keylen &&
637-
!memcmp(key->conf.key, old_key->conf.key, key->conf.keylen)) {
638+
!crypto_memneq(key->conf.key, old_key->conf.key, key->conf.keylen)) {
638639
ieee80211_key_free_unused(key);
639640
ret = 0;
640641
goto out;

0 commit comments

Comments
 (0)