From patchwork Tue Mar 28 19:56:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan.Wanner@microchip.com X-Patchwork-Id: 13191493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4285DC6FD18 for ; Tue, 28 Mar 2023 19:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6QQqMddfx/VZM0rYnxID7vJxIiA4oyWYi6C4VrKxprI=; b=LkmUPyoA9hJ2pv 5YS+/RmnTUbksKbahvNn2rKFtKUn+wUN8DyyWbZkS7ApmxyLrVbMLJk94qJIXecjRu6pkkjdszsQF npa+AMj3f84l3y8TUc41058ICb98NK04HhMrn+XpJye/2Y1+UZJ/kbOr/oMYoFitWd/Z7G8E3h73X gkSVRvgjpexHQrJpS0NgCxbbekvFENemxU3Mv6FUMKPdPH12i9lsz1Oe8beFtn7/xiRUYmfgmZErm TBsRDUPS5qSPIOzjXtiUhtdAZgl5J0rj1sE3/BJbeVlfHgGtxL2VmAcAwIRExyEcZ8dYuM4FKKoIz rstc/rnIcgmCi8chxEGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phFQs-00FhsN-1Z; Tue, 28 Mar 2023 19:56:38 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phFQi-00FhnY-0s for linux-arm-kernel@lists.infradead.org; Tue, 28 Mar 2023 19:56:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1680033388; x=1711569388; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/F2de+iehabZIds7kVXZap20zLfbkzaLODGMMhLmfRE=; b=aDgp8JOJGCx7J9EaMix6d3gj7+hvZxFbsiAfvsOYRMP6ad7xxkK0Vtbg r+h44KnVUs2kpl31qZkJFI8x9ikm/qFP+jZgIsXbXUmb9i1EHWQ+9Aeew fGqdMga6mCe0KbwHcW7mSpizEqgQAtA+w141x3WeZjD8t4Jp5nX+V+ELu GrCun5W5E6gvT7cocVYKnA77BNC1Cab5fkgE6jHWbpDdhqWmNM0bm7ZPA ZrQ16CKitptP/JNSZnXVdz+EdxUTs4pmMgvqM8bNy7l8nPV3Sz0JL569c IGyUYs+9MX15li2DGZbDgnx3WPX9+QNVqdspZbF9kqM1WNpQyLAlFzZdM Q==; X-IronPort-AV: E=Sophos;i="5.98,297,1673938800"; d="scan'208";a="206741354" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 28 Mar 2023 12:56:22 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 28 Mar 2023 12:56:21 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 28 Mar 2023 12:56:21 -0700 From: To: , , , , CC: , , , Ryan Wanner Subject: [PATCH 1/4] crypto: atmel-sha: Add zero length message digest support for hmac Date: Tue, 28 Mar 2023 12:56:26 -0700 Message-ID: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230328_125628_316958_1EF09388 X-CRM114-Status: GOOD ( 13.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ryan Wanner Add softare padding to hmac-sha digest for zero length messages. Using the atmel_sha_fill_padding() to fill the buffer with a padded empty message with a length of the block size. Create a temporary scatter list from the padded buffer to pass into the data processing functions. Signed-off-by: Ryan Wanner --- drivers/crypto/atmel-sha.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 00be792e605c..b42e3a0b8cb5 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -1948,14 +1948,32 @@ static int atmel_sha_hmac_digest2(struct atmel_sha_dev *dd) struct atmel_sha_reqctx *ctx = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct atmel_sha_hmac_ctx *hmac = crypto_ahash_ctx(tfm); + struct scatterlist *sgbuf; size_t hs = ctx->hash_size; size_t i, num_words = hs / sizeof(u32); bool use_dma = false; u32 mr; /* Special case for empty message. */ - if (!req->nbytes) - return atmel_sha_complete(dd, -EINVAL); // TODO: + if (!req->nbytes) { + req->nbytes = 0; + ctx->bufcnt = 0; + ctx->digcnt[0] = 0; + ctx->digcnt[1] = 0; + switch (ctx->flags & SHA_FLAGS_ALGO_MASK) { + case SHA_FLAGS_SHA1: + case SHA_FLAGS_SHA224: + case SHA_FLAGS_SHA256: + atmel_sha_fill_padding(ctx, 64); + break; + + case SHA_FLAGS_SHA384: + case SHA_FLAGS_SHA512: + atmel_sha_fill_padding(ctx, 128); + break; + } + sg_init_one(&dd->tmp, ctx->buffer, ctx->bufcnt); + } /* Check DMA threshold and alignment. */ if (req->nbytes > ATMEL_SHA_DMA_THRESHOLD && @@ -1985,12 +2003,20 @@ static int atmel_sha_hmac_digest2(struct atmel_sha_dev *dd) atmel_sha_write(dd, SHA_CR, SHA_CR_FIRST); + /* Special case for empty message. */ + if (!req->nbytes) { + sgbuf = &dd->tmp; + req->nbytes = ctx->bufcnt; + } else { + sgbuf = req->src; + } + /* Process data. */ if (use_dma) - return atmel_sha_dma_start(dd, req->src, req->nbytes, + return atmel_sha_dma_start(dd, sgbuf, req->nbytes, atmel_sha_hmac_final_done); - return atmel_sha_cpu_start(dd, req->src, req->nbytes, false, true, + return atmel_sha_cpu_start(dd, sgbuf, req->nbytes, false, true, atmel_sha_hmac_final_done); } From patchwork Tue Mar 28 19:56:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan.Wanner@microchip.com X-Patchwork-Id: 13191496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02000C76196 for ; Tue, 28 Mar 2023 19:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eI+19FruVF2Zt9bNOm50WMWZ0phzpNt5XqO84t2BrFc=; b=ccghHiO1DvqEx0 sZnSEiho3RsLDHEP6jZ+NHkBdv7sJJ0/IZYu20N7kiJNqSWPVXyokC3hM7NTcN3PoA7bQcj+3kslF oJGy+u3QpMgTPACkpEKoy6oh3DCqvCxGxGD+q2ECcD+v8ylahgsv/gtoCqn4M9zHI5ECMUF6hBXjH M3WHtcnOrKh+252CNc2RcXlWd/k5k/vRZPvcQqR/t+U91liSCP2iXgrCT/tDzPZqbhRQzyjOyZnS0 u0SBKWgf7olddkg0seEZl0T7qDmh2QbYuiHjpm15R/82GDJ5Ip4mLCcIxInsw/AMTSuN1rBGvvQ9M YJWN1VVCoh42g2vRIr7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phFQt-00Fhsl-1i; Tue, 28 Mar 2023 19:56:39 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phFQl-00FhoU-1r for linux-arm-kernel@lists.infradead.org; Tue, 28 Mar 2023 19:56:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1680033391; x=1711569391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3pNleVDsOKO+SQXxRv8CZk7/1rEyCdwTx0A5JZpAvdk=; b=WDOb+pV25qaw/lOVtm8qbMv60VAayG9wSpDA7eRWRmZicL+Ih3Xkc7fD d4dfrbOLI04xtqmItPVthM6eQpKNmkw4dCtqf5lLyjFjgulRaVsbaqhEP Gr1zlEEAIAg25F+tjtU9JTmiB9qJLdN9bkVBNgZ5HMqk8CyugRpXQNhHf Okk0ItOVHVca/7//XEjorpzq6z9ysJvhGGcYxZXm9F4jaIb8iuorTpN77 LA8ABVGbpmNG4l+4836xFsgj2BuhIU4n6CrA1uIGGYIeY+vIXd1iaZJ+b mxqV9vs8awqodn7MeNu2aP7tlLPEWyqpN3hI8MbeavaUhHJtPOzPrUlsN w==; X-IronPort-AV: E=Sophos;i="5.98,297,1673938800"; d="scan'208";a="144351914" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 28 Mar 2023 12:56:24 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 28 Mar 2023 12:56:22 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 28 Mar 2023 12:56:22 -0700 From: To: , , , , CC: , , , Ryan Wanner Subject: [PATCH 2/4] crypto: atmel-tdes - Detecting in-place operations with two sg lists Date: Tue, 28 Mar 2023 12:56:27 -0700 Message-ID: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230328_125631_684579_0416392B X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ryan Wanner Avoiding detecting finely in-place operations with different scatter lists. Copying the source data for decryption into rctx->lastc regardless if the operation is in-place or not. This allows in-place operations with different scatter lists without affecting other operations. This approach takes less resources than parsing both scatter lists to check if they are equal. Signed-off-by: Ryan Wanner --- drivers/crypto/atmel-tdes.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c index 8b7bc1076e0d..edf18073516e 100644 --- a/drivers/crypto/atmel-tdes.c +++ b/drivers/crypto/atmel-tdes.c @@ -565,17 +565,12 @@ atmel_tdes_set_iv_as_last_ciphertext_block(struct atmel_tdes_dev *dd) if (req->cryptlen < ivsize) return; - if (rctx->mode & TDES_FLAGS_ENCRYPT) { + if (rctx->mode & TDES_FLAGS_ENCRYPT) scatterwalk_map_and_copy(req->iv, req->dst, req->cryptlen - ivsize, ivsize, 0); - } else { - if (req->src == req->dst) - memcpy(req->iv, rctx->lastc, ivsize); - else - scatterwalk_map_and_copy(req->iv, req->src, - req->cryptlen - ivsize, - ivsize, 0); - } + else + memcpy(req->iv, rctx->lastc, ivsize); + } static void atmel_tdes_finish_req(struct atmel_tdes_dev *dd, int err) @@ -722,7 +717,7 @@ static int atmel_tdes_crypt(struct skcipher_request *req, unsigned long mode) rctx->mode = mode; if ((mode & TDES_FLAGS_OPMODE_MASK) != TDES_FLAGS_ECB && - !(mode & TDES_FLAGS_ENCRYPT) && req->src == req->dst) { + !(mode & TDES_FLAGS_ENCRYPT)) { unsigned int ivsize = crypto_skcipher_ivsize(skcipher); if (req->cryptlen >= ivsize) From patchwork Tue Mar 28 19:56:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan.Wanner@microchip.com X-Patchwork-Id: 13191494 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64E2BC761A6 for ; Tue, 28 Mar 2023 19:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fPLBuKyXsIOBoZHP0P2vmHbg+gtiBbwJ8z1Sg8xQYWg=; b=Ct4Bf6E3FvbQuh g46pIU7riePwdXpG6VEKWsMv7FfTwpspuOwRAxPAypjQ2PvRjLQ7/V+rSbndLexMXQeU3FyW2s2bC DRe2kmbHcl8HN0/Ob37aeQek8F5vtxS2RyAQpPqUzrWo7j2UqF8iX9oI6swRCA/1MY5jx6dUTqCDq Rf1JvM2zlTmMzpKpNWnpj/9DR2Llb2LR3kaSyRdP3mptPbl1WdTcODEM62sOgNRNIFRAPo5ZEp/wU 7zbAaCeZugEQHr7bK0kY3t2JCSb1cMrD1U/+mrdrNDsfB3iigkeHo5/1R48T/W08XVTMZoA2oI+Md 9LBFGbDPnzok4v15fkzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phFQu-00FhtC-21; Tue, 28 Mar 2023 19:56:40 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phFQn-00FhoU-18 for linux-arm-kernel@lists.infradead.org; Tue, 28 Mar 2023 19:56:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1680033393; x=1711569393; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B79al2p37wc0hLyQzNhdQMnWH/qY4G74yzTaZc4Qtqg=; b=G7Yzi2MWkcxplcPQFCoYlZYIeSTskHZ5OvXpFYWgDJYv+oKrR2jN865C JtRkLchtpLlc5glavmO1dy1dL9UFul7H7IG4+LLKm1CGpo185gnMWzO5v 9b5M2ZJeh7JnDYWafXqyTYeL9TWwdATqqjmgLWyBK/B1xuuHMULyiKuIe c3Y733FrIqsZC6Eg9rC20Kfz0wwYUQ83Jpm4yzoEOuD3TjpupbaxwAkzY m1HXRwTFy1uVEV5gYqCKTlaUPritQzfbcLdl6agnyZBasRcJsPZX1dik2 X5BJYSh12IZ9X1+o3hLDpq72Qc5h7M9oGaSWFS4G4Ah7gDH9PznyRi3q2 A==; X-IronPort-AV: E=Sophos;i="5.98,297,1673938800"; d="scan'208";a="144351915" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 28 Mar 2023 12:56:24 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 28 Mar 2023 12:56:22 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 28 Mar 2023 12:56:22 -0700 From: To: , , , , CC: , , , Ryan Wanner Subject: [PATCH 3/4] crypto: atmel-aes - Detecting in-place operations two sg lists Date: Tue, 28 Mar 2023 12:56:28 -0700 Message-ID: <74e969a12021b008d12d871d8d4d9162905f3c48.1680019905.git.Ryan.Wanner@microchip.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230328_125633_457665_052E695A X-CRM114-Status: GOOD ( 11.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ryan Wanner Avoiding detecting finely in-place operations with different scatter lists. Copying the source data for decryption into rctx->lastc regardless if the operation is in-place or not. This allows in-place operations with different scatter lists. This approach takes less resources than parsing both scatter lists to check if they are equal. Signed-off-by: Ryan Wanner --- drivers/crypto/atmel-aes.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 063394cfa874..08a923c2a0eb 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -493,17 +493,11 @@ static void atmel_aes_set_iv_as_last_ciphertext_block(struct atmel_aes_dev *dd) if (req->cryptlen < ivsize) return; - if (rctx->mode & AES_FLAGS_ENCRYPT) { + if (rctx->mode & AES_FLAGS_ENCRYPT) scatterwalk_map_and_copy(req->iv, req->dst, req->cryptlen - ivsize, ivsize, 0); - } else { - if (req->src == req->dst) - memcpy(req->iv, rctx->lastc, ivsize); - else - scatterwalk_map_and_copy(req->iv, req->src, - req->cryptlen - ivsize, - ivsize, 0); - } + else + memcpy(req->iv, rctx->lastc, ivsize); } static inline struct atmel_aes_ctr_ctx * @@ -1146,7 +1140,7 @@ static int atmel_aes_crypt(struct skcipher_request *req, unsigned long mode) rctx->mode = mode; if (opmode != AES_FLAGS_ECB && - !(mode & AES_FLAGS_ENCRYPT) && req->src == req->dst) { + !(mode & AES_FLAGS_ENCRYPT)) { unsigned int ivsize = crypto_skcipher_ivsize(skcipher); if (req->cryptlen >= ivsize) From patchwork Tue Mar 28 19:56:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan.Wanner@microchip.com X-Patchwork-Id: 13191495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF728C6FD18 for ; Tue, 28 Mar 2023 19:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=89Pav4c7rVs2myE4GjUJp5gG1UtKNDPq380LNJCDpZs=; b=4IFQCyuwSgB/Od cZ8lZBXZfnoos1hHNK5DGmSUVI900tO4q4oJudidULXx9BT6+1sY+LSmWziKUOQJMEDMM+NA5AHYF OHKPhHV6zR+zeFhf3Mr8KbIWgWnR5q4lZi3wch1Jw5UhnsEfStITkr+cAxRj8FE8xfzhmanktBGHs f6CaVajSw5ZQ8gYhbGvv55KuVWVfhQD5w4qiHzWHiVaY8nv+MYfA9TMocZV6NykCoCK4rQUQOHhxZ ioyXatmwWVzzdEzpcrF8eYAjI4a76RFZEIjJW5I9A9fBIndZWFt2YCuWsN6kXeD5Erl+6cWnYhTYe gmVW6lWuePUC+cNrxPNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phFQv-00Fhti-2U; Tue, 28 Mar 2023 19:56:41 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phFQn-00Fhqd-1t for linux-arm-kernel@lists.infradead.org; Tue, 28 Mar 2023 19:56:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1680033393; x=1711569393; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d3xmdzUlUHuX0xIMraGebBNCDEpGfEWNIysVoHmlrc8=; b=jxzPTa88PPsobgfgnn3z0YN0ozFZD/rI3Vh7U0xO1OnOxdyp/6idjGPb 9MUNOj2sVKTM7GngigHiEZcv+791GFrr51dXPi/NC8LxQfBEa9FevlWFW ncfUJ6xOfh3SzYLno07DPaYgPFsB9K42bzNaymRimGEh2WrdIE1GeVBnp dm2/n2GwQF9dp1OwIgOawY+uBOTQ2/8YX6Tr65gWywHY9pYZol+9CFmQk hZC1gONaQWVKIg8aTKlqUcL039marKuuTbf8Xi+L03zOJOclGs81qqjQt uaC/4CPRUeJo+u3OEqF/Un+u+2JWAtKIt5/CIr9medXb4IbVWby9LBoZd A==; X-IronPort-AV: E=Sophos;i="5.98,297,1673938800"; d="scan'208";a="144351916" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 28 Mar 2023 12:56:24 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 28 Mar 2023 12:56:22 -0700 Received: from ryan-Precision-3630-Tower.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 28 Mar 2023 12:56:22 -0700 From: To: , , , , CC: , , , Ryan Wanner Subject: [PATCH 4/4] crypto: atmel-aes - Match cfb block size with generic implementation Date: Tue, 28 Mar 2023 12:56:29 -0700 Message-ID: <5a21411d8dd263155f86fb067d446b3359a60c9b.1680019905.git.Ryan.Wanner@microchip.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230328_125633_693489_0CCED7FA X-CRM114-Status: GOOD ( 10.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ryan Wanner Change blocksize to match the cfb(aes) generic implementation. Signed-off-by: Ryan Wanner --- drivers/crypto/atmel-aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 08a923c2a0eb..012cdf60d9d2 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -1335,7 +1335,7 @@ static struct skcipher_alg aes_algs[] = { { .base.cra_name = "cfb(aes)", .base.cra_driver_name = "atmel-cfb-aes", - .base.cra_blocksize = AES_BLOCK_SIZE, + .base.cra_blocksize = 1, .base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .init = atmel_aes_init_tfm,