zipl: check for secure boot once

Check for secure boot status only once when starting to create the
bootmap.

Closes: https://github.com/ibm-s390-linux/s390-tools/pull/133
Signed-off-by: Dan Horák <dan@danny.cz>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Dan Horák
2022-05-26 10:02:10 +00:00
committed by Jan Höppner
parent cf2fb296f0
commit 7b369318dd

View File

@@ -40,6 +40,9 @@
/* Pointer to dedicated empty block in bootmap. */
static disk_blockptr_t empty_block;
/* State of secure boot in the system */
static bool secure_boot_supported;
/* Get size of a bootmap block pointer for disk with given INFO. */
static int
get_blockptr_size(struct disk_info* info)
@@ -519,7 +522,6 @@ static int add_ipl_program(int fd, char *filename,
struct component_loc comp_loc[10];
struct signature_header sig_head;
size_t ramdisk_size, image_size;
bool secure_boot_supported;
size_t stage3_params_size;
const char *comp_name[11];
size_t signature_size;
@@ -608,7 +610,6 @@ static int add_ipl_program(int fd, char *filename,
return -1;
}
image_size = stats.st_size;
secure_boot_supported = check_secure_boot_support();
signature_size = extract_signature(ZIPL_STAGE3_PATH, &signature,
&sig_head);
if (signature_size &&
@@ -1330,6 +1331,8 @@ bootmap_create_device(struct job_data *job, disk_blockptr_t *program_table,
ulong unused_size;
int fd;
secure_boot_supported = check_secure_boot_support();
/* Get full path of bootmap file */
if (!dry_run) {
filename = misc_strdup(job->data.dump.device);