mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: x86@kernel.org, linux-sgx@vger.kernel.org,
	Jarkko Sakkinen <jarkko@kernel.org>,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [PATCH] x86/sgx: Use SHA-256 library API instead of crypto_shash API
Date: Mon, 28 Apr 2025 12:34:30 -0700	[thread overview]
Message-ID: <20250428193430.GB1606@sol.localdomain> (raw)
In-Reply-To: <ae48d190-03fd-4f4d-ab6f-969301e8b96e@intel.com>

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

  reply	other threads:[~2025-04-28 19:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28 18:38 Eric Biggers
2025-04-28 19:19 ` Dave Hansen
2025-04-28 19:34   ` Eric Biggers [this message]
2025-04-30 15:20   ` Jarkko Sakkinen

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=20250428193430.GB1606@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=dave.hansen@intel.com \
    --cc=jarkko@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=x86@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: 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

all inboxes | Powered by JetHome®