Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 1 | # |
Manish V Badarkhe | 5797b80 | 2021-08-06 09:26:20 +0100 | [diff] [blame] | 2 | # Copyright (c) 2020-2021, Arm Limited. All rights reserved. |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Javier Almansa Sobrino | 0d1f6b1 | 2020-09-18 16:47:07 +0100 | [diff] [blame] | 7 | # Default log level to dump the event log (LOG_LEVEL_INFO) |
| 8 | EVENT_LOG_LEVEL ?= 40 |
| 9 | |
Sandrine Bailleux | 3c2db6f | 2021-07-07 14:47:08 +0200 | [diff] [blame] | 10 | # TPM hash algorithm. |
| 11 | # SHA-256 (or stronger) is required for all devices that are TPM 2.0 compliant. |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 12 | TPM_HASH_ALG := sha256 |
| 13 | |
| 14 | ifeq (${TPM_HASH_ALG}, sha512) |
| 15 | MBEDTLS_MD_ID := MBEDTLS_MD_SHA512 |
| 16 | TPM_ALG_ID := TPM_ALG_SHA512 |
| 17 | TCG_DIGEST_SIZE := 64U |
| 18 | else ifeq (${TPM_HASH_ALG}, sha384) |
| 19 | MBEDTLS_MD_ID := MBEDTLS_MD_SHA384 |
| 20 | TPM_ALG_ID := TPM_ALG_SHA384 |
| 21 | TCG_DIGEST_SIZE := 48U |
| 22 | else |
| 23 | MBEDTLS_MD_ID := MBEDTLS_MD_SHA256 |
| 24 | TPM_ALG_ID := TPM_ALG_SHA256 |
| 25 | TCG_DIGEST_SIZE := 32U |
| 26 | endif |
| 27 | |
| 28 | # Event Log length in bytes |
| 29 | EVENT_LOG_SIZE := 1024 |
| 30 | |
| 31 | # Set definitions for mbed TLS library and Measured Boot driver |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 32 | $(eval $(call add_defines,\ |
| 33 | $(sort \ |
| 34 | MBEDTLS_MD_ID \ |
| 35 | TPM_ALG_ID \ |
| 36 | TCG_DIGEST_SIZE \ |
| 37 | EVENT_LOG_SIZE \ |
Javier Almansa Sobrino | 0d1f6b1 | 2020-09-18 16:47:07 +0100 | [diff] [blame] | 38 | EVENT_LOG_LEVEL \ |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 39 | ))) |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 40 | |
| 41 | ifeq (${HASH_ALG}, sha256) |
Sandrine Bailleux | 3c2db6f | 2021-07-07 14:47:08 +0200 | [diff] [blame] | 42 | ifneq (${TPM_HASH_ALG}, sha256) |
| 43 | $(eval $(call add_define,MBEDTLS_SHA512_C)) |
| 44 | endif |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 45 | endif |
| 46 | |
Sandrine Bailleux | 3c2db6f | 2021-07-07 14:47:08 +0200 | [diff] [blame] | 47 | MEASURED_BOOT_SRC_DIR := drivers/measured_boot/event_log/ |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 48 | |
Manish V Badarkhe | 5797b80 | 2021-08-06 09:26:20 +0100 | [diff] [blame] | 49 | MEASURED_BOOT_SOURCES := ${MEASURED_BOOT_SRC_DIR}event_log.c \ |
| 50 | ${MEASURED_BOOT_SRC_DIR}event_print.c |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 51 | |
| 52 | BL2_SOURCES += ${MEASURED_BOOT_SOURCES} |