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