Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2020, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Javier Almansa Sobrino | 0d1f6b1 | 2020-09-18 16:47:07 +0100 | [diff] [blame] | 7 | # Default log level to dump the event log (LOG_LEVEL_INFO) |
| 8 | EVENT_LOG_LEVEL ?= 40 |
| 9 | |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 10 | # TPM hash algorithm |
| 11 | TPM_HASH_ALG := sha256 |
| 12 | |
| 13 | ifeq (${TPM_HASH_ALG}, sha512) |
| 14 | MBEDTLS_MD_ID := MBEDTLS_MD_SHA512 |
| 15 | TPM_ALG_ID := TPM_ALG_SHA512 |
| 16 | TCG_DIGEST_SIZE := 64U |
| 17 | else ifeq (${TPM_HASH_ALG}, sha384) |
| 18 | MBEDTLS_MD_ID := MBEDTLS_MD_SHA384 |
| 19 | TPM_ALG_ID := TPM_ALG_SHA384 |
| 20 | TCG_DIGEST_SIZE := 48U |
| 21 | else |
| 22 | MBEDTLS_MD_ID := MBEDTLS_MD_SHA256 |
| 23 | TPM_ALG_ID := TPM_ALG_SHA256 |
| 24 | TCG_DIGEST_SIZE := 32U |
| 25 | endif |
| 26 | |
| 27 | # Event Log length in bytes |
| 28 | EVENT_LOG_SIZE := 1024 |
| 29 | |
| 30 | # Set definitions for mbed TLS library and Measured Boot driver |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 31 | $(eval $(call add_defines,\ |
| 32 | $(sort \ |
| 33 | MBEDTLS_MD_ID \ |
| 34 | TPM_ALG_ID \ |
| 35 | TCG_DIGEST_SIZE \ |
| 36 | EVENT_LOG_SIZE \ |
Javier Almansa Sobrino | 0d1f6b1 | 2020-09-18 16:47:07 +0100 | [diff] [blame] | 37 | EVENT_LOG_LEVEL \ |
Leonardo Sandoval | 65fca7c | 2020-09-10 12:18:27 -0500 | [diff] [blame] | 38 | ))) |
Alexei Fedorov | 71d81dc | 2020-07-13 13:58:06 +0100 | [diff] [blame] | 39 | |
| 40 | ifeq (${HASH_ALG}, sha256) |
| 41 | ifneq (${TPM_HASH_ALG}, sha256) |
| 42 | $(eval $(call add_define,MBEDTLS_SHA512_C)) |
| 43 | endif |
| 44 | endif |
| 45 | |
| 46 | MEASURED_BOOT_SRC_DIR := drivers/measured_boot/ |
| 47 | |
| 48 | MEASURED_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 | |
| 52 | BL2_SOURCES += ${MEASURED_BOOT_SOURCES} |