* [RFC] random: UEFI RNG input is bootloader randomness
@ 2019-09-28 10:14 Dominik Brodowski
2019-09-28 17:09 ` Kees Cook
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dominik Brodowski @ 2019-09-28 10:14 UTC (permalink / raw)
To: ard.biesheuvel, hsinyi, swboyd, robh, tytso, keescook, joeyli.kernel
Cc: linux-kernel, linux-efi
Depending on RANDOM_TRUST_BOOTLOADER, bootloader-provided randomness
is credited as entropy. As the UEFI seeding entropy pool is seeded by
the UEFI firmware/bootloader, add its content as bootloader randomness.
Note that this UEFI (v2.4 or newer) feature is currently only
implemented for EFI stub booting on ARM, and further note that
RANDOM_TRUST_BOOTLOADER must only be enabled if there indeed is
sufficient trust in the bootloader _and_ its source of randomness.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Lee, Chun-Yi <joeyli.kernel@gmail.com>
---
Untested patch, as efi_random_get_seed() is only hooked up on ARM,
and the firmware on my old x86 laptop only has UEFI v2.31 anyway.
Thanks,
Dominik
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 8f1ab04f6743..db0bffce754e 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -545,7 +545,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
sizeof(*seed) + size);
if (seed != NULL) {
pr_notice("seeding entropy pool\n");
- add_device_randomness(seed->bits, seed->size);
+ add_bootloader_randomness(seed->bits, seed->size);
early_memunmap(seed, sizeof(*seed) + size);
} else {
pr_err("Could not map UEFI random seed!\n");
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC] random: UEFI RNG input is bootloader randomness
2019-09-28 10:14 [RFC] random: UEFI RNG input is bootloader randomness Dominik Brodowski
@ 2019-09-28 17:09 ` Kees Cook
2019-09-30 11:11 ` Bhupesh Sharma
2019-09-30 11:57 ` Ard Biesheuvel
2 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2019-09-28 17:09 UTC (permalink / raw)
To: Dominik Brodowski
Cc: ard.biesheuvel, hsinyi, swboyd, robh, tytso, joeyli.kernel,
linux-kernel, linux-efi
On Sat, Sep 28, 2019 at 12:14:28PM +0200, Dominik Brodowski wrote:
> Depending on RANDOM_TRUST_BOOTLOADER, bootloader-provided randomness
> is credited as entropy. As the UEFI seeding entropy pool is seeded by
> the UEFI firmware/bootloader, add its content as bootloader randomness.
>
> Note that this UEFI (v2.4 or newer) feature is currently only
> implemented for EFI stub booting on ARM, and further note that
> RANDOM_TRUST_BOOTLOADER must only be enabled if there indeed is
> sufficient trust in the bootloader _and_ its source of randomness.
>
> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Hsin-Yi Wang <hsinyi@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Lee, Chun-Yi <joeyli.kernel@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
-Kees
>
> ---
>
> Untested patch, as efi_random_get_seed() is only hooked up on ARM,
> and the firmware on my old x86 laptop only has UEFI v2.31 anyway.
>
> Thanks,
> Dominik
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 8f1ab04f6743..db0bffce754e 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -545,7 +545,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
> sizeof(*seed) + size);
> if (seed != NULL) {
> pr_notice("seeding entropy pool\n");
> - add_device_randomness(seed->bits, seed->size);
> + add_bootloader_randomness(seed->bits, seed->size);
> early_memunmap(seed, sizeof(*seed) + size);
> } else {
> pr_err("Could not map UEFI random seed!\n");
--
Kees Cook
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] random: UEFI RNG input is bootloader randomness
2019-09-28 10:14 [RFC] random: UEFI RNG input is bootloader randomness Dominik Brodowski
2019-09-28 17:09 ` Kees Cook
@ 2019-09-30 11:11 ` Bhupesh Sharma
2019-09-30 11:57 ` Ard Biesheuvel
2 siblings, 0 replies; 4+ messages in thread
From: Bhupesh Sharma @ 2019-09-30 11:11 UTC (permalink / raw)
To: Dominik Brodowski
Cc: Ard Biesheuvel, hsinyi, swboyd, robh, tytso, Kees Cook,
joeyli.kernel, Linux Kernel Mailing List, linux-efi
On Sat, Sep 28, 2019 at 3:54 PM Dominik Brodowski
<linux@dominikbrodowski.net> wrote:
>
> Depending on RANDOM_TRUST_BOOTLOADER, bootloader-provided randomness
> is credited as entropy. As the UEFI seeding entropy pool is seeded by
> the UEFI firmware/bootloader, add its content as bootloader randomness.
>
> Note that this UEFI (v2.4 or newer) feature is currently only
> implemented for EFI stub booting on ARM, and further note that
> RANDOM_TRUST_BOOTLOADER must only be enabled if there indeed is
> sufficient trust in the bootloader _and_ its source of randomness.
>
> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Hsin-Yi Wang <hsinyi@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Lee, Chun-Yi <joeyli.kernel@gmail.com>
>
> ---
>
> Untested patch, as efi_random_get_seed() is only hooked up on ARM,
> and the firmware on my old x86 laptop only has UEFI v2.31 anyway.
>
> Thanks,
> Dominik
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 8f1ab04f6743..db0bffce754e 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -545,7 +545,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
> sizeof(*seed) + size);
> if (seed != NULL) {
> pr_notice("seeding entropy pool\n");
> - add_device_randomness(seed->bits, seed->size);
> + add_bootloader_randomness(seed->bits, seed->size);
> early_memunmap(seed, sizeof(*seed) + size);
> } else {
> pr_err("Could not map UEFI random seed!\n");
Tested the patch on my arm64 board which support EFI_RNG_PROTOCOL
(i.e. EFI firmware acts as the entropy source) and has
'CONFIG_RANDOM_TRUST_BOOTLOADER=y', so:
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] random: UEFI RNG input is bootloader randomness
2019-09-28 10:14 [RFC] random: UEFI RNG input is bootloader randomness Dominik Brodowski
2019-09-28 17:09 ` Kees Cook
2019-09-30 11:11 ` Bhupesh Sharma
@ 2019-09-30 11:57 ` Ard Biesheuvel
2 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2019-09-30 11:57 UTC (permalink / raw)
To: Dominik Brodowski
Cc: Hsin-Yi Wang, Stephen Boyd, Rob Herring, Theodore Ts'o,
Kees Cook, Lee, Chun-Yi, Linux Kernel Mailing List, linux-efi
On Sat, 28 Sep 2019 at 12:14, Dominik Brodowski
<linux@dominikbrodowski.net> wrote:
>
> Depending on RANDOM_TRUST_BOOTLOADER, bootloader-provided randomness
> is credited as entropy. As the UEFI seeding entropy pool is seeded by
> the UEFI firmware/bootloader, add its content as bootloader randomness.
>
> Note that this UEFI (v2.4 or newer) feature is currently only
> implemented for EFI stub booting on ARM, and further note that
> RANDOM_TRUST_BOOTLOADER must only be enabled if there indeed is
> sufficient trust in the bootloader _and_ its source of randomness.
>
> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Hsin-Yi Wang <hsinyi@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Cc: Lee, Chun-Yi <joeyli.kernel@gmail.com>
>
> ---
>
> Untested patch, as efi_random_get_seed() is only hooked up on ARM,
> and the firmware on my old x86 laptop only has UEFI v2.31 anyway.
>
> Thanks,
> Dominik
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 8f1ab04f6743..db0bffce754e 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -545,7 +545,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
> sizeof(*seed) + size);
> if (seed != NULL) {
> pr_notice("seeding entropy pool\n");
> - add_device_randomness(seed->bits, seed->size);
> + add_bootloader_randomness(seed->bits, seed->size);
> early_memunmap(seed, sizeof(*seed) + size);
> } else {
> pr_err("Could not map UEFI random seed!\n");
Thanks, I like this change. I'll get it queued up in efi/next.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-30 11:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-28 10:14 [RFC] random: UEFI RNG input is bootloader randomness Dominik Brodowski
2019-09-28 17:09 ` Kees Cook
2019-09-30 11:11 ` Bhupesh Sharma
2019-09-30 11:57 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).