Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2197959/?format=api
{ "id": 2197959, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2197959/?format=api", "project": { "id": 12, "url": "http://patchwork.ozlabs.org/api/1.0/projects/12/?format=api", "name": "Linux CIFS Client", "link_name": "linux-cifs-client", "list_id": "linux-cifs.vger.kernel.org", "list_email": "linux-cifs@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260218213501.136844-16-ebiggers@kernel.org>", "date": "2026-02-18T21:35:01", "name": "[15/15] wifi: mac80211: Use AES-CMAC library in aes_s2v()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4bed9b22fa51a002e5b8f5b5ad7bacad154df1e8", "submitter": { "id": 74690, "url": "http://patchwork.ozlabs.org/api/1.0/people/74690/?format=api", "name": "Eric Biggers", "email": "ebiggers@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260218213501.136844-16-ebiggers@kernel.org/mbox/", "series": [ { "id": 492621, "url": "http://patchwork.ozlabs.org/api/1.0/series/492621/?format=api", "date": "2026-02-18T21:34:46", "name": "AES-CMAC library", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492621/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2197959/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-cifs+bounces-9456-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-cifs@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=S7cvUUs2;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-cifs+bounces-9456-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"S7cvUUs2\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fGVJZ6SYyz1xvS\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 19 Feb 2026 08:39:10 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 40CBB302A7AC\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 18 Feb 2026 21:38:29 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 611D233AD87;\n\tWed, 18 Feb 2026 21:37:01 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A36D3375D5;\n\tWed, 18 Feb 2026 21:37:00 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id F2924C2BCB4;\n\tWed, 18 Feb 2026 21:36:59 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1771450621; cv=none;\n b=B0OziwgOG8oIf1jF2T5GxCA8AVXCKkZcVRR3MxDwahbxsu4vpenDFAakexYvfUCf299cdNSE+u0sQvrbmStxTqRuxBFOIkYRjDSkqPDZG8WA5h3UzJhhPcd2cFFl7iiXVToiN5sxxaPvFYRCM6VpFkRwjJLHmYBppz2KtCylBLM=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1771450621; c=relaxed/simple;\n\tbh=MukATPOpIzjauahsnyw5/LgkOoeHj4ze2Fz2UAEw0rw=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=bCARcHjaAa9I7psvg9/omScekM0LR5tdRQGf+BgCxPiPrgCLtJpJiMMOUEw10fY0+mxPBewE/BdQVPR1s2Jfy7tvoH0+5ZDX0HqrrdqfrOa+oD8EgOCbA/YZHim90f/ZSjp2tXILWiF5JxQPFJArATF1mnH9i4uguP2GDy1T9/k=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=S7cvUUs2; arc=none smtp.client-ip=10.30.226.201", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1771450620;\n\tbh=MukATPOpIzjauahsnyw5/LgkOoeHj4ze2Fz2UAEw0rw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=S7cvUUs2MbPHShNzMReODOXXx0055P+B5i6wUSiG6e9WEN6m6eioCUpXWfIz4SPHd\n\t o2Jp/TgF7O6k4rs3A3NJzK32Pj7x0O9bWs75sgyw05p+8QPHl6J3iXMMcY2J/BSv03\n\t pBovcGwo2XyB8w7WI+rZziQRib7Q7PXdefsaQDZORQah7mhr+W2KC+iVMfIJnwzjTn\n\t Wv2DoQtvp6FRV+kUAeWFOybO9Ojm9HEgHVDla4zh2fQOJnhZTDqYNKySvsx6PNr4D4\n\t lDUbu1wGNmXaGuU4e3y2JDb25S/GbeOLp7/b1VANEkR53N572/mF3aKaK96nxZXrDo\n\t gYvDPt8fT+elQ==", "From": "Eric Biggers <ebiggers@kernel.org>", "To": "linux-crypto@vger.kernel.org", "Cc": "linux-kernel@vger.kernel.org,\n\tArd Biesheuvel <ardb@kernel.org>,\n\t\"Jason A . Donenfeld\" <Jason@zx2c4.com>,\n\tHerbert Xu <herbert@gondor.apana.org.au>,\n\tlinux-arm-kernel@lists.infradead.org,\n\tlinux-cifs@vger.kernel.org,\n\tlinux-wireless@vger.kernel.org,\n\tEric Biggers <ebiggers@kernel.org>", "Subject": "[PATCH 15/15] wifi: mac80211: Use AES-CMAC library in aes_s2v()", "Date": "Wed, 18 Feb 2026 13:35:01 -0800", "Message-ID": "<20260218213501.136844-16-ebiggers@kernel.org>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260218213501.136844-1-ebiggers@kernel.org>", "References": "<20260218213501.136844-1-ebiggers@kernel.org>", "Precedence": "bulk", "X-Mailing-List": "linux-cifs@vger.kernel.org", "List-Id": "<linux-cifs.vger.kernel.org>", "List-Subscribe": "<mailto:linux-cifs+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-cifs+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "Now that AES-CMAC has a library API, convert aes_s2v() to use it instead\nof a \"cmac(aes)\" crypto_shash. The result is faster and simpler code.\n\nIt's also more reliable, since with the library the only step that can\nfail is preparing the key. In contrast, crypto_shash_digest(),\ncrypto_shash_init(), crypto_shash_update(), and crypto_shash_final()\ncould all fail and return an errno value. aes_s2v() ignored these\nerrors, which was a bug. So that bug is fixed as well.\n\nAs part of this, change the prototype of aes_s2v() to take the raw key\ndirectly instead of a prepared key. Its only two callers prepare a key\nfor each call, so it might as well be done directly in aes_s2v().\n\nSince this removes the last dependency on the \"cmac(aes)\" crypto_shash\nfrom mac80211, also remove the 'select CRYPTO_CMAC'.\n\nSigned-off-by: Eric Biggers <ebiggers@kernel.org>\n---\n net/mac80211/Kconfig | 1 -\n net/mac80211/fils_aead.c | 48 ++++++++++++++--------------------------\n 2 files changed, 17 insertions(+), 32 deletions(-)", "diff": "diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig\nindex 0afbe4f4f976..d6bc295e23a1 100644\n--- a/net/mac80211/Kconfig\n+++ b/net/mac80211/Kconfig\n@@ -6,11 +6,10 @@ config MAC80211\n \tselect CRYPTO_LIB_AES_CBC_MACS\n \tselect CRYPTO_LIB_ARC4\n \tselect CRYPTO_AES\n \tselect CRYPTO_CCM\n \tselect CRYPTO_GCM\n-\tselect CRYPTO_CMAC\n \tselect CRC32\n \thelp\n \t This option enables the hardware independent IEEE 802.11\n \t networking stack.\n \ndiff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c\nindex 912c46f74d24..d2f4a17eab99 100644\n--- a/net/mac80211/fils_aead.c\n+++ b/net/mac80211/fils_aead.c\n@@ -2,17 +2,15 @@\n /*\n * FILS AEAD for (Re)Association Request/Response frames\n * Copyright 2016, Qualcomm Atheros, Inc.\n */\n \n-#include <crypto/aes.h>\n-#include <crypto/hash.h>\n+#include <crypto/aes-cbc-macs.h>\n #include <crypto/skcipher.h>\n #include <crypto/utils.h>\n \n #include \"ieee80211_i.h\"\n-#include \"aes_cmac.h\"\n #include \"fils_aead.h\"\n \n static void gf_mulx(u8 *pad)\n {\n \tu64 a = get_unaligned_be64(pad);\n@@ -20,58 +18,63 @@ static void gf_mulx(u8 *pad)\n \n \tput_unaligned_be64((a << 1) | (b >> 63), pad);\n \tput_unaligned_be64((b << 1) ^ ((a >> 63) ? 0x87 : 0), pad + 8);\n }\n \n-static int aes_s2v(struct crypto_shash *tfm,\n+static int aes_s2v(const u8 *in_key, size_t key_len,\n \t\t size_t num_elem, const u8 *addr[], size_t len[], u8 *v)\n {\n \tu8 d[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE] = {};\n-\tSHASH_DESC_ON_STACK(desc, tfm);\n+\tstruct aes_cmac_key key;\n+\tstruct aes_cmac_ctx ctx;\n \tsize_t i;\n+\tint res;\n \n-\tdesc->tfm = tfm;\n+\tres = aes_cmac_preparekey(&key, in_key, key_len);\n+\tif (res)\n+\t\treturn res;\n \n \t/* D = AES-CMAC(K, <zero>) */\n-\tcrypto_shash_digest(desc, tmp, AES_BLOCK_SIZE, d);\n+\taes_cmac(&key, tmp, AES_BLOCK_SIZE, d);\n \n \tfor (i = 0; i < num_elem - 1; i++) {\n \t\t/* D = dbl(D) xor AES_CMAC(K, Si) */\n \t\tgf_mulx(d); /* dbl */\n-\t\tcrypto_shash_digest(desc, addr[i], len[i], tmp);\n+\t\taes_cmac(&key, addr[i], len[i], tmp);\n \t\tcrypto_xor(d, tmp, AES_BLOCK_SIZE);\n \t}\n \n-\tcrypto_shash_init(desc);\n+\taes_cmac_init(&ctx, &key);\n \n \tif (len[i] >= AES_BLOCK_SIZE) {\n \t\t/* len(Sn) >= 128 */\n \t\t/* T = Sn xorend D */\n-\t\tcrypto_shash_update(desc, addr[i], len[i] - AES_BLOCK_SIZE);\n+\t\taes_cmac_update(&ctx, addr[i], len[i] - AES_BLOCK_SIZE);\n \t\tcrypto_xor(d, addr[i] + len[i] - AES_BLOCK_SIZE,\n \t\t\t AES_BLOCK_SIZE);\n \t} else {\n \t\t/* len(Sn) < 128 */\n \t\t/* T = dbl(D) xor pad(Sn) */\n \t\tgf_mulx(d); /* dbl */\n \t\tcrypto_xor(d, addr[i], len[i]);\n \t\td[len[i]] ^= 0x80;\n \t}\n \t/* V = AES-CMAC(K, T) */\n-\tcrypto_shash_finup(desc, d, AES_BLOCK_SIZE, v);\n+\taes_cmac_update(&ctx, d, AES_BLOCK_SIZE);\n+\taes_cmac_final(&ctx, v);\n \n+\tmemzero_explicit(&key, sizeof(key));\n \treturn 0;\n }\n \n /* Note: addr[] and len[] needs to have one extra slot at the end. */\n static int aes_siv_encrypt(const u8 *key, size_t key_len,\n \t\t\t const u8 *plain, size_t plain_len,\n \t\t\t size_t num_elem, const u8 *addr[],\n \t\t\t size_t len[], u8 *out)\n {\n \tu8 v[AES_BLOCK_SIZE];\n-\tstruct crypto_shash *tfm;\n \tstruct crypto_skcipher *tfm2;\n \tstruct skcipher_request *req;\n \tint res;\n \tstruct scatterlist src[1], dst[1];\n \tu8 *tmp;\n@@ -81,19 +84,11 @@ static int aes_siv_encrypt(const u8 *key, size_t key_len,\n \taddr[num_elem] = plain;\n \tlen[num_elem] = plain_len;\n \tnum_elem++;\n \n \t/* S2V */\n-\n-\ttfm = crypto_alloc_shash(\"cmac(aes)\", 0, 0);\n-\tif (IS_ERR(tfm))\n-\t\treturn PTR_ERR(tfm);\n-\t/* K1 for S2V */\n-\tres = crypto_shash_setkey(tfm, key, key_len);\n-\tif (!res)\n-\t\tres = aes_s2v(tfm, num_elem, addr, len, v);\n-\tcrypto_free_shash(tfm);\n+\tres = aes_s2v(key /* K1 */, key_len, num_elem, addr, len, v);\n \tif (res)\n \t\treturn res;\n \n \t/* Use a temporary buffer of the plaintext to handle need for\n \t * overwriting this during AES-CTR.\n@@ -144,11 +139,10 @@ static int aes_siv_encrypt(const u8 *key, size_t key_len,\n static int aes_siv_decrypt(const u8 *key, size_t key_len,\n \t\t\t const u8 *iv_crypt, size_t iv_c_len,\n \t\t\t size_t num_elem, const u8 *addr[], size_t len[],\n \t\t\t u8 *out)\n {\n-\tstruct crypto_shash *tfm;\n \tstruct crypto_skcipher *tfm2;\n \tstruct skcipher_request *req;\n \tstruct scatterlist src[1], dst[1];\n \tsize_t crypt_len;\n \tint res;\n@@ -196,19 +190,11 @@ static int aes_siv_decrypt(const u8 *key, size_t key_len,\n \tcrypto_free_skcipher(tfm2);\n \tif (res)\n \t\treturn res;\n \n \t/* S2V */\n-\n-\ttfm = crypto_alloc_shash(\"cmac(aes)\", 0, 0);\n-\tif (IS_ERR(tfm))\n-\t\treturn PTR_ERR(tfm);\n-\t/* K1 for S2V */\n-\tres = crypto_shash_setkey(tfm, key, key_len);\n-\tif (!res)\n-\t\tres = aes_s2v(tfm, num_elem, addr, len, check);\n-\tcrypto_free_shash(tfm);\n+\tres = aes_s2v(key /* K1 */, key_len, num_elem, addr, len, check);\n \tif (res)\n \t\treturn res;\n \tif (memcmp(check, frame_iv, AES_BLOCK_SIZE) != 0)\n \t\treturn -EINVAL;\n \treturn 0;\n", "prefixes": [ "15/15" ] }