From patchwork Wed Oct 25 08:26:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 830137 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="edTR6nEy"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMNY40zJqz9sPk for ; Wed, 25 Oct 2017 19:27:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=yWcQwtx3BU6tj0eaNyq5pvD5D2fXxtVm9fLBzqQJGOk=; b=edT R6nEyFLjXoPvPlWrqXezFx6ufNwZzf7u1UdM7pwn7HSa+jWDPoiOinFI/rxphwfKG+o9CGUSKfIzR vLpxY51ItyFqDnVqqcnknoh5RoJYYQ8YlIq/nXzpGe1HjKT80HTX6/bB/CmlCNtBsFVBdmVhXBWDS 3YP2ZD8fXZMUm0VzpY2DZnJi0vYtdBT9xPwFOFh/RcRfHWSlUQNYLPXs7tOzXyPxpenB/f5n2T87t F1dTcW2ZJeW3iopDt9njDhKrvyhJ5rL3+tWO3E7sM7mGJaztWE0+mSovZL9XV2hU+9o5J3inXu2tl gJaMsBYCssxDCURR7FlBYX0DOTth7LQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e7H1i-0004Q4-VY; Wed, 25 Oct 2017 08:27:02 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:191:72ef::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e7H1J-0004Bk-98 for hostap@lists.infradead.org; Wed, 25 Oct 2017 08:26:40 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1e7H0u-0000OL-Jp; Wed, 25 Oct 2017 10:26:12 +0200 From: Johannes Berg To: hostap@lists.infradead.org Subject: [PATCH] Allow forcing group rekeying for testing purposes Date: Wed, 25 Oct 2017 10:26:10 +0200 Message-Id: <20171025082610.10639-1-johannes@sipsolutions.net> X-Mailer: git-send-email 2.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171025_012637_541846_341D77D7 X-CRM114-Status: UNSURE ( 8.61 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johannes Berg MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg In order to test the WoWLAN GTK rekeying KRACK mitigation, add a REKEY_GTK command that can be used at certain points of the test. Signed-off-by: Johannes Berg --- hostapd/ctrl_iface.c | 10 ++++++++++ src/ap/wpa_auth.c | 7 +++++++ src/ap/wpa_auth.h | 1 + 3 files changed, 18 insertions(+) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index af2a2821bce0..1d181405f6fd 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -2191,6 +2191,13 @@ static int hostapd_ctrl_resend_group_m1(struct hostapd_data *hapd, plain ? restore_tk : NULL, hapd, sta); } + +static int hostapd_ctrl_rekey_gtk(struct hostapd_data *hapd) +{ + wpa_auth_rekey_gtk(hapd->wpa_auth); + return 0; +} + #endif /* CONFIG_TESTING_OPTIONS */ @@ -2922,6 +2929,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, } else if (os_strncmp(buf, "RESEND_GROUP_M1 ", 16) == 0) { if (hostapd_ctrl_resend_group_m1(hapd, buf + 16) < 0) reply_len = -1; + } else if (os_strcmp(buf, "REKEY_GTK") == 0) { + if (hostapd_ctrl_rekey_gtk(hapd) < 0) + reply_len = -1; #endif /* CONFIG_TESTING_OPTIONS */ } else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) { if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12)) diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index 713bee068ac2..378bde2887f6 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -4774,4 +4774,11 @@ int wpa_auth_resend_group_m1(struct wpa_state_machine *sm, return 0; } + +void wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth) +{ + eloop_cancel_timeout(wpa_rekey_gtk, wpa_auth, NULL); + eloop_register_timeout(0, 0, wpa_rekey_gtk, wpa_auth, NULL); +} + #endif /* CONFIG_TESTING_OPTIONS */ diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h index 22f33dd14103..28abd41c0b1f 100644 --- a/src/ap/wpa_auth.h +++ b/src/ap/wpa_auth.h @@ -437,5 +437,6 @@ int wpa_auth_resend_m3(struct wpa_state_machine *sm, int wpa_auth_resend_group_m1(struct wpa_state_machine *sm, void (*cb)(void *ctx1, void *ctx2), void *ctx1, void *ctx2); +void wpa_auth_rekey_gtk(struct wpa_authenticator *wpa_auth); #endif /* WPA_AUTH_H */