public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
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 2/3] crypto: jitter - don't limit ->health_failure check to FIPS mode
Date: Tue, 30 Nov 2021 19:05:55 +0100	[thread overview]
Message-ID: <2423597.MaluLQq8qO@tauon.chronox.de> (raw)
In-Reply-To: <20211130141009.6791-3-nstange@suse.de>

Am Dienstag, 30. November 2021, 15:10:08 CET schrieb Nicolai Stange:

Hi Nicolai,

> The jitterentropy's Repetition Count Test (RCT) as well as the Adaptive
> Proportion Test (APT) are run unconditionally on any collected samples.
> However, their result, i.e. ->health_failure, will only get checked if
> fips_enabled is set, c.f. the jent_health_failure() wrapper.
> 
> I would argue that a RCT or APT failure indicates that something's
> seriously off and that this should always be reported as an error,
> independently of whether FIPS mode is enabled or not: it should be up to
> callers whether or not and how to handle jitterentropy failures.
> 
> Make jent_health_failure() to unconditionally return ->health_failure,
> independent of whether fips_enabled is set.
> 
> Note that fips_enabled isn't accessed from the jitterentropy code anymore
> now. Remove the linux/fips.h include as well as the jent_fips_enabled()
> wrapper.
> 
> Signed-off-by: Nicolai Stange <nstange@suse.de>

Reviewed-by: Stephan Mueller <smueller@chronox.de>

Thanks
Stephan

> ---
>  crypto/jitterentropy-kcapi.c | 6 ------
>  crypto/jitterentropy.c       | 4 ----
>  crypto/jitterentropy.h       | 1 -
>  3 files changed, 11 deletions(-)
> 
> diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
> index e8a4165a1874..2d115bec15ae 100644
> --- a/crypto/jitterentropy-kcapi.c
> +++ b/crypto/jitterentropy-kcapi.c
> @@ -40,7 +40,6 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/slab.h>
> -#include <linux/fips.h>
>  #include <linux/time.h>
>  #include <crypto/internal/rng.h>
> 
> @@ -60,11 +59,6 @@ void jent_zfree(void *ptr)
>  	kfree_sensitive(ptr);
>  }
> 
> -int jent_fips_enabled(void)
> -{
> -	return fips_enabled;
> -}
> -
>  void jent_panic(char *s)
>  {
>  	panic("%s", s);
> diff --git a/crypto/jitterentropy.c b/crypto/jitterentropy.c
> index 788d90749715..24e087c3f526 100644
> --- a/crypto/jitterentropy.c
> +++ b/crypto/jitterentropy.c
> @@ -298,10 +298,6 @@ static int jent_stuck(struct rand_data *ec, __u64
> current_delta) */
>  static int jent_health_failure(struct rand_data *ec)
>  {
> -	/* Test is only enabled in FIPS mode */
> -	if (!jent_fips_enabled())
> -		return 0;
> -
>  	return ec->health_failure;
>  }
> 
> diff --git a/crypto/jitterentropy.h b/crypto/jitterentropy.h
> index c83fff32d130..b7397b617ef0 100644
> --- a/crypto/jitterentropy.h
> +++ b/crypto/jitterentropy.h
> @@ -2,7 +2,6 @@
> 
>  extern void *jent_zalloc(unsigned int len);
>  extern void jent_zfree(void *ptr);
> -extern int jent_fips_enabled(void);
>  extern void jent_panic(char *s);
>  extern void jent_memcpy(void *dest, const void *src, unsigned int n);
>  extern void jent_get_nstime(__u64 *out);


Ciao
Stephan



  reply	other threads:[~2021-11-30 18:05 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 [this message]
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
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=2423597.MaluLQq8qO@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