Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
mac80211: use constant time comparison with keys
Browse files Browse the repository at this point in the history
Otherwise we risk leaking information via timing side channel.

Change-Id: I777afd16f7b0ca8a5ab1b95ddc66689afdc96636
Fixes: fdf7cb4185b6 ("mac80211: accept key reinstall without changing anything")
Signed-off-by: Jason A. Donenfeld <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
zx2c4 authored and ppajda committed Oct 23, 2017
1 parent ab03f36 commit d6927ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/mac80211/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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"
Expand Down Expand Up @@ -494,7 +495,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;
Expand Down

0 comments on commit d6927ac

Please sign in to comment.