195cfd4adSJuan Castillo# 2*d51981e1SRyan Everett# Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. 395cfd4adSJuan Castillo# 482cb2c1aSdp-arm# SPDX-License-Identifier: BSD-3-Clause 595cfd4adSJuan Castillo# 695cfd4adSJuan Castillo 71a0a3f06SYatharth KocharPLAT_BL_COMMON_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \ 81a0a3f06SYatharth Kochar plat/arm/board/common/${ARCH}/board_arm_helpers.S 995cfd4adSJuan Castillo 10aa7877c4SAntonio Nino DiazBL1_SOURCES += drivers/cfi/v2m/v2m_flash.c 1195cfd4adSJuan Castillo 12aa7877c4SAntonio Nino DiazBL2_SOURCES += drivers/cfi/v2m/v2m_flash.c 1395cfd4adSJuan Castillo 1495cfd4adSJuan Castilloifneq (${TRUSTED_BOARD_BOOT},0) 1595302e4bSlaurenw-armARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S 16*d51981e1SRyan EverettARM_ROTPK = $(BUILD_PLAT)/arm_rotpk.bin 17*d51981e1SRyan EverettARM_ROTPK_IS_HASH := 1 18*d51981e1SRyan Everett$(eval $(call add_define_val,ARM_ROTPK,'"$(ARM_ROTPK)"')) 19b65dfe40SSandrine Bailleux 2095cfd4adSJuan Castillo# ROTPK hash location 2195cfd4adSJuan Castilloifeq (${ARM_ROTPK_LOCATION}, regs) 2295cfd4adSJuan Castillo ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID 23*d51981e1SRyan Everettelse 24*d51981e1SRyan Everett# The ROTPK is a development key 25*d51981e1SRyan Everettifeq (${ARM_ROTPK_LOCATION}, devel_rsa) 26698e231dSMax Shvetsov CRYPTO_ALG=rsa 2795cfd4adSJuan Castillo ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_RSA_ID 28*d51981e1SRyan Everett ROT_KEY ?= plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem 29a6ffddecSMax Shvetsov$(warning Development keys support for FVP is deprecated. Use `regs` \ 30a6ffddecSMax Shvetsovoption instead) 319db9c65aSQixiang Xuelse ifeq (${ARM_ROTPK_LOCATION}, devel_ecdsa) 32698e231dSMax Shvetsov CRYPTO_ALG=ec 339db9c65aSQixiang Xu ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_ECDSA_ID 34*d51981e1SRyan Everett ROT_KEY ?= plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem 35a6ffddecSMax Shvetsov$(warning Development keys support for FVP is deprecated. Use `regs` \ 36a6ffddecSMax Shvetsovoption instead) 375f899286Slaurenw-armelse ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_rsa_key) 385f899286Slaurenw-arm CRYPTO_ALG=rsa 395f899286Slaurenw-arm ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID 40*d51981e1SRyan Everett ROT_KEY ?= plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem 41*d51981e1SRyan Everett ARM_ROTPK_IS_HASH = 0 425f899286Slaurenw-arm$(warning Development keys support for FVP is deprecated. Use `regs` \ 435f899286Slaurenw-armoption instead) 44b8ae6890Slaurenw-armelse ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_ecdsa_key) 45b8ae6890Slaurenw-arm CRYPTO_ALG=ec 46b8ae6890Slaurenw-arm ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_ECDSA_KEY_ID 47*d51981e1SRyan Everett ROT_KEY ?= plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem 48*d51981e1SRyan Everett ARM_ROTPK_IS_HASH = 0 49b8ae6890Slaurenw-arm$(warning Development keys support for FVP is deprecated. Use `regs` \ 50b8ae6890Slaurenw-armoption instead) 5195cfd4adSJuan Castilloelse 5295cfd4adSJuan Castillo$(error "Unsupported ARM_ROTPK_LOCATION value") 5395cfd4adSJuan Castilloendif 54*d51981e1SRyan Everett$(BUILD_PLAT)/bl1/arm_dev_rotpk.o : $(ARM_ROTPK) 55*d51981e1SRyan Everett$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK) 56*d51981e1SRyan Everettendif 57a6ffddecSMax Shvetsov 5895cfd4adSJuan Castillo$(eval $(call add_define,ARM_ROTPK_LOCATION_ID)) 59*d51981e1SRyan Everett$(eval $(call add_define,ARM_ROTPK_IS_HASH)) 6095cfd4adSJuan Castillo 61f2423792Slaurenw-armifeq (${ENABLE_RME}, 1) 62f2423792Slaurenw-armCOT := cca 63f2423792Slaurenw-armendif 64f2423792Slaurenw-arm 65*d51981e1SRyan Everett# Force generation of the ROT public key if ROT_KEY is specified 66a6ffddecSMax Shvetsovifdef ROT_KEY 67*d51981e1SRyan Everett PK_PREREQUISITES = $(ROT_KEY) FORCE 68a6ffddecSMax Shvetsovendif 69a6ffddecSMax Shvetsov 70*d51981e1SRyan Everett$(ARM_ROTPK) : $(PK_PREREQUISITES) 71a6ffddecSMax Shvetsovifndef ROT_KEY 72*d51981e1SRyan Everett $(error Cannot generate public key: no ROT_KEY defined) 73a6ffddecSMax Shvetsovendif 74*d51981e1SRyan Everettifeq ($(ARM_ROTPK_IS_HASH), 1) 75e95abc4cSSalome Thirot ${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER | \ 76*d51981e1SRyan Everett ${OPENSSL_BIN_PATH}/openssl dgst -${HASH_ALG} -binary -out $@ 77*d51981e1SRyan Everettelse 78*d51981e1SRyan Everett ${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER -out $@ 79*d51981e1SRyan Everettendif 80a6ffddecSMax Shvetsov 8148279d52SJuan Castillo# Certificate NV-Counters. Use values corresponding to tied off values in 8248279d52SJuan Castillo# ARM development platforms 8348279d52SJuan CastilloTFW_NVCTR_VAL ?= 31 8448279d52SJuan CastilloNTFW_NVCTR_VAL ?= 223 8502552d45Slaurenw-arm# The CCA Non-Volatile Counter only exists on some Arm development platforms. 8602552d45Slaurenw-arm# On others, we mock it by aliasing it to the Trusted Firmware Non-Volatile counter, 8702552d45Slaurenw-arm# hence we set both counters to the same default value. 8802552d45Slaurenw-armCCAFW_NVCTR_VAL ?= 31 89b65dfe40SSandrine Bailleux 90a6ffddecSMax ShvetsovBL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \ 915f899286Slaurenw-arm ${ARM_ROTPK_S} 92a6ffddecSMax ShvetsovBL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \ 935f899286Slaurenw-arm ${ARM_ROTPK_S} 94a6ffddecSMax Shvetsov 951035a706SSandrine Bailleux# Allows platform code to provide implementation variants depending on the 961035a706SSandrine Bailleux# selected chain of trust. 971035a706SSandrine Bailleux$(eval $(call add_define,ARM_COT_${COT})) 981035a706SSandrine Bailleux 991035a706SSandrine Bailleuxifeq (${COT},dualroot) 1001035a706SSandrine Bailleux# Platform Root of Trust key files. 1011035a706SSandrine BailleuxARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem 1021035a706SSandrine BailleuxARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin 1031035a706SSandrine Bailleux 1041035a706SSandrine Bailleux# Provide the private key to cert_create tool. It needs it to sign the images. 1051035a706SSandrine BailleuxPROT_KEY := ${ARM_PROT_KEY} 1061035a706SSandrine Bailleux 1071035a706SSandrine Bailleux$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"')) 1081035a706SSandrine Bailleux 1091035a706SSandrine BailleuxBL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S 1101035a706SSandrine BailleuxBL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S 1111035a706SSandrine Bailleux 1121035a706SSandrine Bailleux$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH) 1131035a706SSandrine Bailleux$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH) 1141035a706SSandrine Bailleuxendif 1151035a706SSandrine Bailleux 116f2423792Slaurenw-armifeq (${COT},cca) 117f2423792Slaurenw-arm# Platform and Secure World Root of Trust key files. 118f2423792Slaurenw-armARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem 119f2423792Slaurenw-armARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin 120f2423792Slaurenw-armARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_rsa.pem 121f2423792Slaurenw-armARM_SWD_ROTPK_HASH := plat/arm/board/common/swd_rotpk/arm_swd_rotpk_rsa_sha256.bin 122f2423792Slaurenw-arm 123f2423792Slaurenw-arm# Provide the private keys to cert_create tool. It needs them to sign the images. 124f2423792Slaurenw-armPROT_KEY := ${ARM_PROT_KEY} 125f2423792Slaurenw-armSWD_ROT_KEY := ${ARM_SWD_ROT_KEY} 126f2423792Slaurenw-arm 127f2423792Slaurenw-arm$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"')) 128f2423792Slaurenw-arm$(eval $(call add_define_val,ARM_SWD_ROTPK_HASH,'"$(ARM_SWD_ROTPK_HASH)"')) 129f2423792Slaurenw-arm 130f2423792Slaurenw-armBL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \ 131f2423792Slaurenw-arm plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S 132f2423792Slaurenw-armBL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \ 133f2423792Slaurenw-arm plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S 134f2423792Slaurenw-arm 135f2423792Slaurenw-arm$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH) 136f2423792Slaurenw-arm$(BUILD_PLAT)/bl1/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH) 137f2423792Slaurenw-arm$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH) 138f2423792Slaurenw-arm$(BUILD_PLAT)/bl2/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH) 139f2423792Slaurenw-armendif 140f2423792Slaurenw-arm 14195cfd4adSJuan Castilloendif 142