measured_boot.mk 1.16 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#
# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#

# TPM hash algorithm
TPM_HASH_ALG			:=	sha256

ifeq (${TPM_HASH_ALG}, sha512)
    MBEDTLS_MD_ID		:=	MBEDTLS_MD_SHA512
    TPM_ALG_ID			:=	TPM_ALG_SHA512
    TCG_DIGEST_SIZE		:=	64U
else ifeq (${TPM_HASH_ALG}, sha384)
    MBEDTLS_MD_ID		:=	MBEDTLS_MD_SHA384
    TPM_ALG_ID			:=	TPM_ALG_SHA384
    TCG_DIGEST_SIZE		:=	48U
else
    MBEDTLS_MD_ID		:=	MBEDTLS_MD_SHA256
    TPM_ALG_ID			:=	TPM_ALG_SHA256
    TCG_DIGEST_SIZE		:=	32U
endif

# Event Log length in bytes
EVENT_LOG_SIZE			:= 1024

# Set definitions for mbed TLS library and Measured Boot driver
$(eval $(call add_define,MBEDTLS_MD_ID))
$(eval $(call add_define,TPM_ALG_ID))
$(eval $(call add_define,TCG_DIGEST_SIZE))
$(eval $(call add_define,EVENT_LOG_SIZE))

ifeq (${HASH_ALG}, sha256)
ifneq (${TPM_HASH_ALG}, sha256)
$(eval $(call add_define,MBEDTLS_SHA512_C))
endif
endif

MEASURED_BOOT_SRC_DIR	:= drivers/measured_boot/

MEASURED_BOOT_SOURCES	:= ${MEASURED_BOOT_SRC_DIR}measured_boot.c	\
    			   ${MEASURED_BOOT_SRC_DIR}event_log.c		\
    			   ${MEASURED_BOOT_SRC_DIR}event_print.c

BL2_SOURCES		+= ${MEASURED_BOOT_SOURCES}