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 | |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 28 | |
| 29 | # Set definitions for mbed TLS library and Measured Boot driver |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 30 | $(eval $(call add_defines,\ |
| 31 | $(sort \ |
| 32 | MBEDTLS_MD_ID \ |
| 33 | TPM_ALG_ID \ |
| 34 | TCG_DIGEST_SIZE \ |
Javier Almansa Sobrino | 0d1f6b1 | 2020-09-18 16:47:07 +0100 | [diff] [blame] | 35 | EVENT_LOG_LEVEL \ |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 36 | ))) |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 37 | |
| 38 | ifeq (${HASH_ALG}, sha256) |
Sandrine Bailleux | 3c2db6f | 2021-07-07 14:47:08 +0200 | [diff] [blame] | 39 | ifneq (${TPM_HASH_ALG}, sha256) |
| 40 | $(eval $(call add_define,MBEDTLS_SHA512_C)) |
| 41 | endif |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 42 | endif |
| 43 | |
Sandrine Bailleux | 3c2db6f | 2021-07-07 14:47:08 +0200 | [diff] [blame] | 44 | MEASURED_BOOT_SRC_DIR := drivers/measured_boot/event_log/ |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 45 | |
Manish V Badarkhe | 5797b80 | 2021-08-06 09:26:20 +0100 | [diff] [blame] | 46 | MEASURED_BOOT_SOURCES := ${MEASURED_BOOT_SRC_DIR}event_log.c \ |
| 47 | ${MEASURED_BOOT_SRC_DIR}event_print.c |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 48 | |
| 49 | BL2_SOURCES += ${MEASURED_BOOT_SOURCES} |
Manish V Badarkhe | a74d963 | 2021-09-14 23:12:42 +0100 | [diff] [blame] | 50 | BL1_SOURCES += ${MEASURED_BOOT_SOURCES} |