blob: 37e5e291dd47c2d27c9d5fca6edeb2a7644a9e8a [file] [log] [blame]
Alexei Fedorov71d81dc2020-07-13 13:58:06 +01001#
Manish V Badarkhe5797b802021-08-06 09:26:20 +01002# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
Alexei Fedorov71d81dc2020-07-13 13:58:06 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Javier Almansa Sobrino0d1f6b12020-09-18 16:47:07 +01007# Default log level to dump the event log (LOG_LEVEL_INFO)
8EVENT_LOG_LEVEL ?= 40
9
Sandrine Bailleux3c2db6f2021-07-07 14:47:08 +020010# TPM hash algorithm.
11# SHA-256 (or stronger) is required for all devices that are TPM 2.0 compliant.
Alexei Fedorov71d81dc2020-07-13 13:58:06 +010012TPM_HASH_ALG := sha256
13
14ifeq (${TPM_HASH_ALG}, sha512)
15 MBEDTLS_MD_ID := MBEDTLS_MD_SHA512
16 TPM_ALG_ID := TPM_ALG_SHA512
17 TCG_DIGEST_SIZE := 64U
18else ifeq (${TPM_HASH_ALG}, sha384)
19 MBEDTLS_MD_ID := MBEDTLS_MD_SHA384
20 TPM_ALG_ID := TPM_ALG_SHA384
21 TCG_DIGEST_SIZE := 48U
22else
23 MBEDTLS_MD_ID := MBEDTLS_MD_SHA256
24 TPM_ALG_ID := TPM_ALG_SHA256
25 TCG_DIGEST_SIZE := 32U
26endif
27
Alexei Fedorov71d81dc2020-07-13 13:58:06 +010028
29# Set definitions for mbed TLS library and Measured Boot driver
Leonardo Sandoval65fca7c2020-09-10 12:18:27 -050030$(eval $(call add_defines,\
31 $(sort \
32 MBEDTLS_MD_ID \
33 TPM_ALG_ID \
34 TCG_DIGEST_SIZE \
Javier Almansa Sobrino0d1f6b12020-09-18 16:47:07 +010035 EVENT_LOG_LEVEL \
Leonardo Sandoval65fca7c2020-09-10 12:18:27 -050036)))
Alexei Fedorov71d81dc2020-07-13 13:58:06 +010037
38ifeq (${HASH_ALG}, sha256)
Sandrine Bailleux3c2db6f2021-07-07 14:47:08 +020039 ifneq (${TPM_HASH_ALG}, sha256)
40 $(eval $(call add_define,MBEDTLS_SHA512_C))
41 endif
Alexei Fedorov71d81dc2020-07-13 13:58:06 +010042endif
43
Sandrine Bailleux3c2db6f2021-07-07 14:47:08 +020044MEASURED_BOOT_SRC_DIR := drivers/measured_boot/event_log/
Alexei Fedorov71d81dc2020-07-13 13:58:06 +010045
Manish V Badarkhe5797b802021-08-06 09:26:20 +010046MEASURED_BOOT_SOURCES := ${MEASURED_BOOT_SRC_DIR}event_log.c \
47 ${MEASURED_BOOT_SRC_DIR}event_print.c
Alexei Fedorov71d81dc2020-07-13 13:58:06 +010048
49BL2_SOURCES += ${MEASURED_BOOT_SOURCES}
Manish V Badarkhea74d9632021-09-14 23:12:42 +010050BL1_SOURCES += ${MEASURED_BOOT_SOURCES}