2020-01-16 00:55:21

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH v28 09/12] LRNG - add Jitter RNG fast noise source

On 1/15/20 2:34 AM, Stephan Müller wrote:

>
> CC: "Eric W. Biederman" <[email protected]>
> CC: "Alexander E. Patrakov" <[email protected]>
> CC: "Ahmed S. Darwish" <[email protected]>
> CC: "Theodore Y. Ts'o" <[email protected]>
> CC: Willy Tarreau <[email protected]>
> CC: Matthew Garrett <[email protected]>
> CC: Vito Caputo <[email protected]>
> CC: Andreas Dilger <[email protected]>
> CC: Jan Kara <[email protected]>
> CC: Ray Strode <[email protected]>
> CC: William Jon McCann <[email protected]>
> CC: zhangjs <[email protected]>
> CC: Andy Lutomirski <[email protected]>
> CC: Florian Weimer <[email protected]>
> CC: Lennart Poettering <[email protected]>
> CC: Nicolai Stange <[email protected]>
> Reviewed-by: Marcelo Henrique Cerri <[email protected]>
> Reviewed-by: Roman Drahtmueller <[email protected]>
> Tested-by: Roman Drahtmüller <[email protected]>
> Tested-by: Marcelo Henrique Cerri <[email protected]>
> Tested-by: Neil Horman <[email protected]>
> Signed-off-by: Stephan Mueller <[email protected]>
> ---
> drivers/char/lrng/Kconfig | 11 +++++
> drivers/char/lrng/Makefile | 1 +
> drivers/char/lrng/lrng_jent.c | 89 +++++++++++++++++++++++++++++++++++
> 3 files changed, 101 insertions(+)
> create mode 100644 drivers/char/lrng/lrng_jent.c
>
> diff --git a/drivers/char/lrng/Kconfig b/drivers/char/lrng/Kconfig
> index 0d070a3897dd..10b7cbdb8c8e 100644
> --- a/drivers/char/lrng/Kconfig
> +++ b/drivers/char/lrng/Kconfig
> @@ -92,4 +92,15 @@ config LRNG_KCAPI
> provided by the selected kernel crypto API RNG.
> endif # LRNG_DRNG_SWITCH
>
> +config LRNG_JENT
> + bool "Enable Jitter RNG as LRNG Seed Source"
> + select CRYPTO_JITTERENTROPY

Don't select unless CRYPTO is already set/enabled.

> + help
> + The Linux RNG may use the Jitter RNG as noise source. Enabling
> + this option enables the use of the Jitter RNG. Its default
> + entropy level is 16 bits of entropy per 256 data bits delivered
> + by the Jitter RNG. This entropy level can be changed at boot
> + time or at runtime with the lrng_base.jitterrng configuration
> + variable.
> +
> endif # LRNG

> diff --git a/drivers/char/lrng/lrng_jent.c b/drivers/char/lrng/lrng_jent.c
> new file mode 100644
> index 000000000000..ff0bbe2680c4
> --- /dev/null
> +++ b/drivers/char/lrng/lrng_jent.c
> @@ -0,0 +1,89 @@
> +// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
> +/*
> + * LRNG Fast Noise Source: Jitter RNG
> + *
> + * Copyright (C) 2016 - 2020, Stephan Mueller <[email protected]>
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include <linux/types.h>
> +#include <crypto/internal/jitterentropy.h>
> +
> +#include "lrng_internal.h"
> +
> +/*
> + * Estimated entropy of data is a 16th of LRNG_DRNG_SECURITY_STRENGTH_BITS.
> + * Albeit a full entropy assessment is provided for the noise source indicating
> + * that it provides high entropy rates and considering that it deactivates
> + * when it detects insufficient hardware, the chosen under estimation of
> + * entropy is considered to be acceptable to all reviewers.
> + */
> +static u32 jitterrng = LRNG_DRNG_SECURITY_STRENGTH_BITS>>4;
> +module_param(jitterrng, uint, 0644);
> +MODULE_PARM_DESC(jitterrng, "Entropy in bits of 256 data bits from Jitter "
> + "RNG noise source");

One line for the string, please, not split to 2 lines.

--
~Randy
Reported-by: Randy Dunlap <[email protected]>


2020-01-16 07:29:16

by Stephan Müller

[permalink] [raw]
Subject: Re: [PATCH v28 09/12] LRNG - add Jitter RNG fast noise source

Am Donnerstag, 16. Januar 2020, 01:17:05 CET schrieb Randy Dunlap:

