From: Herbert Xu <herbert@gondor.apana.org.au>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Stephan Mueller <smueller@chronox.de>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
Joachim Vandersmissen <joachim@jvdsn.com>
Subject: Re: [PATCH] crypto: drbg - Remove support for "prediction resistance"
Date: Fri, 15 May 2026 18:20:37 +0800 [thread overview]
Message-ID: <agbzdbZgaTUf_ZFI@gondor.apana.org.au> (raw)
In-Reply-To: <20260506000258.70807-1-ebiggers@kernel.org>
On Tue, May 05, 2026 at 05:02:58PM -0700, Eric Biggers wrote:
> "Prediction resistance", i.e. the property that the RNG's output is
> unpredictable even after a state compromise, might sound like a nice
> property to have. In reality, it's not very practical, as it requires
> that fresh entropy be pulled on every request. (The normal Linux RNG
> doesn't provide prediction resistance.) In the case of drbg.c, that
> means pulling from "jitterentropy", which is extremely slow.
>
> For some perspective, running a simple benchmark, generating 32 random
> bytes takes the following amount of time:
>
> get_random_bytes(): 90 ns
> drbg_nopr_hmac_sha512: 3707 ns
> drbg_pr_hmac_sha512: 773082 ns
>
> So at least in this case, the "pr" (prediction-resistant) DRBG is over
> 200 times slower than the "nopr" (non-prediction-resistant) DRBG, or
> over 8000 times slower than the normal Linux RNG. While anyone using
> drbg.c has always had to tolerate that it's slower than the normal Linux
> RNG, the "pr" DRBG is clearly at another level of slowness.
>
> Thus, the following is also entirely unsurprising:
>
> - FIPS 140-3 doesn't actually require that SP800-90A DRBG
> implementations support prediction resistance. The non-prediction
> resistant DRBGs can be, and have been, certified.
>
> - drbg.c registers "drbg_nopr_hmac_sha512" with a higher cra_priority
> than "drbg_pr_hmac_sha512". So "drbg_nopr_hmac_sha512" is already
> the one actually being used in practice.
>
> Given these considerations, it's clear that "drbg_pr_hmac_sha512" isn't
> actually useful, and it essentially just existed as another curiosity in
> the museum of crypto algorithms. Remove it to simplify the code.
>
> Suggested-by: Joachim Vandersmissen <joachim@jvdsn.com>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
> crypto/drbg.c | 82 ++++++-------------
> crypto/testmgr.c | 21 +----
> crypto/testmgr.h | 202 -----------------------------------------------
> 3 files changed, 27 insertions(+), 278 deletions(-)
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
prev parent reply other threads:[~2026-05-15 10:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 0:02 [PATCH] crypto: drbg - Remove support for "prediction resistance" Eric Biggers
2026-05-15 10:20 ` 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=agbzdbZgaTUf_ZFI@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=Jason@zx2c4.com \
--cc=ebiggers@kernel.org \
--cc=joachim@jvdsn.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@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