[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250428193430.GB1606@sol.localdomain>
Date: Mon, 28 Apr 2025 12:34:30 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Dave Hansen <dave.hansen@...el.com>
Cc: x86@...nel.org, linux-sgx@...r.kernel.org,
Jarkko Sakkinen <jarkko@...nel.org>, linux-kernel@...r.kernel.org,
linux-crypto@...r.kernel.org
Subject: Re: [PATCH] x86/sgx: Use SHA-256 library API instead of crypto_shash
API
On Mon, Apr 28, 2025 at 12:19:50PM -0700, Dave Hansen wrote:
> On 4/28/25 11:38, Eric Biggers wrote:
> > -static int sgx_get_key_hash(const void *modulus, void *hash)
> > -{
> > - struct crypto_shash *tfm;
> > - int ret;
> > -
> > - tfm = crypto_alloc_shash("sha256", 0, CRYPTO_ALG_ASYNC);
> > - if (IS_ERR(tfm))
> > - return PTR_ERR(tfm);
> > -
> > - ret = __sgx_get_key_hash(tfm, modulus, hash);
> > -
> > - crypto_free_shash(tfm);
> > - return ret;
> > -}
>
> Let's just say, theoretically, that there was some future hardware that
> also supported SHA384. There doesn't seem to be a SHA-384 library API.
>
> Would you leave the crypto_shash() in place if that were to be
> happening? Theoretically of course.
Currently SHA-384 is only available via crypto_shash, but I'm planning to add a
library API for that too. (Well, I actually want SHA-512, but it's
straightforward to support SHA-384 alongside that.) It's up to you if you'd
then want to use crypto_shash vs. the library functions for both, but I'd lean
towards just using the library functions.
- Eric
Powered by blists - more mailing lists