[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250329183820.GB4018@sol.localdomain>
Date: Sat, 29 Mar 2025 11:38:20 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>
Subject: Re: [GIT PULL] Crypto Update for 6.15
On Sat, Mar 29, 2025 at 11:19:19AM -0700, Linus Torvalds wrote:
> On Sat, 29 Mar 2025 at 11:17, Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> >
> > I happened to just merge the rdma updates a couple of minutes ago, and
> > they actually removed the example I was using (ie the whole "use
> > crypto layer for crc32c" insanity).
>
> Heh. Looking closer, the "they" was actually you who did the patch and
> Leon who applied it.
>
> Linus
Yes. Those cases were just a single algorithm, though, so of course the library
was simpler. fs-verity supports two hash algorithms (SHA-256 and SHA-512), and
dm-verity unfortunately supports every hash algorithm the crypto API supports
since it accepts it as a string and passes it directly to the crypto API. I
know for sure dm-verity is used with at least SHA-256, SHA-1, and BLAKE2b, but
there could be more. The crypto API also supports various "national pride"
algorithms like SM3 and Streebog, for example, and some people might expect
those to work with dm-verity. (Unfortunately SM3 keeps getting pushed into
various standards, libraries, CPU instruction sets, etc.)
So for fs-verity we'd basically need:
if (using SHA-256)
sha256()
else
sha512()
(and the same for any other algorithms that may get added in the future)
And for dm-verity we'd basically need:
if (using SHA-256)
sha256()
else
Use crypto_ahash or crypto_shash to handle arbitrary algorithm
And that's okay -- we can do that. Just crypto_shash ends up being
approximately what is needed already, so just using it seems slightly
preferable. But using the libraries whenever possible would be fine with me
too.
- Eric
Powered by blists - more mailing lists