Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-crypto@vger.kernel.org,
	"Stephan Müller" <smueller@chronox.de>,
	"Jarkko Sakkinen" <jarkko@kernel.org>
Subject: Re: [PATCH v2] crypto: stdrng - Mitigate FIPS RNG failures
Date: Fri, 13 Nov 2026 21:12:59 +0800	[thread overview]
Message-ID: <avcM27FUnnnQTpRy@gondor.apana.org.au> (raw)
In-Reply-To: <20261106193711.3844890-1-ebiggers@kernel.org>

On Fri, Nov 06, 2026 at 07:37:11PM +0000, Eric Biggers wrote:
> If the kernel is booted with fips=1 and jitterentropy fails its health
> check, crypto_stdrng_get_bytes() can return an error and leave its
> output buffer uninitialized.
> 
> While the fallibility of the FIPS RNG is by design, leaving the output
> buffer uninitialized lacks practical defense-in-depth, as callers can
> forget to check the error code.  For example, the TPM2 driver didn't
> check the error code from ECDH private key generation
> (https://lore.kernel.org/r/20261025211119.138277-1-ebiggers@kernel.org/).
> Thus, fips=1 mode (ironically) caused a vulnerability.
> 
> Mitigate such bugs by filling the buffer with get_random_bytes_wait() in
> case of failure.  This helps in practice.  (For FIPS certifiability it
> makes no difference, as no "approved" entropy is claimed on failure.)
> 
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
> 
> v2: Resending this because Sashiko failed to apply it earlier, despite
>     my use of prerequisite-patch-id.  Its prerequisites are merged now,
>     so Sashiko should review it now.  I also added Jarkko's Reviewed-by.
>     This applies to cryptodev/master 82e91fe19fb8
> 
>  crypto/drbg.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
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

      reply	other threads:[~2026-11-13 13:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 19:37 [PATCH v2] crypto: stdrng - Mitigate FIPS RNG failures Eric Biggers
2026-11-13 13:12 ` Herbert Xu [this message]

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=avcM27FUnnnQTpRy@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=ebiggers@kernel.org \
    --cc=jarkko@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=smueller@chronox.de \
    /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