blob: fc005d5ed07dba2482f22e697a5124da174f974c [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
7# TPM hash algorithm
8TPM_HASH_ALG := sha256
9
10ifeq (${TPM_HASH_ALG}, sha512)
11 MBEDTLS_MD_ID := MBEDTLS_MD_SHA512
12 TPM_ALG_ID := TPM_ALG_SHA512
13 TCG_DIGEST_SIZE := 64U
14else ifeq (${TPM_HASH_ALG}, sha384)
15 MBEDTLS_MD_ID := MBEDTLS_MD_SHA384
16 TPM_ALG_ID := TPM_ALG_SHA384
17 TCG_DIGEST_SIZE := 48U
18else
19 MBEDTLS_MD_ID := MBEDTLS_MD_SHA256
20 TPM_ALG_ID := TPM_ALG_SHA256
21 TCG_DIGEST_SIZE := 32U
22endif
23
24# Event Log length in bytes
25EVENT_LOG_SIZE := 1024
26
27# Set definitions for mbed TLS library and Measured Boot driver
28$(eval $(call add_define,MBEDTLS_MD_ID))
29$(eval $(call add_define,TPM_ALG_ID))
30$(eval $(call add_define,TCG_DIGEST_SIZE))
31$(eval $(call add_define,EVENT_LOG_SIZE))
32
33ifeq (${HASH_ALG}, sha256)
34ifneq (${TPM_HASH_ALG}, sha256)
35$(eval $(call add_define,MBEDTLS_SHA512_C))
36endif
37endif
38
39MEASURED_BOOT_SRC_DIR := drivers/measured_boot/
40
41MEASURED_BOOT_SOURCES := ${MEASURED_BOOT_SRC_DIR}measured_boot.c \
42 ${MEASURED_BOOT_SRC_DIR}event_log.c \
43 ${MEASURED_BOOT_SRC_DIR}event_print.c
44
45BL2_SOURCES += ${MEASURED_BOOT_SOURCES}