From patchwork Mon Aug 6 19:46:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathy Vanhoef X-Patchwork-Id: 954190 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cs.kuleuven.be Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XkWLT7kr"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 41kpCK75Jlz9ryt for ; Tue, 7 Aug 2018 05:50:03 +1000 (AEST) 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:References: In-Reply-To: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:List-Owner; bh=ub2DG5Kn/cGNl0OiviHidoqZXswW59Io73qdwULhXMI=; b=XkWLT7krM+b119POLYdPxiqR05 yPS/rHTk5M6yWDOll/Uoh7aPR1BLMTFu4ffY/QWfDoP1ZcxHNE3s7vHkrz2p/O86xeO8d83PYfKXH X2ZawbeN+1GD127RiSYxtOq3J5L1QROAN7ddUhJk41e51Ar5YiPjUrkwhs+/wevk2cWoEfb7EGugb 9nSxRTHHsrvF+WGxItNRWZ+RQ4WJQW4oSCJrHneUGbUiAIABLb2TfMifCAkJZyezpFC8TOOtKXA8U FsvoS4Hpaf5mIoPMoQ4IWKMldOtfZGyzX/ZXdd348UhLuCiXvbMYRgb2F5oPVMEjRxeu9Yurug+jP /EC7NXjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmlVg-0007Zu-SL; Mon, 06 Aug 2018 19:49:44 +0000 Received: from vmailrelay1.cs.kuleuven.be ([2a02:2c40:0:a000::118] helo=hermes4.cs.kuleuven.be) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmlVJ-0007Bx-4u for hostap@lists.infradead.org; Mon, 06 Aug 2018 19:49:22 +0000 Received: from dr-zook.cs.kuleuven.be. (vdr-zook1.cs.kuleuven.be [IPv6:2a02:2c40:500:a005::12c]) by hermes4.cs.kuleuven.be. with ESMTP id w76JiH3Y018397 for ; Mon, 6 Aug 2018 21:44:17 +0200 Received: from localhost (localhost [127.0.0.1]) by dr-zook.cs.kuleuven.be. (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id w76JeZej020567 for ; Mon, 6 Aug 2018 21:44:16 +0200 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dr-zook.cs.kuleuven.be. X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Virus-Scanned: Debian amavisd-new at dr-zook.cs.kuleuven.be Received: from dr-zook.cs.kuleuven.be. ([127.0.0.1]) by localhost (dr-zook.cs.kuleuven.be [127.0.0.1]) (amavisd-new, port 10023) with LMTP id 43rAtTKo-lqe for ; Mon, 6 Aug 2018 21:44:08 +0200 (CEST) Received: from oryx.cs.kuleuven.be. (mail4.cs.kuleuven.be [IPv6:2a02:2c40:0:a000::122]) by dr-zook.cs.kuleuven.be. (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id w76Ji2gu020706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 6 Aug 2018 21:44:02 +0200 Received: from localhost.localdomain (ip-83-134-207-58.dsl.scarlet.be [83.134.207.58]) (authenticated bits=0) by oryx.cs.kuleuven.be. (A_Good_MTA/8.14.4/Debian-4.1ubuntu1) with ESMTP id w76Jhl8j019837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 6 Aug 2018 21:44:02 +0200 From: Maty Vanhoef To: hostap@lists.infradead.org Subject: [PATCH 02/25] Make channel_info available to the supplicant state machine Date: Mon, 6 Aug 2018 15:46:20 -0400 Message-Id: <20180806194643.1328-3-Mathy.Vanhoef@cs.kuleuven.be> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180806194643.1328-1-Mathy.Vanhoef@cs.kuleuven.be> References: <20180806194643.1328-1-Mathy.Vanhoef@cs.kuleuven.be> X-Scanned-By: MIMEDefang 2.73 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180806_124921_477353_5B375694 X-CRM114-Status: GOOD ( 13.45 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 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: Maty Vanhoef MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This adds the necessary functions and callbacks to make the channel_info driver API available to the supplicant state machine that implements the 4-way and group key handshake. Signed-off-by: Mathy Vanhoef --- src/rsn_supp/wpa.h | 2 ++ src/rsn_supp/wpa_i.h | 8 ++++++++ wpa_supplicant/driver_i.h | 8 ++++++++ wpa_supplicant/wpas_glue.c | 8 ++++++++ wpa_supplicant/wpas_glue.h | 1 + 5 files changed, 27 insertions(+) diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index 21f4b1781..d52b8e033 100644 --- a/src/rsn_supp/wpa.h +++ b/src/rsn_supp/wpa.h @@ -18,6 +18,7 @@ struct wpa_sm; struct eapol_sm; struct wpa_config_blob; struct hostapd_freq_params; +struct wpa_channel_info; struct wpa_sm_ctx { void *ctx; /* pointer to arbitrary upper level context */ @@ -82,6 +83,7 @@ struct wpa_sm_ctx { int (*key_mgmt_set_pmk)(void *ctx, const u8 *pmk, size_t pmk_len); void (*fils_hlp_rx)(void *ctx, const u8 *dst, const u8 *src, const u8 *pkt, size_t pkt_len); + int (*channel_info)(void *ctx, struct wpa_channel_info *ci); }; diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h index b94b17a85..d7ea29b81 100644 --- a/src/rsn_supp/wpa_i.h +++ b/src/rsn_supp/wpa_i.h @@ -198,6 +198,14 @@ static inline int wpa_sm_set_key(struct wpa_sm *sm, enum wpa_alg alg, seq, seq_len, key, key_len); } +static inline int wpa_sm_channel_info(struct wpa_sm *sm, + struct wpa_channel_info *ci) +{ + WPA_ASSERT(sm->ctx->channel_info); + return sm->ctx->channel_info(sm->ctx->ctx, ci); +} + + static inline void * wpa_sm_get_network_ctx(struct wpa_sm *sm) { WPA_ASSERT(sm->ctx->get_network_ctx); diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index 078de23f7..5581bb064 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -492,6 +492,14 @@ static inline int wpa_drv_signal_poll(struct wpa_supplicant *wpa_s, return -1; } +static inline int wpa_drv_channel_info(struct wpa_supplicant *wpa_s, + struct wpa_channel_info *ci) +{ + if (wpa_s->driver->channel_info) + return wpa_s->driver->channel_info(wpa_s->drv_priv, ci); + return -1; +} + static inline int wpa_drv_pktcnt_poll(struct wpa_supplicant *wpa_s, struct hostap_sta_driver_data *sta) { diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c index 4634ed7fc..e22f20fa7 100644 --- a/wpa_supplicant/wpas_glue.c +++ b/wpa_supplicant/wpas_glue.c @@ -517,6 +517,13 @@ static int wpa_supplicant_set_key(void *_wpa_s, enum wpa_alg alg, } +static int wpa_supplicant_channel_info(void *_wpa_s, struct wpa_channel_info *ci) +{ + struct wpa_supplicant *wpa_s = _wpa_s; + return wpa_drv_channel_info(wpa_s, ci); +} + + static int wpa_supplicant_mlme_setprotection(void *wpa_s, const u8 *addr, int protection_type, int key_type) @@ -1233,6 +1240,7 @@ int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s) ctx->set_rekey_offload = wpa_supplicant_set_rekey_offload; ctx->key_mgmt_set_pmk = wpa_supplicant_key_mgmt_set_pmk; ctx->fils_hlp_rx = wpa_supplicant_fils_hlp_rx; + ctx->channel_info = wpa_supplicant_channel_info; wpa_s->wpa = wpa_sm_init(ctx); if (wpa_s->wpa == NULL) { diff --git a/wpa_supplicant/wpas_glue.h b/wpa_supplicant/wpas_glue.h index 5585e5615..27aa69869 100644 --- a/wpa_supplicant/wpas_glue.h +++ b/wpa_supplicant/wpas_glue.h @@ -10,6 +10,7 @@ #define WPAS_GLUE_H enum wpa_ctrl_req_type; +struct wpa_channel_info; int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s); int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s);