From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Nicolai Stange <nstange@suse.de>
Cc: Torsten Duwe <duwe@suse.de>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Nicolai Stange <nstange@suse.de>
Subject: Re: [PATCH 3/3] crypto: jitter - quit sample collection loop upon RCT failure
Date: Tue, 30 Nov 2021 19:07:13 +0100 [thread overview]
Message-ID: <4130352.XCsR1xZqcM@tauon.chronox.de> (raw)
In-Reply-To: <20211130141009.6791-4-nstange@suse.de>
Am Dienstag, 30. November 2021, 15:10:09 CET schrieb Nicolai Stange:
Hi Nicolai,
> The jitterentropy collection loop in jent_gen_entropy() can in principle
> run indefinitely without making any progress if it only receives stuck
> measurements as determined by jent_stuck(). After 31 consecutive stuck
> samples, the Repetition Count Test (RCT) would fail anyway and the
> jitterentropy RNG instances moved into ->health_failure == 1 state.
> jent_gen_entropy()'s caller, jent_read_entropy() would then check for
> this ->health_failure condition and return an error if found set. It
> follows that there's absolutely no point in continuing the collection loop
> in jent_gen_entropy() once the RCT has failed.
>
> Make the jitterentropy collection loop more robust by terminating it upon
> jent_health_failure() so that it won't continue to run indefinitely without
> making any progress.
>
> Signed-off-by: Nicolai Stange <nstange@suse.de>
Reviewed-by: Stephan Mueller <smueller@chronox.de>
Thanks
Stephan
> ---
> crypto/jitterentropy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/crypto/jitterentropy.c b/crypto/jitterentropy.c
> index 24e087c3f526..8f5283f28ed3 100644
> --- a/crypto/jitterentropy.c
> +++ b/crypto/jitterentropy.c
> @@ -547,7 +547,7 @@ static void jent_gen_entropy(struct rand_data *ec)
> /* priming of the ->prev_time value */
> jent_measure_jitter(ec);
>
> - while (1) {
> + while (!jent_health_failure(ec)) {
> /* If a stuck measurement is received, repeat measurement */
> if (jent_measure_jitter(ec))
> continue;
Ciao
Stephan
next prev parent reply other threads:[~2021-11-30 18:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 14:10 [PATCH 0/3] crypto: jitterentropy - bound collection loop Nicolai Stange
2021-11-30 14:10 ` [PATCH 1/3] crypto: drbg - ignore jitterentropy errors if not in FIPS mode Nicolai Stange
2021-11-30 18:04 ` Stephan Mueller
2021-11-30 14:10 ` [PATCH 2/3] crypto: jitter - don't limit ->health_failure check to " Nicolai Stange
2021-11-30 18:05 ` Stephan Mueller
2021-11-30 14:10 ` [PATCH 3/3] crypto: jitter - quit sample collection loop upon RCT failure Nicolai Stange
2021-11-30 18:07 ` Stephan Mueller [this message]
2021-12-11 5:55 ` [PATCH 0/3] crypto: jitterentropy - bound collection loop Herbert Xu
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=4130352.XCsR1xZqcM@tauon.chronox.de \
--to=smueller@chronox.de \
--cc=davem@davemloft.net \
--cc=duwe@suse.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nstange@suse.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