1#
2# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# Default log level to dump the event log (LOG_LEVEL_INFO)
8EVENT_LOG_LEVEL         ?= 40
9
10# TPM hash algorithm.
11# SHA-256 (or stronger) is required for all devices that are TPM 2.0 compliant.
12TPM_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
28
29# Set definitions for mbed TLS library and Measured Boot driver
30$(eval $(call add_defines,\
31    $(sort \
32        MBEDTLS_MD_ID \
33        TPM_ALG_ID \
34        TCG_DIGEST_SIZE \
35        EVENT_LOG_LEVEL \
36)))
37
38ifeq (${HASH_ALG}, sha256)
39    ifneq (${TPM_HASH_ALG}, sha256)
40        $(eval $(call add_define,MBEDTLS_SHA512_C))
41    endif
42endif
43
44MEASURED_BOOT_SRC_DIR	:= drivers/measured_boot/event_log/
45
46MEASURED_BOOT_SOURCES	:= ${MEASURED_BOOT_SRC_DIR}event_log.c		\
47			   ${MEASURED_BOOT_SRC_DIR}event_print.c
48
49BL2_SOURCES		+= ${MEASURED_BOOT_SOURCES}
50BL1_SOURCES             += ${MEASURED_BOOT_SOURCES}
51