[PATCH v4] crypto: riscv/poly1305 - import OpenSSL/CRYPTOGAMS implementation
Eric Biggers
ebiggers at kernel.org
Sun Jul 6 16:35:08 PDT 2025
On Mon, Jun 23, 2025 at 08:50:57PM -0700, Eric Biggers wrote:
> Hi Zhihang,
>
> On Wed, Jun 11, 2025 at 11:31:51AM +0800, Zhihang Shao wrote:
> > From: Zhihang Shao <zhihang.shao.iscas at gmail.com>
> >
> > This is a straight import of the OpenSSL/CRYPTOGAMS Poly1305
> > implementation for riscv authored by Andy Polyakov.
> > The file 'poly1305-riscv.pl' is taken straight from this upstream
> > GitHub repository [0] at commit 33fe84bc21219a16825459b37c825bf4580a0a7b,
> > and this commit fixed a bug in riscv 64bit implementation.
> >
> > [0] https://github.com/dot-asm/cryptogams
> >
> > Signed-off-by: Zhihang Shao <zhihang.shao.iscas at gmail.com>
>
> I wanted to let you know that I haven't forgotten about this. However, the
> kernel currently lacks a proper test for Poly1305, and Poly1305 has some edge
> cases that are prone to bugs. So I'd like to find some time to add a proper
> Poly1305 test and properly review this. Also, I'm in the middle of fixing how
> the kernel's architecture-optimized crypto code is integrated; for example, I've
> just moved arch/*/lib/crypto/ to lib/crypto/.
>
> There will also need to be benchmark results that show that this code is
> actually worthwhile, on both RV32 and RV64. I am planning for the
> poly1305_kunit test to have a benchmark built-in, after which it will be
> straightforward to collect these.
>
> (The "perlasm" file does have some benchmark results in a comment, but they do
> not necessarily apply to the Poly1305 code in the kernel.)
>
> So this isn't a perfect time to be adding a new Poly1305 implementation, as
> we're not quite ready for it. But I'd indeed like to take this eventually.
My series
https://lore.kernel.org/linux-crypto/20250706232817.179500-1-ebiggers@kernel.org/
adds a KUnit test suite for Poly1305, including a benchmark, as I had planned.
- Eric
More information about the linux-riscv
mailing list