From: Herbert Xu <herbert@gondor.apana.org.au>
To: Qingfang Deng <dqfext@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
linux-crypto@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org,
"Christoph Müllner" <christoph.muellner@vrull.eu>,
"Heiko Stuebner" <heiko.stuebner@vrull.eu>,
"Qingfang Deng" <qingfang.deng@siflower.com.cn>
Subject: Re: [RFC PATCH] crypto: riscv: scalar accelerated GHASH
Date: Thu, 17 Apr 2025 15:21:37 +0800 [thread overview]
Message-ID: <aACsAT0sOzkqFblQ@gondor.apana.org.au> (raw)
In-Reply-To: <20250417064940.68469-1-dqfext@gmail.com>
On Thu, Apr 17, 2025 at 02:49:38PM +0800, Qingfang Deng wrote:
>
> +static int riscv64_clmul_ghash_update(struct shash_desc *desc, const u8 *src, unsigned int srclen)
> +{
> + struct riscv64_clmul_ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
> + struct riscv64_clmul_ghash_desc_ctx *dctx = shash_desc_ctx(desc);
> + unsigned int len;
> +
> + if (dctx->bytes) {
> + if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) {
> + memcpy(dctx->buffer + dctx->bytes, src, srclen);
> + dctx->bytes += srclen;
> + return 0;
> + }
> + memcpy(dctx->buffer + dctx->bytes, src, GHASH_DIGEST_SIZE - dctx->bytes);
> +
> + gcm_ghash_rv64i_zbc(&dctx->shash, ctx->key, dctx->buffer, GHASH_DIGEST_SIZE);
> +
> + src += GHASH_DIGEST_SIZE - dctx->bytes;
> + srclen -= GHASH_DIGEST_SIZE - dctx->bytes;
> + dctx->bytes = 0;
> + }
If this progresses beyond an RFC, you will need to do convert this
into a block-only algorithm on top of:
https://patchwork.kernel.org/project/linux-crypto/patch/b2eb753b083c029785c5e18238ca6cf06f48c86a.1744784515.git.herbert@gondor.apana.org.au/
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2025-04-17 7:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 6:49 [RFC PATCH] crypto: riscv: scalar accelerated GHASH Qingfang Deng
2025-04-17 6:57 ` Ard Biesheuvel
2025-04-17 7:25 ` Qingfang Deng
2025-04-17 7:39 ` Jeffrey Walton
2025-04-17 7:45 ` Qingfang Deng
2025-04-17 7:57 ` Ard Biesheuvel
2025-04-17 8:42 ` Qingfang Deng
2025-04-17 14:15 ` Ard Biesheuvel
2025-04-17 14:39 ` Qingfang Deng
2025-04-17 16:58 ` Eric Biggers
2025-04-18 1:48 ` Qingfang Deng
2025-04-17 7:21 ` Herbert Xu [this message]
2025-04-17 17:09 ` Eric Biggers
2025-04-18 2:49 ` Qingfang Deng
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=aACsAT0sOzkqFblQ@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=christoph.muellner@vrull.eu \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=heiko.stuebner@vrull.eu \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=qingfang.deng@siflower.com.cn \
/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