blob: 497fdbaaee430b82a1cf41218fa0c2790e4eb5e1 [file] [log] [blame]
Alexei Fedorov71d81dc2020-07-13 13:58:06 +01001#
2# Copyright (c) 2020, Arm Limited. All rights reserved.
3#
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
Alexei Fedorov71d81dc2020-07-13 13:58:06 +010010# TPM hash algorithm
11TPM_HASH_ALG := sha256
12
13ifeq (${TPM_HASH_ALG}, sha512)
14 MBEDTLS_MD_ID := MBEDTLS_MD_SHA512
15 TPM_ALG_ID := TPM_ALG_SHA512
16 TCG_DIGEST_SIZE := 64U
17else ifeq (${TPM_HASH_ALG}, sha384)
18 MBEDTLS_MD_ID := MBEDTLS_MD_SHA384
19 TPM_ALG_ID := TPM_ALG_SHA384
20 TCG_DIGEST_SIZE := 48U
21else
22 MBEDTLS_MD_ID := MBEDTLS_MD_SHA256
23 TPM_ALG_ID := TPM_ALG_SHA256
24 TCG_DIGEST_SIZE := 32U
25endif
26
27# Event Log length in bytes
28EVENT_LOG_SIZE := 1024
29
30# Set definitions for mbed TLS library and Measured Boot driver
Leonardo Sandoval65fca7c2020-09-10 12:18:27 -050031$(eval $(call add_defines,\
32 $(sort \
33 MBEDTLS_MD_ID \
34 TPM_ALG_ID \
35 TCG_DIGEST_SIZE \
36 EVENT_LOG_SIZE \
Javier Almansa Sobrino0d1f6b12020-09-18 16:47:07 +010037 EVENT_LOG_LEVEL \
Leonardo Sandoval65fca7c2020-09-10 12:18:27 -050038)))
Alexei Fedorov71d81dc2020-07-13 13:58:06 +010039
40ifeq (${HASH_ALG}, sha256)
41ifneq (${TPM_HASH_ALG}, sha256)
42$(eval $(call add_define,MBEDTLS_SHA512_C))
43endif
44endif
45
46MEASURED_BOOT_SRC_DIR := drivers/measured_boot/
47
48MEASURED_BOOT_SOURCES := ${MEASURED_BOOT_SRC_DIR}measured_boot.c \
49 ${MEASURED_BOOT_SRC_DIR}event_log.c \
50 ${MEASURED_BOOT_SRC_DIR}event_print.c
51
52BL2_SOURCES += ${MEASURED_BOOT_SOURCES}