Re: [PATCH] random: inform about bootloader-provided randomness

From: Will Deacon
Date: Mon Oct 14 2019 - 20:40:48 EST


On Sat, Oct 05, 2019 at 01:36:32PM +0200, Dominik Brodowski wrote:
> Inform how many bits of randomness were provided by the bootloader,
> and whether we trust that input.
>
> Signed-off-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
> Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
> Cc: Hsin-Yi Wang <hsinyi@xxxxxxxxxxxx>
> Cc: Stephen Boyd <swboyd@xxxxxxxxxxxx>
> Cc: Rob Herring <robh@xxxxxxxxxx>
> Cc: Theodore Ts'o <tytso@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
>
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index de434feb873a..673375e05c0d 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -2515,6 +2515,10 @@ EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
> */
> void add_bootloader_randomness(const void *buf, unsigned int size)
> {
> + pr_notice("random: adding %u bits of %sbootloader-provided randomness",
> + size * 8,
> + IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER) ? "trusted " : "");
> +
> if (IS_ENABLED(CONFIG_RANDOM_TRUST_BOOTLOADER))
> add_hwgenerator_randomness(buf, size, size * 8);
> else

Looks fine to me:

Acked-by: Will Deacon <will@xxxxxxxxxx>

Will