random: UEFI RNG input is bootloader randomness
RFC 1/1 random: UEFI RNG input is bootloader randomness
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.
---
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
drivers/firmware/efi/efi.c +1 -1
@@ -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" );
Quoted 9 lines · Dominik Brodowski
Depending on
RANDOM_TRUST_BOOTLOADER, bootloader-provided randomness is credited as entropy. As the UEFI seeding entropy pool is seeded by the UEFIfirmware/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_BOOTLOADERmust only be enabled if there indeed is sufficient trust in the bootloader _and_ its source of randomness.
Quoted 7 lines
Signed-off-by Dominik Brodowski <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Hsin-Yi Wang <[email protected]>Cc Stephen Boyd <[email protected]>Cc Rob Herring <[email protected]>Cc Theodore Ts'o <[email protected]>Cc Lee, Chun-Yi <[email protected]>
-Kees
Quoted 22 lines
---
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,
Dominikdrivers/firmware/efi/efi.c +1
-1@@ -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" );
Signature · 1 line
Kees Cook
Quoted 31 lines · Dominik Brodowski
Depending on
RANDOM_TRUST_BOOTLOADER, bootloader-provided randomness is credited as entropy. As the UEFI seeding entropy pool is seeded by the UEFIfirmware/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_BOOTLOADERmust only be enabled if there indeed is sufficient trust in the bootloader _and_ its source of randomness.Signed-off-by Dominik Brodowski <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Hsin-Yi Wang <[email protected]>Cc Stephen Boyd <[email protected]>Cc Rob Herring <[email protected]>Cc Theodore Ts'o <[email protected]>Cc Lee, Chun-Yi <[email protected]>---
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,
Dominikdrivers/firmware/efi/efi.c +0
-0
drivers/firmware/efi/efi.c int __init efi_config_parse_tables(void *config_tables, int count, int sz, · line 551
Quoted 8 lines
drivers/firmware/efi/efi.c +1
-1@@ -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:
Thanks.
Quoted 31 lines · Dominik Brodowski
Depending on
RANDOM_TRUST_BOOTLOADER, bootloader-provided randomness is credited as entropy. As the UEFI seeding entropy pool is seeded by the UEFIfirmware/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_BOOTLOADERmust only be enabled if there indeed is sufficient trust in the bootloader _and_ its source of randomness.Signed-off-by Dominik Brodowski <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Hsin-Yi Wang <[email protected]>Cc Stephen Boyd <[email protected]>Cc Rob Herring <[email protected]>Cc Theodore Ts'o <[email protected]>Cc Lee, Chun-Yi <[email protected]>---
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,
Dominikdrivers/firmware/efi/efi.c +0
-0
drivers/firmware/efi/efi.c int __init efi_config_parse_tables(void *config_tables, int count, int sz, · line 551
Quoted 8 lines
drivers/firmware/efi/efi.c +1
-1@@ -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.