Skip to content

Commit cdac202

Browse files
zx2c4gregkh
authored andcommitted
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 <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 6440f0e commit cdac202

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"
@@ -633,7 +634,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
633634
* new version of the key to avoid nonce reuse or replay issues.
634635
*/
635636
if (old_key && key->conf.keylen == old_key->conf.keylen &&
636-
!memcmp(key->conf.key, old_key->conf.key, key->conf.keylen)) {
637+
!crypto_memneq(key->conf.key, old_key->conf.key, key->conf.keylen)) {
637638
ieee80211_key_free_unused(key);
638639
ret = 0;
639640
goto out;

0 commit comments

Comments
 (0)