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 |
| 28 | $(eval $(call add_define,MBEDTLS_MD_ID)) |
| 29 | $(eval $(call add_define,TPM_ALG_ID)) |
| 30 | $(eval $(call add_define,TCG_DIGEST_SIZE)) |
| 31 | $(eval $(call add_define,EVENT_LOG_SIZE)) |
| 32 | |
| 33 | ifeq (${HASH_ALG}, sha256) |
| 34 | ifneq (${TPM_HASH_ALG}, sha256) |
| 35 | $(eval $(call add_define,MBEDTLS_SHA512_C)) |
| 36 | endif |
| 37 | endif |
| 38 | |
| 39 | MEASURED_BOOT_SRC_DIR := drivers/measured_boot/ |
| 40 | |
| 41 | MEASURED_BOOT_SOURCES := ${MEASURED_BOOT_SRC_DIR}measured_boot.c \ |
| 42 | ${MEASURED_BOOT_SRC_DIR}event_log.c \ |
| 43 | ${MEASURED_BOOT_SRC_DIR}event_print.c |
| 44 | |
| 45 | BL2_SOURCES += ${MEASURED_BOOT_SOURCES} |