eltan/security: Remove some preprocessor guards

We generally let garbage-collection take care of unused functions.
While at it, move some related variable declarations in to the
header file and declare them const like they should be.

Change-Id: I7c6fa15bd45f861f13b6123ccb14c55415e42bc7
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36632
Reviewed-by: Wim Vervoorn <wvervoorn@eltan.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kyösti Mälkki 2019-11-05 17:12:42 +02:00 committed by Patrick Georgi
parent dd227a7d97
commit ed8eaab08a
3 changed files with 29 additions and 51 deletions

View File

@ -266,7 +266,6 @@ int mb_measure_log_worker(const char *name, uint32_t type, uint32_t pcr,
return status;
}
#ifdef __PRE_RAM__
/*
* Called from early romstage
*
@ -473,4 +472,3 @@ int __attribute__((weak))mb_crtm(void)
return status;
}
#endif // __PRE_RAM__

View File

@ -276,13 +276,11 @@ void process_verify_list(const verify_item_t list[])
i++;
}
}
#ifdef __BOOTBLOCK__
/*
* BOOTBLOCK
*/
extern verify_item_t bootblock_verify_list[];
void verified_boot_bootblock_check(void)
{
printk(BIOS_SPEW, "%s: processing bootblock items\n", __func__);
@ -296,14 +294,6 @@ void verified_boot_bootblock_check(void)
process_verify_list(bootblock_verify_list);
}
static void vendor_secure_prepare(void)
{
printk(BIOS_SPEW, "%s: bootblock\n", __func__);
verified_boot_bootblock_check();
}
#endif //__BOOTBLOCK__
#ifdef __ROMSTAGE__
/*
* ROMSTAGE
*/
@ -330,33 +320,6 @@ void verified_boot_early_check(void)
process_verify_list(romstage_verify_list);
}
static int prepare_romstage = 0;
static void vendor_secure_prepare(void)
{
printk(BIOS_SPEW, "%s: romstage\n", __func__);
if (!prepare_romstage) {
verified_boot_early_check();
prepare_romstage = 1;
}
}
#endif //__ROMSTAGE__
#ifdef __POSTCAR__
/*
* POSTCAR
*/
extern verify_item_t postcar_verify_list[];
static void vendor_secure_prepare(void)
{
printk(BIOS_SPEW, "%s: postcar\n", __func__);
process_verify_list(postcar_verify_list);
}
#endif //__POSTCAR__
#ifdef __RAMSTAGE__
/*
* RAM STAGE
*/
@ -408,10 +371,6 @@ static int process_oprom_list(const verify_item_t list[],
return 0;
}
extern verify_item_t payload_verify_list[];
extern verify_item_t oprom_verify_list[];
int verified_boot_should_run_oprom(struct rom_header *rom_header)
{
return process_oprom_list(oprom_verify_list, rom_header);
@ -419,10 +378,30 @@ int verified_boot_should_run_oprom(struct rom_header *rom_header)
static void vendor_secure_prepare(void)
{
printk(BIOS_SPEW, "%s: ramstage\n", __func__);
process_verify_list(payload_verify_list);
if (ENV_BOOTBLOCK) {
printk(BIOS_SPEW, "%s: bootblock\n", __func__);
verified_boot_bootblock_check();
}
if (ENV_ROMSTAGE) {
static int prepare_romstage = 0;
printk(BIOS_SPEW, "%s: romstage\n", __func__);
if (!prepare_romstage) {
verified_boot_early_check();
prepare_romstage = 1;
}
}
if (ENV_POSTCAR) {
printk(BIOS_SPEW, "%s: postcar\n", __func__);
process_verify_list(postcar_verify_list);
}
if (ENV_RAMSTAGE) {
printk(BIOS_SPEW, "%s: ramstage\n", __func__);
process_verify_list(payload_verify_list);
}
}
#endif //__RAMSTAGE__
const struct cbfs_locator cbfs_master_header_locator = {
.name = "Vendorcode Header Locator",

View File

@ -32,12 +32,8 @@
/* These method verifies the SHA256 hash over the 'named' CBFS component.
* 'type' denotes the type of CBFS component i.e. stage, payload or fsp.
*/
#ifdef __BOOTBLOCK__
void verified_boot_bootblock_check(void);
#endif
#ifdef __ROMSTAGE__
void verified_boot_early_check(void);
#endif
int verified_boot_check_manifest(void);
@ -75,4 +71,9 @@ typedef struct {
void process_verify_list(const verify_item_t list[]);
extern const verify_item_t bootblock_verify_list[];
extern const verify_item_t postcar_verify_list[];
extern const verify_item_t payload_verify_list[];
extern const verify_item_t oprom_verify_list[];
#endif //VBOOT_CHECK_H