1d89bec83SSandrine Bailleux# 2*36e3d877SAbhi.Singh# Copyright (c) 2020-2025, Arm Limited. All rights reserved. 3d89bec83SSandrine Bailleux# 4d89bec83SSandrine Bailleux# SPDX-License-Identifier: BSD-3-Clause 5d89bec83SSandrine Bailleux# 6d89bec83SSandrine Bailleux 7d89bec83SSandrine Bailleux# Default log level to dump the event log (LOG_LEVEL_INFO) 8d89bec83SSandrine BailleuxEVENT_LOG_LEVEL ?= 40 9d89bec83SSandrine Bailleux 10*36e3d877SAbhi.Singh# When using a TPM, adopt the TPM's hash algorithm for 11*36e3d877SAbhi.Singh# measurements through the Event Log mechanism, ensuring 12*36e3d877SAbhi.Singh# the TPM uses the same algorithm for measurements and 13*36e3d877SAbhi.Singh# extends the PCR accordingly, allowing for comparison 14*36e3d877SAbhi.Singh# between PCR value and Event Log measurements required 15*36e3d877SAbhi.Singh# for attestation. 16*36e3d877SAbhi.Singhifdef MBOOT_TPM_HASH_ALG 17*36e3d877SAbhi.Singh MBOOT_EL_HASH_ALG := ${MBOOT_TPM_HASH_ALG} 1878da42a5Slaurenw-armelse 1978da42a5Slaurenw-arm MBOOT_EL_HASH_ALG := sha256 2078da42a5Slaurenw-armendif 21d89bec83SSandrine Bailleux 22*36e3d877SAbhi.Singh# Measured Boot hash algorithm. 23*36e3d877SAbhi.Singh# SHA-256 (or stronger) is required for all devices that are TPM 2.0 compliant. 2478da42a5Slaurenw-armifeq (${MBOOT_EL_HASH_ALG}, sha512) 25d89bec83SSandrine Bailleux TPM_ALG_ID := TPM_ALG_SHA512 26d89bec83SSandrine Bailleux TCG_DIGEST_SIZE := 64U 2778da42a5Slaurenw-armelse ifeq (${MBOOT_EL_HASH_ALG}, sha384) 28d89bec83SSandrine Bailleux TPM_ALG_ID := TPM_ALG_SHA384 29d89bec83SSandrine Bailleux TCG_DIGEST_SIZE := 48U 30d89bec83SSandrine Bailleuxelse 31d89bec83SSandrine Bailleux TPM_ALG_ID := TPM_ALG_SHA256 32d89bec83SSandrine Bailleux TCG_DIGEST_SIZE := 32U 3378da42a5Slaurenw-armendif #MBOOT_EL_HASH_ALG 34d89bec83SSandrine Bailleux 3514db963fSManish V Badarkhe# Set definitions for Measured Boot driver. 36d89bec83SSandrine Bailleux$(eval $(call add_defines,\ 37d89bec83SSandrine Bailleux $(sort \ 38d89bec83SSandrine Bailleux TPM_ALG_ID \ 39d89bec83SSandrine Bailleux TCG_DIGEST_SIZE \ 40d89bec83SSandrine Bailleux EVENT_LOG_LEVEL \ 41d89bec83SSandrine Bailleux))) 42d89bec83SSandrine Bailleux 43992d97c4SManish V BadarkheEVENT_LOG_SRC_DIR := drivers/measured_boot/event_log/ 44d89bec83SSandrine Bailleux 45992d97c4SManish V BadarkheEVENT_LOG_SOURCES := ${EVENT_LOG_SRC_DIR}event_log.c \ 46992d97c4SManish V Badarkhe ${EVENT_LOG_SRC_DIR}event_print.c 47