Hi Randy,

> On 1/15/20 2:34 AM, Stephan M?ller wrote:
> > CC: "Eric W. Biederman" <[email protected]>
> > CC: "Alexander E. Patrakov" <[email protected]>
> > CC: "Ahmed S. Darwish" <[email protected]>
> > CC: "Theodore Y. Ts'o" <[email protected]>
> > CC: Willy Tarreau <[email protected]>
> > CC: Matthew Garrett <[email protected]>
> > CC: Vito Caputo <[email protected]>
> > CC: Andreas Dilger <[email protected]>
> > CC: Jan Kara <[email protected]>
> > CC: Ray Strode <[email protected]>
> > CC: William Jon McCann <[email protected]>
> > CC: zhangjs <[email protected]>
> > CC: Andy Lutomirski <[email protected]>
> > CC: Florian Weimer <[email protected]>
> > CC: Lennart Poettering <[email protected]>
> > CC: Nicolai Stange <[email protected]>
> > Reviewed-by: Marcelo Henrique Cerri <[email protected]>
> > Reviewed-by: Roman Drahtmueller <[email protected]>
> > Tested-by: Roman Drahtm?ller <[email protected]>
> > Tested-by: Marcelo Henrique Cerri <[email protected]>
> > Tested-by: Neil Horman <[email protected]>
> > Signed-off-by: Stephan Mueller <[email protected]>
> > ---
> >
> > drivers/char/lrng/Kconfig | 11 +++++
> > drivers/char/lrng/Makefile | 1 +
> > drivers/char/lrng/lrng_jent.c | 89 +++++++++++++++++++++++++++++++++++
> > 3 files changed, 101 insertions(+)
> > create mode 100644 drivers/char/lrng/lrng_jent.c
> >
> > diff --git a/drivers/char/lrng/Kconfig b/drivers/char/lrng/Kconfig
> > index 0d070a3897dd..10b7cbdb8c8e 100644
> > --- a/drivers/char/lrng/Kconfig
> > +++ b/drivers/char/lrng/Kconfig
> > @@ -92,4 +92,15 @@ config LRNG_KCAPI
> >
> > provided by the selected kernel crypto API RNG.
> >
> > endif # LRNG_DRNG_SWITCH
> >
> > +config LRNG_JENT
> > + bool "Enable Jitter RNG as LRNG Seed Source"
> > + select CRYPTO_JITTERENTROPY
>
> Don't select unless CRYPTO is already set/enabled.

I added "depends on
>
> > + help
> > + The Linux RNG may use the Jitter RNG as noise source. Enabling
> > + this option enables the use of the Jitter RNG. Its default
> > + entropy level is 16 bits of entropy per 256 data bits delivered
> > + by the Jitter RNG. This entropy level can be changed at boot
> > + time or at runtime with the lrng_base.jitterrng configuration
> > + variable.
> > +
> >
> > endif # LRNG
> >
> > diff --git a/drivers/char/lrng/lrng_jent.c b/drivers/char/lrng/lrng_jent.c
> > new file mode 100644
> > index 000000000000..ff0bbe2680c4
> > --- /dev/null
> > +++ b/drivers/char/lrng/lrng_jent.c
> > @@ -0,0 +1,89 @@
> > +// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
> > +/*
> > + * LRNG Fast Noise Source: Jitter RNG
> > + *
> > + * Copyright (C) 2016 - 2020, Stephan Mueller <[email protected]>
> > + */
> > +
> > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > +
> > +#include <linux/types.h>
> > +#include <crypto/internal/jitterentropy.h>
> > +
> > +#include "lrng_internal.h"
> > +
> > +/*
> > + * Estimated entropy of data is a 16th of
> > LRNG_DRNG_SECURITY_STRENGTH_BITS. + * Albeit a full entropy assessment is
> > provided for the noise source indicating + * that it provides high
> > entropy rates and considering that it deactivates + * when it detects
> > insufficient hardware, the chosen under estimation of + * entropy is
> > considered to be acceptable to all reviewers.
> > + */
> > +static u32 jitterrng = LRNG_DRNG_SECURITY_STRENGTH_BITS>>4;
> > +module_param(jitterrng, uint, 0644);
> > +MODULE_PARM_DESC(jitterrng, "Entropy in bits of 256 data bits from Jitter
> > " + "RNG noise source");
>
> One line for the string, please, not split to 2 lines.

Changed.

Thank you.

Ciao
Stephan