]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: only do random seed management for some entry types
authorLennart Poettering <lennart@poettering.net>
Tue, 25 Feb 2025 11:19:48 +0000 (12:19 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 25 Feb 2025 20:14:27 +0000 (21:14 +0100)
Similar to the previous commits, let's carefully condition random seed
management (which might be slow, and simply pointless for various entry
types) on the entry type.

src/boot/boot.c

index 410021ebeeef983f656770aeee0646bdda3c2b00..62be8ec0a3e3695f2b23aa9b7b8649d18e7f3236 100644 (file)
@@ -73,6 +73,9 @@ typedef enum LoaderType {
 /* Whether to do boot attempt counting logic (only works if userspace can actually find the selected option later) */
 #define LOADER_TYPE_BUMP_COUNTERS(t) IN_SET(t, LOADER_LINUX, LOADER_UKI, LOADER_TYPE2_UKI)
 
+/* Whether to do random seed management (only we invoke Linux) */
+#define LOADER_TYPE_PROCESS_RANDOM_SEED(t) IN_SET(t, LOADER_LINUX, LOADER_UKI, LOADER_TYPE2_UKI)
+
 typedef struct BootEntry {
         char16_t *id;         /* The unique identifier for this entry (typically the filename of the file defining the entry, possibly suffixed with a profile id) */
         char16_t *id_without_profile; /* same, but without any profile id suffixed */
@@ -2966,7 +2969,8 @@ static EFI_STATUS run(EFI_HANDLE image) {
                 save_selected_entry(&config, entry);
 
                 /* Optionally, read a random seed off the ESP and pass it to the OS */
-                (void) process_random_seed(root_dir);
+                if (LOADER_TYPE_PROCESS_RANDOM_SEED(entry->type))
+                        (void) process_random_seed(root_dir);
 
                 err = image_start(entry, root_dir, image);
                 if (err != EFI_SUCCESS)