From patchwork Fri Dec 8 13:32:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10102553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E7BE602A0 for ; Fri, 8 Dec 2017 13:32:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1633728C86 for ; Fri, 8 Dec 2017 13:32:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0ACEC28C88; Fri, 8 Dec 2017 13:32:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E5B628C86 for ; Fri, 8 Dec 2017 13:32:40 +0000 (UTC) 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=S2+sMZwI9lxzG/Pdzbwe3KX3g+lAEPX6Fyk+G2ZF2EI=; b=JFx 5iA1/I7VScBBWV8oznHfF8NGXcv/m2CaemycxJ+1iu99eZ0k6ssHmJm1SOPSVgN/Fou98bV0jUsMH 3KU/rTdibZkBchwEwDVj1pNcCr0uL+a/3VZNTsii605odZlhcP9euPTWA/oJV35u1HTh8RrgUlv1G 0pS82JzZK/6RgvH/oa4pNrUaQWDeiDVHl6WQoM1sGcCJ7mautviLJVDA6N/Hwc6xiirlU4m+PzZJ8 a15kg9+h6rx8oOf37gd0k25UKZeAaFpZdAJiBmkPN34IjaEpRD+akn9jQlIFUfbaQIICz766jFNYL PHHyIc+pQKc/AoVZc7cMFzhbgT2Zfbg==; 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 1eNIlW-00021F-Gu; Fri, 08 Dec 2017 13:32:34 +0000 Received: from alexa-out.qualcomm.com ([129.46.98.28]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eNIlT-0001i2-9w for ath10k@lists.infradead.org; Fri, 08 Dec 2017 13:32:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1512739951; x=1544275951; h=from:to:cc:subject:date:message-id; bh=7y7PcEbupkqP0mMM8Zfk3F2oPNO30GmybtX1S4Grtyo=; b=AcyzhEKeEDU6bOB5Qy6y2HftTBxCfw1NAvEhDcDHOxA9YsuTwC3rEpzI MNGwl9Eo1EzchdiXWqGU9EstXntPmEmtAbw42Je+zrwfZhEtl0oIv6xaG NcjAExHLCrfsMVuaUxpgFqz+nbisi+NbiNnL7eDDLjHczC8aa0AF4thw4 I=; Received: from ironmsg04-r-new.qualcomm.com (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by alexa-out.qualcomm.com with ESMTP; 08 Dec 2017 05:32:07 -0800 X-IronPort-AV: E=McAfee;i="5900,7806,8738"; a="1548189123" X-MGA-submission: =?us-ascii?q?MDHc1lAGrOQyWigqeTW0ZTAvQ6ClGvg3XKJDYU?= =?us-ascii?q?aCVbhnyTtk8ngRUxGNamE28L3Mujgwdqwbx5hXlrZiw8h0aaPCmRcS2M?= =?us-ascii?q?+IZbBfrbVoObiwGwnYFU3oOukbWOOORYBjKud4UYHNBThLbgGtGzqNca?= =?us-ascii?q?B+?= Received: from govinds-linux.qualcomm.com ([10.204.116.70]) by Ironmsg04-R.qualcomm.com with ESMTP; 08 Dec 2017 05:32:05 -0800 Received: by govinds-linux.qualcomm.com (Postfix, from userid 399420) id C1CA5358C; Fri, 8 Dec 2017 19:02:04 +0530 (IST) From: Govind Singh To: ath10k@lists.infradead.org Subject: [PATCH 1/2] mac80211: Populate RSC counter in set_key method Date: Fri, 8 Dec 2017 19:02:02 +0530 Message-Id: <1512739922-1529-1-git-send-email-govinds@qti.qualcomm.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171208_053231_476784_AC78E036 X-CRM114-Status: UNSURE ( 8.08 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Govind Singh , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Send RSC counter to driver in set_key method, so that FW/driver can drop the packet in PN check if received packet sequence no is less than current RSC counter during group keys(GTK) exchange. Signed-off-by: Govind Singh --- include/net/mac80211.h | 6 ++++-- net/mac80211/key.c | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 2ee4af2..2f0c91d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1564,6 +1564,8 @@ enum ieee80211_key_flags { IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(7), }; +#define IEEE80211_MAX_PN_LEN 16 + /** * struct ieee80211_key_conf - key information * @@ -1586,6 +1588,7 @@ enum ieee80211_key_flags { * - Temporal Authenticator Rx MIC Key (64 bits) * @icv_len: The ICV length for this key type * @iv_len: The IV length for this key type + * @rx_pn: Last received packet number, must be in little endian. */ struct ieee80211_key_conf { atomic64_t tx_pn; @@ -1596,11 +1599,10 @@ struct ieee80211_key_conf { u8 flags; s8 keyidx; u8 keylen; + u8 rx_pn[IEEE80211_MAX_PN_LEN]; u8 key[0]; }; -#define IEEE80211_MAX_PN_LEN 16 - #define TKIP_PN_TO_IV16(pn) ((u16)(pn & 0xffff)) #define TKIP_PN_TO_IV32(pn) ((u32)((pn >> 16) & 0xffffffff)) diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 9380493..15e1822 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -538,6 +538,12 @@ struct ieee80211_key * } memcpy(key->conf.key, key_data, key_len); INIT_LIST_HEAD(&key->list); + /* Assign receive packet sequence no, rx_pn remains in + * little endian format as seq is guaranteed to be in little + * endian format. + */ + if (seq) + memcpy(&key->conf.rx_pn, seq, seq_len); return key; }