wok-6.x annotate wpa_supplicant/stuff/rebased-v2.6-0004-Prevent-installation-of-an-all-zero-TK.patch @ rev 20425

Up zstd (1.3.5) again
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Aug 12 14:15:39 2018 +0200 (2018-08-12)
parents
children
rev   line source
mojo@20131 1 From 8f82bc94e8697a9d47fa8774dfdaaede1084912c Mon Sep 17 00:00:00 2001
mojo@20131 2 From: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
mojo@20131 3 Date: Fri, 29 Sep 2017 04:22:51 +0200
mojo@20131 4 Subject: [PATCH 4/8] Prevent installation of an all-zero TK
mojo@20131 5
mojo@20131 6 Properly track whether a PTK has already been installed to the driver
mojo@20131 7 and the TK part cleared from memory. This prevents an attacker from
mojo@20131 8 trying to trick the client into installing an all-zero TK.
mojo@20131 9
mojo@20131 10 This fixes the earlier fix in commit
mojo@20131 11 ad00d64e7d8827b3cebd665a0ceb08adabf15e1e ('Fix TK configuration to the
mojo@20131 12 driver in EAPOL-Key 3/4 retry case') which did not take into account
mojo@20131 13 possibility of an extra message 1/4 showing up between retries of
mojo@20131 14 message 3/4.
mojo@20131 15
mojo@20131 16 Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
mojo@20131 17 ---
mojo@20131 18 src/common/wpa_common.h | 1 +
mojo@20131 19 src/rsn_supp/wpa.c | 5 ++---
mojo@20131 20 src/rsn_supp/wpa_i.h | 1 -
mojo@20131 21 3 files changed, 3 insertions(+), 4 deletions(-)
mojo@20131 22
mojo@20131 23 diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
mojo@20131 24 index d200285..1021ccb 100644
mojo@20131 25 --- a/src/common/wpa_common.h
mojo@20131 26 +++ b/src/common/wpa_common.h
mojo@20131 27 @@ -215,6 +215,7 @@ struct wpa_ptk {
mojo@20131 28 size_t kck_len;
mojo@20131 29 size_t kek_len;
mojo@20131 30 size_t tk_len;
mojo@20131 31 + int installed; /* 1 if key has already been installed to driver */
mojo@20131 32 };
mojo@20131 33
mojo@20131 34 struct wpa_gtk {
mojo@20131 35 diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
mojo@20131 36 index 7a2c68d..0550a41 100644
mojo@20131 37 --- a/src/rsn_supp/wpa.c
mojo@20131 38 +++ b/src/rsn_supp/wpa.c
mojo@20131 39 @@ -510,7 +510,6 @@ static void wpa_supplicant_process_1_of_4(struct wpa_sm *sm,
mojo@20131 40 os_memset(buf, 0, sizeof(buf));
mojo@20131 41 }
mojo@20131 42 sm->tptk_set = 1;
mojo@20131 43 - sm->tk_to_set = 1;
mojo@20131 44
mojo@20131 45 kde = sm->assoc_wpa_ie;
mojo@20131 46 kde_len = sm->assoc_wpa_ie_len;
mojo@20131 47 @@ -615,7 +614,7 @@ static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
mojo@20131 48 enum wpa_alg alg;
mojo@20131 49 const u8 *key_rsc;
mojo@20131 50
mojo@20131 51 - if (!sm->tk_to_set) {
mojo@20131 52 + if (sm->ptk.installed) {
mojo@20131 53 wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG,
mojo@20131 54 "WPA: Do not re-install same PTK to the driver");
mojo@20131 55 return 0;
mojo@20131 56 @@ -659,7 +658,7 @@ static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
mojo@20131 57
mojo@20131 58 /* TK is not needed anymore in supplicant */
mojo@20131 59 os_memset(sm->ptk.tk, 0, WPA_TK_MAX_LEN);
mojo@20131 60 - sm->tk_to_set = 0;
mojo@20131 61 + sm->ptk.installed = 1;
mojo@20131 62
mojo@20131 63 if (sm->wpa_ptk_rekey) {
mojo@20131 64 eloop_cancel_timeout(wpa_sm_rekey_ptk, sm, NULL);
mojo@20131 65 diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
mojo@20131 66 index 9a54631..41f371f 100644
mojo@20131 67 --- a/src/rsn_supp/wpa_i.h
mojo@20131 68 +++ b/src/rsn_supp/wpa_i.h
mojo@20131 69 @@ -24,7 +24,6 @@ struct wpa_sm {
mojo@20131 70 struct wpa_ptk ptk, tptk;
mojo@20131 71 int ptk_set, tptk_set;
mojo@20131 72 unsigned int msg_3_of_4_ok:1;
mojo@20131 73 - unsigned int tk_to_set:1;
mojo@20131 74 u8 snonce[WPA_NONCE_LEN];
mojo@20131 75 u8 anonce[WPA_NONCE_LEN]; /* ANonce from the last 1/4 msg */
mojo@20131 76 int renew_snonce;
mojo@20131 77 --
mojo@20131 78 2.7.4
mojo@20131 79