Juan Castillo | 31a68f0 | 2015-04-14 12:49:03 +0100 | [diff] [blame] | 1 | # |
laurenw-arm | 7b7ebff | 2023-05-02 14:42:48 -0500 | [diff] [blame] | 2 | # Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. |
Juan Castillo | 31a68f0 | 2015-04-14 12:49:03 +0100 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Juan Castillo | 31a68f0 | 2015-04-14 12:49:03 +0100 | [diff] [blame] | 5 | # |
| 6 | |
Antonio Nino Diaz | d7da2f8 | 2018-10-10 11:14:44 +0100 | [diff] [blame] | 7 | PLAT_BL_COMMON_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \ |
Yatharth Kochar | f528faf | 2016-06-28 16:58:26 +0100 | [diff] [blame] | 8 | plat/arm/board/common/${ARCH}/board_arm_helpers.S |
Juan Castillo | 31a68f0 | 2015-04-14 12:49:03 +0100 | [diff] [blame] | 9 | |
Antonio Nino Diaz | d7da2f8 | 2018-10-10 11:14:44 +0100 | [diff] [blame] | 10 | BL1_SOURCES += drivers/cfi/v2m/v2m_flash.c |
Juan Castillo | 31a68f0 | 2015-04-14 12:49:03 +0100 | [diff] [blame] | 11 | |
Antonio Nino Diaz | d7da2f8 | 2018-10-10 11:14:44 +0100 | [diff] [blame] | 12 | BL2_SOURCES += drivers/cfi/v2m/v2m_flash.c |
Juan Castillo | 31a68f0 | 2015-04-14 12:49:03 +0100 | [diff] [blame] | 13 | |
| 14 | ifneq (${TRUSTED_BOARD_BOOT},0) |
laurenw-arm | 2590dfd | 2022-12-13 09:42:40 -0600 | [diff] [blame] | 15 | ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 16 | ifneq (${ARM_CRYPTOCELL_INTEG}, 1) |
| 17 | # ROTPK hash location |
| 18 | ifeq (${ARM_ROTPK_LOCATION}, regs) |
| 19 | ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID |
| 20 | else ifeq (${ARM_ROTPK_LOCATION}, devel_rsa) |
Max Shvetsov | 7b753d9 | 2020-02-11 12:41:08 +0000 | [diff] [blame] | 21 | CRYPTO_ALG=rsa |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 22 | ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_RSA_ID |
| 23 | ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_rsa_sha256.bin |
| 24 | $(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"')) |
| 25 | $(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH) |
| 26 | $(warning Development keys support for FVP is deprecated. Use `regs` \ |
| 27 | option instead) |
| 28 | else ifeq (${ARM_ROTPK_LOCATION}, devel_ecdsa) |
Max Shvetsov | 7b753d9 | 2020-02-11 12:41:08 +0000 | [diff] [blame] | 29 | CRYPTO_ALG=ec |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 30 | ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_ECDSA_ID |
| 31 | ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_ecdsa_sha256.bin |
| 32 | $(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"')) |
| 33 | $(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH) |
| 34 | $(warning Development keys support for FVP is deprecated. Use `regs` \ |
| 35 | option instead) |
laurenw-arm | 055199b | 2022-10-28 11:26:32 -0500 | [diff] [blame] | 36 | else ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_rsa_key) |
| 37 | CRYPTO_ALG=rsa |
| 38 | ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID |
| 39 | ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_rsa_rotpk.S |
| 40 | $(warning Development keys support for FVP is deprecated. Use `regs` \ |
| 41 | option instead) |
laurenw-arm | 0216953 | 2023-08-15 14:57:56 -0500 | [diff] [blame] | 42 | else ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_ecdsa_key) |
| 43 | CRYPTO_ALG=ec |
| 44 | ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_ECDSA_KEY_ID |
| 45 | ifeq (${KEY_SIZE},384) |
| 46 | ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_ecdsa_p384_rotpk.S |
| 47 | else |
| 48 | ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_ecdsa_p256_rotpk.S |
| 49 | endif |
| 50 | $(warning Development keys support for FVP is deprecated. Use `regs` \ |
| 51 | option instead) |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 52 | else |
Sandrine Bailleux | 3e183f9 | 2021-04-16 16:08:46 +0200 | [diff] [blame] | 53 | $(error "Unsupported ARM_ROTPK_LOCATION value") |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 54 | endif |
| 55 | |
| 56 | $(eval $(call add_define,ARM_ROTPK_LOCATION_ID)) |
| 57 | |
laurenw-arm | d344978 | 2022-04-21 16:50:49 -0500 | [diff] [blame] | 58 | ifeq (${ENABLE_RME}, 1) |
| 59 | COT := cca |
| 60 | endif |
| 61 | |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 62 | # Force generation of the new hash if ROT_KEY is specified |
| 63 | ifdef ROT_KEY |
| 64 | HASH_PREREQUISITES = $(ROT_KEY) FORCE |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 65 | endif |
| 66 | |
| 67 | $(ARM_ROTPK_HASH) : $(HASH_PREREQUISITES) |
| 68 | ifndef ROT_KEY |
| 69 | $(error Cannot generate hash: no ROT_KEY defined) |
| 70 | endif |
Salome Thirot | 0b35da3 | 2022-07-14 16:14:15 +0100 | [diff] [blame] | 71 | ${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER | \ |
| 72 | ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@ |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 73 | |
| 74 | # Certificate NV-Counters. Use values corresponding to tied off values in |
| 75 | # ARM development platforms |
| 76 | TFW_NVCTR_VAL ?= 31 |
| 77 | NTFW_NVCTR_VAL ?= 223 |
laurenw-arm | 7b7ebff | 2023-05-02 14:42:48 -0500 | [diff] [blame] | 78 | # The CCA Non-Volatile Counter only exists on some Arm development platforms. |
| 79 | # On others, we mock it by aliasing it to the Trusted Firmware Non-Volatile counter, |
| 80 | # hence we set both counters to the same default value. |
| 81 | CCAFW_NVCTR_VAL ?= 31 |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 82 | else |
| 83 | # Certificate NV-Counters when CryptoCell is integrated. For development |
| 84 | # platforms we set the counter to first valid value. |
| 85 | TFW_NVCTR_VAL ?= 0 |
| 86 | NTFW_NVCTR_VAL ?= 0 |
laurenw-arm | 7b7ebff | 2023-05-02 14:42:48 -0500 | [diff] [blame] | 87 | CCAFW_NVCTR_VAL ?= 0 |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 88 | endif |
| 89 | BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \ |
laurenw-arm | 055199b | 2022-10-28 11:26:32 -0500 | [diff] [blame] | 90 | ${ARM_ROTPK_S} |
Max Shvetsov | 06dba29 | 2019-12-06 11:50:12 +0000 | [diff] [blame] | 91 | BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \ |
laurenw-arm | 055199b | 2022-10-28 11:26:32 -0500 | [diff] [blame] | 92 | ${ARM_ROTPK_S} |
Juan Castillo | 31a68f0 | 2015-04-14 12:49:03 +0100 | [diff] [blame] | 93 | |
Sandrine Bailleux | 012f871 | 2020-02-06 14:59:33 +0100 | [diff] [blame] | 94 | # Allows platform code to provide implementation variants depending on the |
| 95 | # selected chain of trust. |
| 96 | $(eval $(call add_define,ARM_COT_${COT})) |
| 97 | |
| 98 | ifeq (${COT},dualroot) |
| 99 | # Platform Root of Trust key files. |
| 100 | ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem |
| 101 | ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin |
| 102 | |
| 103 | # Provide the private key to cert_create tool. It needs it to sign the images. |
| 104 | PROT_KEY := ${ARM_PROT_KEY} |
| 105 | |
| 106 | $(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"')) |
| 107 | |
| 108 | BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S |
| 109 | BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S |
| 110 | |
| 111 | $(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH) |
laurenw-arm | d344978 | 2022-04-21 16:50:49 -0500 | [diff] [blame] | 112 | $(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH) |
| 113 | endif |
| 114 | |
| 115 | ifeq (${COT},cca) |
| 116 | # Platform and Secure World Root of Trust key files. |
| 117 | ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem |
| 118 | ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin |
| 119 | ARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_rsa.pem |
| 120 | ARM_SWD_ROTPK_HASH := plat/arm/board/common/swd_rotpk/arm_swd_rotpk_rsa_sha256.bin |
| 121 | |
| 122 | # Provide the private keys to cert_create tool. It needs them to sign the images. |
| 123 | PROT_KEY := ${ARM_PROT_KEY} |
| 124 | SWD_ROT_KEY := ${ARM_SWD_ROT_KEY} |
| 125 | |
| 126 | $(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"')) |
| 127 | $(eval $(call add_define_val,ARM_SWD_ROTPK_HASH,'"$(ARM_SWD_ROTPK_HASH)"')) |
| 128 | |
| 129 | BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \ |
| 130 | plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S |
| 131 | BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \ |
| 132 | plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S |
| 133 | |
| 134 | $(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH) |
| 135 | $(BUILD_PLAT)/bl1/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH) |
Sandrine Bailleux | 012f871 | 2020-02-06 14:59:33 +0100 | [diff] [blame] | 136 | $(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH) |
laurenw-arm | d344978 | 2022-04-21 16:50:49 -0500 | [diff] [blame] | 137 | $(BUILD_PLAT)/bl2/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH) |
Sandrine Bailleux | 012f871 | 2020-02-06 14:59:33 +0100 | [diff] [blame] | 138 | endif |
| 139 | |
Juan Castillo | 31a68f0 | 2015-04-14 12:49:03 +0100 | [diff] [blame] | 140 | endif |