blob: 46658279051ccac622c2fb1e9c09e252ea6acdfb [file] [log] [blame]
Juan Castillo31a68f02015-04-14 12:49:03 +01001#
laurenw-arm7b7ebff2023-05-02 14:42:48 -05002# Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
Juan Castillo31a68f02015-04-14 12:49:03 +01003#
dp-armfa3cf0b2017-05-03 09:38:09 +01004# SPDX-License-Identifier: BSD-3-Clause
Juan Castillo31a68f02015-04-14 12:49:03 +01005#
6
Antonio Nino Diazd7da2f82018-10-10 11:14:44 +01007PLAT_BL_COMMON_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
Yatharth Kocharf528faf2016-06-28 16:58:26 +01008 plat/arm/board/common/${ARCH}/board_arm_helpers.S
Juan Castillo31a68f02015-04-14 12:49:03 +01009
Antonio Nino Diazd7da2f82018-10-10 11:14:44 +010010BL1_SOURCES += drivers/cfi/v2m/v2m_flash.c
Juan Castillo31a68f02015-04-14 12:49:03 +010011
Antonio Nino Diazd7da2f82018-10-10 11:14:44 +010012BL2_SOURCES += drivers/cfi/v2m/v2m_flash.c
Juan Castillo31a68f02015-04-14 12:49:03 +010013
14ifneq (${TRUSTED_BOARD_BOOT},0)
laurenw-arm2590dfd2022-12-13 09:42:40 -060015ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S
Max Shvetsov06dba292019-12-06 11:50:12 +000016ifneq (${ARM_CRYPTOCELL_INTEG}, 1)
17# ROTPK hash location
18ifeq (${ARM_ROTPK_LOCATION}, regs)
19 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID
20else ifeq (${ARM_ROTPK_LOCATION}, devel_rsa)
Max Shvetsov7b753d92020-02-11 12:41:08 +000021 CRYPTO_ALG=rsa
Max Shvetsov06dba292019-12-06 11:50:12 +000022 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` \
27option instead)
28else ifeq (${ARM_ROTPK_LOCATION}, devel_ecdsa)
Max Shvetsov7b753d92020-02-11 12:41:08 +000029 CRYPTO_ALG=ec
Max Shvetsov06dba292019-12-06 11:50:12 +000030 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` \
35option instead)
laurenw-arm055199b2022-10-28 11:26:32 -050036else 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` \
41option instead)
Max Shvetsov06dba292019-12-06 11:50:12 +000042else
Sandrine Bailleux3e183f92021-04-16 16:08:46 +020043$(error "Unsupported ARM_ROTPK_LOCATION value")
Max Shvetsov06dba292019-12-06 11:50:12 +000044endif
45
46$(eval $(call add_define,ARM_ROTPK_LOCATION_ID))
47
laurenw-armd3449782022-04-21 16:50:49 -050048ifeq (${ENABLE_RME}, 1)
49COT := cca
50endif
51
Max Shvetsov06dba292019-12-06 11:50:12 +000052# Force generation of the new hash if ROT_KEY is specified
53ifdef ROT_KEY
54 HASH_PREREQUISITES = $(ROT_KEY) FORCE
Max Shvetsov06dba292019-12-06 11:50:12 +000055endif
56
57$(ARM_ROTPK_HASH) : $(HASH_PREREQUISITES)
58ifndef ROT_KEY
59 $(error Cannot generate hash: no ROT_KEY defined)
60endif
Salome Thirot0b35da32022-07-14 16:14:15 +010061 ${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER | \
62 ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@
Max Shvetsov06dba292019-12-06 11:50:12 +000063
64# Certificate NV-Counters. Use values corresponding to tied off values in
65# ARM development platforms
66TFW_NVCTR_VAL ?= 31
67NTFW_NVCTR_VAL ?= 223
laurenw-arm7b7ebff2023-05-02 14:42:48 -050068# The CCA Non-Volatile Counter only exists on some Arm development platforms.
69# On others, we mock it by aliasing it to the Trusted Firmware Non-Volatile counter,
70# hence we set both counters to the same default value.
71CCAFW_NVCTR_VAL ?= 31
Max Shvetsov06dba292019-12-06 11:50:12 +000072else
73# Certificate NV-Counters when CryptoCell is integrated. For development
74# platforms we set the counter to first valid value.
75TFW_NVCTR_VAL ?= 0
76NTFW_NVCTR_VAL ?= 0
laurenw-arm7b7ebff2023-05-02 14:42:48 -050077CCAFW_NVCTR_VAL ?= 0
Max Shvetsov06dba292019-12-06 11:50:12 +000078endif
79BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
laurenw-arm055199b2022-10-28 11:26:32 -050080 ${ARM_ROTPK_S}
Max Shvetsov06dba292019-12-06 11:50:12 +000081BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
laurenw-arm055199b2022-10-28 11:26:32 -050082 ${ARM_ROTPK_S}
Juan Castillo31a68f02015-04-14 12:49:03 +010083
Sandrine Bailleux012f8712020-02-06 14:59:33 +010084# Allows platform code to provide implementation variants depending on the
85# selected chain of trust.
86$(eval $(call add_define,ARM_COT_${COT}))
87
88ifeq (${COT},dualroot)
89# Platform Root of Trust key files.
90ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
91ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
92
93# Provide the private key to cert_create tool. It needs it to sign the images.
94PROT_KEY := ${ARM_PROT_KEY}
95
96$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
97
98BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
99BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
100
101$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
laurenw-armd3449782022-04-21 16:50:49 -0500102$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
103endif
104
105ifeq (${COT},cca)
106# Platform and Secure World Root of Trust key files.
107ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
108ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
109ARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_rsa.pem
110ARM_SWD_ROTPK_HASH := plat/arm/board/common/swd_rotpk/arm_swd_rotpk_rsa_sha256.bin
111
112# Provide the private keys to cert_create tool. It needs them to sign the images.
113PROT_KEY := ${ARM_PROT_KEY}
114SWD_ROT_KEY := ${ARM_SWD_ROT_KEY}
115
116$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
117$(eval $(call add_define_val,ARM_SWD_ROTPK_HASH,'"$(ARM_SWD_ROTPK_HASH)"'))
118
119BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \
120 plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
121BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \
122 plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
123
124$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
125$(BUILD_PLAT)/bl1/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
Sandrine Bailleux012f8712020-02-06 14:59:33 +0100126$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
laurenw-armd3449782022-04-21 16:50:49 -0500127$(BUILD_PLAT)/bl2/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
Sandrine Bailleux012f8712020-02-06 14:59:33 +0100128endif
129
Juan Castillo31a68f02015-04-14 12:49:03 +0100130endif