eltan/security: Replace __PRE_RAM__ with ENV_ROMSTAGE_OR_BEFORE

Change-Id: Id56a63a67b7eb70dce6687bb9c2734a711f611b3
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36635
Reviewed-by: Wim Vervoorn <wvervoorn@eltan.com>
Reviewed-by: Frans Hendriks <fhendriks@eltan.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kyösti Mälkki 2019-11-05 17:57:41 +02:00 committed by Patrick Georgi
parent bf43f9ef13
commit c7fa911279
1 changed files with 2 additions and 4 deletions

View File

@ -222,16 +222,14 @@ void verified_boot_check_cbfsfile(const char *name, uint32_t type, uint32_t hash
start = cbfs_boot_map_with_leak(name, type & ~VERIFIED_BOOT_COPY_BLOCK, &size); start = cbfs_boot_map_with_leak(name, type & ~VERIFIED_BOOT_COPY_BLOCK, &size);
if (start && size) { if (start && size) {
/* Speed up processing by copying the file content to memory first */ /* Speed up processing by copying the file content to memory first */
#ifndef __PRE_RAM__ if (!ENV_ROMSTAGE_OR_BEFORE && (type & VERIFIED_BOOT_COPY_BLOCK) && (buffer) &&
if ((type & VERIFIED_BOOT_COPY_BLOCK) && (buffer) && (*buffer) && (*buffer) && ((uint32_t) start > (uint32_t)(~(CONFIG_CBFS_SIZE-1)))) {
((uint32_t) start > (uint32_t)(~(CONFIG_CBFS_SIZE-1)))) {
printk(BIOS_DEBUG, "%s: move buffer to memory\n", __func__); printk(BIOS_DEBUG, "%s: move buffer to memory\n", __func__);
/* Move the file to a memory bufferof which we know it doesn't harm */ /* Move the file to a memory bufferof which we know it doesn't harm */
memcpy(*buffer, start, size); memcpy(*buffer, start, size);
start = *buffer; start = *buffer;
printk(BIOS_DEBUG, "%s: done\n", __func__); printk(BIOS_DEBUG, "%s: done\n", __func__);
} }
#endif // __PRE_RAM__
verified_boot_check_buffer(name, start, size, hash_index, pcr); verified_boot_check_buffer(name, start, size, hash_index, pcr);
} else { } else {
printk(BIOS_EMERG, "CBFS Failed to get file content for %s\n", name); printk(BIOS_EMERG, "CBFS Failed to get file content for %s\n", name);