diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf --- a/stand/defaults/loader.conf +++ b/stand/defaults/loader.conf @@ -48,9 +48,13 @@ # the boot-time entropy cache. This # must not change value even if the # _name above does change! -entropy_efi_seed="YES" # Set this to NO to disable loading - # entropy from the UEFI hardware random number generator API - +# The following is being phased on in favor of entropy_seed +entropy_efi_seed="YES" # Set this to NO to disable loading + # ENTROPY from the UEFI hardware random + # number generator API +entropy_seed="YES" # Set this to NO to disable loading + # ENTROPY from the loader provided + # hardware random number generator API ### RAM Blacklist configuration ############################ ram_blacklist_load="NO" # Set this to YES to load a file # containing a list of addresses to diff --git a/stand/lua/core.lua b/stand/lua/core.lua --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -351,9 +351,24 @@ end end +function core.isEnvYes(env) + return loader.getenv(env) or "no"):lower() == "yes" +end + function core.loadEntropy() - if core.isUEFIBoot() then - if (loader.getenv("entropy_efi_seed") or "no"):lower() == "yes" then + -- Check to see if we have the new interface. has_command was introduced + -- in 13.2/14.0, so we have to check. Since loader.efi is updated out of + -- step with the rest of boot, we have to guard against old versions. + if loader.has_command then + -- new loader: call seed-entropy if loader provides it and enabled + want_seed = core.isEnvYes("entroy_seed") or core.isEnvYes("entroy_efi_seed") + if want_seed and loader.has_command("seed-entropy") then + loader.perform("seed-entropy") + end + else + -- Older loader, do it the old way. Only try if UEFI because we + -- know the efi loader has this command, and no others do not. + if core.isEnvYes("entropy_efi_seed") and core.isUEFIBoot() then loader.perform("efi-seed-entropy") end end