xref: /rk3399_ARM-atf/drivers/measured_boot/event_log/event_log.mk (revision 10ecd58093a34e95e2dfad65b1180610f29397cc)
1#
2# Copyright (c) 2020-2025, 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# When using a TPM, adopt the TPM's hash algorithm for
11# measurements through the Event Log mechanism, ensuring
12# the TPM uses the same algorithm for measurements and
13# extends the PCR accordingly, allowing for comparison
14# between PCR value and Event Log measurements required
15# for attestation.
16ifdef MBOOT_TPM_HASH_ALG
17    MBOOT_EL_HASH_ALG		:=	${MBOOT_TPM_HASH_ALG}
18else
19    MBOOT_EL_HASH_ALG		:=	sha256
20endif
21
22# Measured Boot hash algorithm.
23# SHA-256 (or stronger) is required for all devices that are TPM 2.0 compliant.
24ifeq (${MBOOT_EL_HASH_ALG}, sha512)
25    TPM_ALG_ID			:=	TPM_ALG_SHA512
26    TCG_DIGEST_SIZE		:=	64U
27else ifeq (${MBOOT_EL_HASH_ALG}, sha384)
28    TPM_ALG_ID			:=	TPM_ALG_SHA384
29    TCG_DIGEST_SIZE		:=	48U
30else
31    TPM_ALG_ID			:=	TPM_ALG_SHA256
32    TCG_DIGEST_SIZE		:=	32U
33endif #MBOOT_EL_HASH_ALG
34
35# Set definitions for Measured Boot driver.
36$(eval $(call add_defines,\
37    $(sort \
38        TPM_ALG_ID \
39        TCG_DIGEST_SIZE \
40        EVENT_LOG_LEVEL \
41)))
42
43EVENT_LOG_SRC_DIR	:= drivers/measured_boot/event_log/
44
45EVENT_LOG_SOURCES	:= ${EVENT_LOG_SRC_DIR}event_log.c		\
46			   ${EVENT_LOG_SRC_DIR}event_print.c
47