Linux wireless drivers development
 help / color / mirror / Atom feed
From: Chien Wong <m@xv97.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 1/6] wifi: mac80211: remove an unnecessary copy
Date: Sun,  9 Nov 2025 22:04:45 +0800	[thread overview]
Message-ID: <20251109140450.118106-2-m@xv97.com> (raw)
In-Reply-To: <20251109140450.118106-1-m@xv97.com>

Using a temporary buffer for saving the CMAC result is useless.
With the patch, ieee80211_aes_cmac() just resembles
ieee80211_aes_cmac_256().

Compile test only.

Fixes: 26717828b75d ("mac80211: aes-cmac: switch to shash CMAC driver")
Signed-off-by: Chien Wong <m@xv97.com>
---
 net/mac80211/aes_cmac.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/mac80211/aes_cmac.c b/net/mac80211/aes_cmac.c
index 48c04f89de20..a9a5b2396096 100644
--- a/net/mac80211/aes_cmac.c
+++ b/net/mac80211/aes_cmac.c
@@ -26,7 +26,6 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad,
 			const u8 *data, size_t data_len, u8 *mic)
 {
 	SHASH_DESC_ON_STACK(desc, tfm);
-	u8 out[AES_BLOCK_SIZE];
 	const __le16 *fc;
 
 	desc->tfm = tfm;
@@ -41,9 +40,7 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad,
 	} else {
 		crypto_shash_update(desc, data, data_len - CMAC_TLEN);
 	}
-	crypto_shash_finup(desc, zero, CMAC_TLEN, out);
-
-	memcpy(mic, out, CMAC_TLEN);
+	crypto_shash_finup(desc, zero, CMAC_TLEN, mic);
 }
 
 void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad,
-- 
2.51.2


  reply	other threads:[~2025-11-09 14:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-09 14:04 [PATCH 0/6] wifi: mac80211: refactor CMAC implementation Chien Wong
2025-11-09 14:04 ` Chien Wong [this message]
2025-11-10  7:34   ` [PATCH 1/6] wifi: mac80211: remove an unnecessary copy Johannes Berg
2025-11-10 13:33     ` Chien Wong
2025-11-10 13:35       ` Johannes Berg
2025-11-10 13:42         ` Chien Wong
2025-11-09 14:04 ` [PATCH 2/6] wifi: mac80211: fix CMAC functions not handling errors Chien Wong
2025-11-09 14:04 ` [PATCH 3/6] wifi: mac80211: add generic MMIE struct defines Chien Wong
2025-11-09 14:04 ` [PATCH 4/6] wifi: mac80211: utilize the newly defined CMAC constants Chien Wong
2025-11-09 14:04 ` [PATCH 5/6] wifi: mac80211: refactor CMAC crypt functions Chien Wong
2025-11-09 14:04 ` [PATCH 6/6] wifi: mac80211: refactor CMAC packet handlers Chien Wong
2025-11-10  7:43   ` Johannes Berg
2025-11-10 14:03     ` Chien Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251109140450.118106-2-m@xv97.com \
    --to=m@xv97.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox