core/init.c: remove redundant calls to verify and measure BOOTKERNEL
The flash driver calls libstb to verify and measure every PNOR partition
requested at boot time.
This removes redundat code from init.c used to verify and measure
BOOTKERNEL.
@@ -342,10 +342,8 @@ bool start_preload_kernel(void)
static bool load_kernel(void)
{
- void* stb_container = NULL;
struct elf_hdr *kh;
int loaded;
- bool do_stb = false;
prlog(PR_NOTICE, "INIT: Waiting for kernel...\n");
@@ -368,7 +366,6 @@ static bool load_kernel(void)
printf("Using built-in kernel\n");
memmove(KERNEL_LOAD_BASE, (void*)builtin_base,
kernel_size);
- do_stb = true;
}
}
@@ -386,21 +383,18 @@ static bool load_kernel(void)
memcpy(NULL, old_vectors, 0x2000);
sync_icache();
}
- do_stb = true;
- stb_container = kh; /* probably incorrect */
} else {
if (!kernel_size) {
printf("INIT: Assuming kernel at %p\n",
KERNEL_LOAD_BASE);
/* Hack for STB in Mambo, assume at least 4kb in mem */
kernel_size = SECURE_BOOT_HEADERS_SIZE;
- do_stb = true;
}
- kh = (struct elf_hdr *) (KERNEL_LOAD_BASE);
- if (stb_is_container(KERNEL_LOAD_BASE, kernel_size)) {
- stb_container = kh;
+ if (stb_is_container(KERNEL_LOAD_BASE, kernel_size))
kh = (struct elf_hdr *) (KERNEL_LOAD_BASE + SECURE_BOOT_HEADERS_SIZE);
- }
+ else
+ kh = (struct elf_hdr *) (KERNEL_LOAD_BASE);
+
}
prlog(PR_DEBUG,
@@ -423,18 +417,6 @@ static bool load_kernel(void)
return false;
}
- if (do_stb)
- {
- sb_verify(RESOURCE_ID_KERNEL, stb_container,
- kernel_size + SECURE_BOOT_HEADERS_SIZE);
- tb_measure(RESOURCE_ID_KERNEL, stb_container,
- kernel_size + SECURE_BOOT_HEADERS_SIZE);
- }
-
- /*
- * Verify and measure the retrieved PNOR partition as part of the
- * secure boot and trusted boot requirements
- */
stb_final();
return true;
