On Mon, Sep 19, 2022 at 6:09 PM Ard Biesheuvel <ardb@xxxxxxxxxx> wrote: > > Instead of blindly creating the EFI random seed configuration table if > the RNG protocol is implemented and works, check whether such a EFI > configuration table was provided by an earlier boot stage and if so, > combine its contents with a Linux specific personalization string, and > if available, mix in the output of the RNG protocol as well. > > This can be used for, e.g., systemd-boot, to pass an additional seed to > Linux in a way that can be consumed by the kernel very early. In that > case, the following definitions should be used to pass the seed to the > EFI stub: > > struct linux_efi_random_seed { > u32 size; // of the 'seed' array in bytes > u8 seed[]; > }; > > The memory for the struct must be allocated as EFI_ACPI_RECLAIM_MEMORY > pool memory, and the address of the struct in memory should be installed > as a EFI configuration table using the following GUID: > > LINUX_EFI_RANDOM_SEED_TABLE_GUID 1ce1e5bc-7ceb-42f2-81e5-8aadf180f57b > > Note that doing so is safe even on kernels that were built without this > patch applied, but the seed will simply be overwritten with a seed > derived from the EFI RNG protocol, if available. The recommended seed > size is 32 bytes, anything beyond that is mixed in but not reflected in > the final seed size. > > Suggested-by: "Jason A. Donenfeld" <Jason@xxxxxxxxx> > Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx> Reviewed-by: Jason A. Donenfeld <Jason@xxxxxxxxx> (And I suppose you can trim those quotation marks in the suggested-by tag, since it's a git trailer rather than an email header.)