linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: add IEEE80211_KEY_FLAG_PUT_MMIE_SPACE to ieee80211_key_flags
@ 2019-07-13 15:03 Lorenzo Bianconi
  2019-07-13 19:58 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2019-07-13 15:03 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, nbd

Add IEEE80211_KEY_FLAG_PUT_MMIE_SPACE flag to ieee80211_key_flags in order
to allow the driver to notify mac80211 to allocate mmie space for AES_CMAC
hw cipher. Moreover mac80211 will set MMIE pn while MIC will be computed
in hw.
This is a preliminary patch to add BIP_CMAC_128 hw support to mt7615
driver

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 include/net/mac80211.h | 4 ++++
 net/mac80211/wpa.c     | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d26da013f7c0..204e5537def6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1702,6 +1702,9 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
  *	a TKIP key if it only requires MIC space. Do not set together with
  *	@IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key.
  * @IEEE80211_KEY_FLAG_NO_AUTO_TX: Key needs explicit Tx activation.
+ * @IEEE80211_KEY_FLAG_PUT_MMIE_SPACE: This flag should be set by the driver
+ *	for a AES_CMAC key if it only requires MMIE space. Moreover mac80211
+ *	will compute PN MMIE
  */
 enum ieee80211_key_flags {
 	IEEE80211_KEY_FLAG_GENERATE_IV_MGMT	= BIT(0),
@@ -1714,6 +1717,7 @@ enum ieee80211_key_flags {
 	IEEE80211_KEY_FLAG_RESERVE_TAILROOM	= BIT(7),
 	IEEE80211_KEY_FLAG_PUT_MIC_SPACE	= BIT(8),
 	IEEE80211_KEY_FLAG_NO_AUTO_TX		= BIT(9),
+	IEEE80211_KEY_FLAG_PUT_MMIE_SPACE	= BIT(10),
 };
 
 /**
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index a51c7909366e..969597ddbb76 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -946,7 +946,8 @@ ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx)
 
 	info = IEEE80211_SKB_CB(skb);
 
-	if (info->control.hw_key)
+	if (info->control.hw_key &&
+	    !(key->conf.flags & IEEE80211_KEY_FLAG_PUT_MMIE_SPACE))
 		return TX_CONTINUE;
 
 	if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
@@ -962,6 +963,9 @@ ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx)
 
 	bip_ipn_set64(mmie->sequence_number, pn64);
 
+	if (info->control.hw_key)
+		return TX_CONTINUE;
+
 	bip_aad(skb, aad);
 
 	/*
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: add IEEE80211_KEY_FLAG_PUT_MMIE_SPACE to ieee80211_key_flags
  2019-07-13 15:03 [PATCH] mac80211: add IEEE80211_KEY_FLAG_PUT_MMIE_SPACE to ieee80211_key_flags Lorenzo Bianconi
@ 2019-07-13 19:58 ` Johannes Berg
  2019-07-14  9:56   ` Lorenzo Bianconi
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2019-07-13 19:58 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: linux-wireless, nbd

On Sat, 2019-07-13 at 17:03 +0200, Lorenzo Bianconi wrote:
> Add IEEE80211_KEY_FLAG_PUT_MMIE_SPACE flag to ieee80211_key_flags in order
> to allow the driver to notify mac80211 to allocate mmie space for AES_CMAC
> hw cipher. Moreover mac80211 will set MMIE pn while MIC will be computed
> in hw.

Hmm. It probably should be called something like GENERATE_MMIE in line
with GENERATE_IV_MGMT etc.?

Purely adding the *space* wouldn't really be all that useful, we're not
really going to apply our tailroom request to this since it's a
(relatively rare) mgmt. frame, so ...

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: add IEEE80211_KEY_FLAG_PUT_MMIE_SPACE to ieee80211_key_flags
  2019-07-13 19:58 ` Johannes Berg
@ 2019-07-14  9:56   ` Lorenzo Bianconi
  0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2019-07-14  9:56 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, nbd, lorenzo.bianconi

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

> On Sat, 2019-07-13 at 17:03 +0200, Lorenzo Bianconi wrote:
> > Add IEEE80211_KEY_FLAG_PUT_MMIE_SPACE flag to ieee80211_key_flags in order
> > to allow the driver to notify mac80211 to allocate mmie space for AES_CMAC
> > hw cipher. Moreover mac80211 will set MMIE pn while MIC will be computed
> > in hw.
> 
> Hmm. It probably should be called something like GENERATE_MMIE in line
> with GENERATE_IV_MGMT etc.?
> 
> Purely adding the *space* wouldn't really be all that useful, we're not
> really going to apply our tailroom request to this since it's a
> (relatively rare) mgmt. frame, so ...

Hi Johannes,

ack, I will post v2 fixing it.

Regards,
Lorenzo

> 
> johannes
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-14  9:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-13 15:03 [PATCH] mac80211: add IEEE80211_KEY_FLAG_PUT_MMIE_SPACE to ieee80211_key_flags Lorenzo Bianconi
2019-07-13 19:58 ` Johannes Berg
2019-07-14  9:56   ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).