Commit
201e0d53bdd43 ("stub: split out random seed part out of run()")
looks like refactoring but apparently it changed the logic when random
seed is refreshed in the ESP completely. Previously, process_random_seed()
was called when either:
- sd-stub was not present (LoaderFeatures var is unset) OR
- sd-stub was present but EFI_LOADER_FEATURE_RANDOM_SEED flag was unset.
Post-change, refresh_random_seed() bails under the exact same conditions (no
sd-stub or EFI_LOADER_FEATURE_RANDOM_SEED is unset) and thus
process_random_seed() is NOT called.
Restore the original logic. efivar_get_uint64_le()'s return value doesn't
require checking: loader_features is initialized to 0 and in case of failure it
stays untouched.
if (!loaded_image->DeviceHandle)
return;
- uint64_t loader_features = 0;
- err = efivar_get_uint64_le(MAKE_GUID_PTR(LOADER), u"LoaderFeatures", &loader_features);
- if (err != EFI_SUCCESS)
- return;
-
/* Don't measure again, if sd-boot already initialized the random seed */
- if (!FLAGS_SET(loader_features, EFI_LOADER_FEATURE_RANDOM_SEED))
+ uint64_t loader_features = 0;
+ (void) efivar_get_uint64_le(MAKE_GUID_PTR(LOADER), u"LoaderFeatures", &loader_features);
+ if (FLAGS_SET(loader_features, EFI_LOADER_FEATURE_RANDOM_SEED))
return;
_cleanup_(file_closep) EFI_FILE *esp_dir = NULL;