From: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> To: Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> Subject: [PATCH v2] crypto: arm64/sm4 - Fix possible crash in GCM cryption Date: Mon, 30 Jan 2023 15:35:24 +0800 [thread overview] Message-ID: <20230130073524.68266-1-tianjia.zhang@linux.alibaba.com> (raw) In-Reply-To: <20230118141928.48136-1-tianjia.zhang@linux.alibaba.com> When the cryption total length is zero, GCM cryption call skcipher_walk_done() will cause an unexpected crash, so skip calling this function to avoid possible crash when the GCM cryption length is equal to zero. Fixes: ae1b83c7d572 ("crypto: arm64/sm4 - add CE implementation for GCM mode") Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> --- arch/arm64/crypto/sm4-ce-gcm-glue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/crypto/sm4-ce-gcm-glue.c b/arch/arm64/crypto/sm4-ce-gcm-glue.c index c450a2025ca9..29aa7470281d 100644 --- a/arch/arm64/crypto/sm4-ce-gcm-glue.c +++ b/arch/arm64/crypto/sm4-ce-gcm-glue.c @@ -178,6 +178,9 @@ static int gcm_crypt(struct aead_request *req, struct skcipher_walk *walk, kernel_neon_end(); + if (unlikely(!walk->nbytes)) + break; + err = skcipher_walk_done(walk, tail); if (err) return err; -- 2.24.3 (Apple Git-128)
WARNING: multiple messages have this Message-ID (diff)
From: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> To: Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> Subject: [PATCH v2] crypto: arm64/sm4 - Fix possible crash in GCM cryption Date: Mon, 30 Jan 2023 15:35:24 +0800 [thread overview] Message-ID: <20230130073524.68266-1-tianjia.zhang@linux.alibaba.com> (raw) In-Reply-To: <20230118141928.48136-1-tianjia.zhang@linux.alibaba.com> When the cryption total length is zero, GCM cryption call skcipher_walk_done() will cause an unexpected crash, so skip calling this function to avoid possible crash when the GCM cryption length is equal to zero. Fixes: ae1b83c7d572 ("crypto: arm64/sm4 - add CE implementation for GCM mode") Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> --- arch/arm64/crypto/sm4-ce-gcm-glue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/crypto/sm4-ce-gcm-glue.c b/arch/arm64/crypto/sm4-ce-gcm-glue.c index c450a2025ca9..29aa7470281d 100644 --- a/arch/arm64/crypto/sm4-ce-gcm-glue.c +++ b/arch/arm64/crypto/sm4-ce-gcm-glue.c @@ -178,6 +178,9 @@ static int gcm_crypt(struct aead_request *req, struct skcipher_walk *walk, kernel_neon_end(); + if (unlikely(!walk->nbytes)) + break; + err = skcipher_walk_done(walk, tail); if (err) return err; -- 2.24.3 (Apple Git-128) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-01-30 7:35 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-18 14:19 [PATCH] crypto: arm64/sm4 - Fix possible crash in GCM cryption Tianjia Zhang 2023-01-18 14:19 ` Tianjia Zhang 2023-01-18 14:54 ` Herbert Xu 2023-01-18 14:54 ` Herbert Xu 2023-01-30 7:34 ` Tianjia Zhang 2023-01-30 7:34 ` Tianjia Zhang 2023-01-30 8:15 ` Herbert Xu 2023-01-30 8:15 ` Herbert Xu 2023-01-30 9:01 ` Herbert Xu 2023-01-30 9:01 ` Herbert Xu 2023-01-31 9:39 ` Tianjia Zhang 2023-01-31 9:39 ` Tianjia Zhang 2023-01-30 7:35 ` Tianjia Zhang [this message] 2023-01-30 7:35 ` [PATCH v2] " Tianjia Zhang
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=20230130073524.68266-1-tianjia.zhang@linux.alibaba.com \ --to=tianjia.zhang@linux.alibaba.com \ --cc=catalin.marinas@arm.com \ --cc=davem@davemloft.net \ --cc=herbert@gondor.apana.org.au \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-crypto@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=will@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.