wireless-regdb: add package containing the wireless regulatory database
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 328-mac80211-use-constant-time-comparison-with-keys.patch
1 From 2bdd713b92a9cade239d3c7d15205a09f556624d Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Tue, 17 Oct 2017 20:32:07 +0200
4 Subject: [PATCH] mac80211: use constant time comparison with keys
5
6 Otherwise we risk leaking information via timing side channel.
7
8 Fixes: fdf7cb4185b6 ("mac80211: accept key reinstall without changing anything")
9 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
10 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 ---
12 net/mac80211/key.c | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15 --- a/net/mac80211/key.c
16 +++ b/net/mac80211/key.c
17 @@ -19,6 +19,7 @@
18 #include <linux/slab.h>
19 #include <linux/export.h>
20 #include <net/mac80211.h>
21 +#include <crypto/algapi.h>
22 #include <asm/unaligned.h>
23 #include "ieee80211_i.h"
24 #include "driver-ops.h"
25 @@ -635,7 +636,7 @@ int ieee80211_key_link(struct ieee80211_
26 * new version of the key to avoid nonce reuse or replay issues.
27 */
28 if (old_key && key->conf.keylen == old_key->conf.keylen &&
29 - !memcmp(key->conf.key, old_key->conf.key, key->conf.keylen)) {
30 + !crypto_memneq(key->conf.key, old_key->conf.key, key->conf.keylen)) {
31 ieee80211_key_free_unused(key);
32 ret = 0;
33 goto out;