mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-19 02:54:24 +00:00
Merge changes from topic "refactor-arm-key-files" into integration
* changes: feat(mbedtls): optimize SHA256 for reduced memory footprint refactor(arm): rename ARM_ROTPK_HEADER_LEN docs(arm): update docs to reflect rotpk key changes feat(arm): use provided algs for (swd/p)rotpk feat(arm): use the provided hash alg to hash rotpk
This commit is contained in:
commit
5808766210
32 changed files with 377 additions and 272 deletions
|
@ -54,16 +54,34 @@ images with support for these features:
|
|||
On Juno board, the default value corresponds to an ECDSA-SECP256R1 public
|
||||
key hash, whose private part is not currently available.
|
||||
|
||||
- ``ARM_ROTPK_LOCATION=devel_rsa``: use the default hash located in
|
||||
``plat/arm/board/common/rotpk/arm_rotpk_rsa_sha256.bin``. Enforce
|
||||
generation of the new hash if ``ROT_KEY`` is specified.
|
||||
- ``ARM_ROTPK_LOCATION=devel_rsa``: the ROTPK is a hash of the
|
||||
RSA public key corresponding to the private key specified by
|
||||
``ROT_KEY``. If ``ROT_KEY`` is not specified, the private key is
|
||||
the development key ``plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem``.
|
||||
There are also 3k and 4k RSA development keys in ``plat/arm/board/common/rotpk/``.
|
||||
The hashing algorithm is selected by ``HASH_ALG``; sha256 is used if
|
||||
``HASH_ALG`` is not specified.
|
||||
|
||||
- ``ARM_ROTPK_LOCATION=devel_ecdsa``: use the default hash located in
|
||||
``plat/arm/board/common/rotpk/arm_rotpk_ecdsa_sha256.bin``. Enforce
|
||||
generation of the new hash if ``ROT_KEY`` is specified.
|
||||
- ``ARM_ROTPK_LOCATION=devel_ecdsa``: the ROTPK is a hash of the
|
||||
ECDSA public key corresponding to the private key specified by
|
||||
``ROT_KEY``. If ``ROT_KEY`` is not specified, the private key is
|
||||
the development key ``plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem`` by default,
|
||||
a 384 bit key ``plat/arm/board/common/rotpk/arm_rotprivk_ecdsa_secp384r1.pem`` also exists,
|
||||
and can be specified by ``ROT_KEY``. The hashing algorithm is selected by ``HASH_ALG``;
|
||||
sha256 is used if ``HASH_ALG`` is not specified.
|
||||
|
||||
- ``ARM_ROTPK_LOCATION=devel_full_dev_rsa_key``: use the key located in
|
||||
``plat/arm/board/common/rotpk/arm_full_dev_rsa_rotpk.S``.
|
||||
- ``ARM_ROTPK_LOCATION=devel_full_dev_rsa_key``: the ROTPK is an unhashed
|
||||
RSA public key corresponding to the private key specified by ``ROT_KEY``.
|
||||
If ``ROT_KEY`` is not specified, the private key is the development key
|
||||
``plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem``. There are also
|
||||
3k and 4k RSA development keys in ``plat/arm/board/common/rotpk/``.
|
||||
|
||||
- ``ARM_ROTPK_LOCATION=devel_full_dev_ecdsa_key``: the ROTPK is an unhashed
|
||||
RSA public key corresponding to the private key specified by ``ROT_KEY``.
|
||||
If ``ROT_KEY`` is not specified, the private key is the development key
|
||||
``plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem``, a 384 bit key
|
||||
``plat/arm/board/common/rotpk/arm_rotprivk_ecdsa_secp384r1.pem`` also exists,
|
||||
and can be specified by ``ROT_KEY``.
|
||||
|
||||
Example of command line using RSA development keys:
|
||||
|
||||
|
@ -119,7 +137,7 @@ images with support for these features:
|
|||
|
||||
--------------
|
||||
|
||||
*Copyright (c) 2019-2022, Arm Limited. All rights reserved.*
|
||||
*Copyright (c) 2019-2024, Arm Limited. All rights reserved.*
|
||||
|
||||
.. _mbed TLS Repository: https://github.com/ARMmbed/mbedtls.git
|
||||
.. _mbed TLS Security Center: https://tls.mbed.org/security
|
||||
|
|
|
@ -39,7 +39,8 @@ The implicitly trusted components forming the trust anchor are:
|
|||
|
||||
- A Root of Trust Public Key (ROTPK), or a hash of it.
|
||||
|
||||
On Arm development platforms, a SHA-256 hash of the ROTPK is stored in the
|
||||
On Arm development platforms, a hash of the ROTPK (hash algorithm selected by
|
||||
the ``HASH_ALG`` build option, with sha256 as default) is stored in the
|
||||
trusted root-key storage registers. Alternatively, a development ROTPK might
|
||||
be used and its hash embedded into the BL1 and BL2 images (only for
|
||||
development purposes).
|
||||
|
@ -330,7 +331,7 @@ Instructions for building and using the tool can be found in the
|
|||
|
||||
--------------
|
||||
|
||||
*Copyright (c) 2015-2020, Arm Limited and Contributors. All rights reserved.*
|
||||
*Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.*
|
||||
|
||||
.. _X.509 v3: https://tools.ietf.org/rfc/rfc5280.txt
|
||||
.. _Trusted Board Boot Requirements (TBBR): https://developer.arm.com/docs/den0006/latest
|
||||
|
|
|
@ -65,25 +65,26 @@ Arm Platform Build Options
|
|||
- ``regs`` : return the ROTPK hash stored in the Trusted root-key storage
|
||||
registers.
|
||||
- ``devel_rsa`` : return a development public key hash embedded in the BL1
|
||||
and BL2 binaries. This hash has been obtained from the RSA public key
|
||||
``arm_rotpk_rsa.der``, located in ``plat/arm/board/common/rotpk``. To use
|
||||
this option, ``arm_rotprivk_rsa.pem`` must be specified as ``ROT_KEY``
|
||||
when creating the certificates.
|
||||
and BL2 binaries. This hash corresponds to the development private key
|
||||
``plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem``.
|
||||
The hashing algorithm is selected by ``HASH_ALG``; sha256 is used if
|
||||
``HASH_ALG`` is not specified. A different RSA key can be specified by setting
|
||||
``ROT_KEY``, there are 3k and 4k RSA keys in ``plat/arm/board/common/rotpk/``.
|
||||
- ``devel_ecdsa`` : return a development public key hash embedded in the BL1
|
||||
and BL2 binaries. This hash has been obtained from the ECDSA public key
|
||||
``arm_rotpk_ecdsa.der``, located in ``plat/arm/board/common/rotpk``. To
|
||||
use this option, ``arm_rotprivk_ecdsa.pem`` must be specified as
|
||||
``ROT_KEY`` when creating the certificates.
|
||||
- ``devel_full_dev_rsa_key`` : returns a development public key embedded in
|
||||
the BL1 and BL2 binaries. This key has been obtained from the RSA public
|
||||
key ``arm_rotpk_rsa.der``, located in ``plat/arm/board/common/rotpk``.
|
||||
|
||||
- ``ARM_ROTPK_HASH``: used when ``ARM_ROTPK_LOCATION=devel_*``, excluding
|
||||
``devel_full_dev_rsa_key``. Specifies the location of the ROTPK hash. Not
|
||||
expected to be a build option. This defaults to
|
||||
``plat/arm/board/common/rotpk/*_sha256.bin`` depending on the specified
|
||||
algorithm. Providing ``ROT_KEY`` enforces generation of the hash from the
|
||||
``ROT_KEY`` and overwrites the default hash file.
|
||||
and BL2 binaries. This hash corresponds to the development private key
|
||||
``plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem`` unless a different key
|
||||
is specified with ``ROT_KEY``, such as the 384 bit key in the same directory.
|
||||
he hashing algorithm is selected by ``HASH_ALG``; sha256 is used if ``HASH_ALG``
|
||||
is not specified.
|
||||
- ``devel_full_dev_rsa_key`` : return a development public key embedded in
|
||||
the BL1 and BL2 binaries. This key corresponds to the RSA private
|
||||
key ``plat/arm/board/common/rotpk/arm_rotprivk.pem`` by default, but can
|
||||
be changed by setting ``ROT_KEY``, there are 3k and 4k RSA keys in
|
||||
``plat/arm/board/common/rotpk/``.
|
||||
- ``devel_full_dev_ecdsa_key`` : return a development public key embedded in
|
||||
the BL1 and BL2 binaries. This key corresponds to the EC private key
|
||||
``plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem``, unless a different
|
||||
ECDSA key is specified by ``ROT_KEY``, such as the 384 bit key in the same directory.
|
||||
|
||||
- ``ARM_TSP_RAM_LOCATION``: location of the TSP binary. Options:
|
||||
|
||||
|
|
|
@ -152,3 +152,9 @@
|
|||
* the warnings to more functions.
|
||||
*/
|
||||
#define MBEDTLS_CHECK_RETURN_WARNING
|
||||
|
||||
/*
|
||||
* Use an implementation of SHA-256 with a smaller memory footprint but reduced
|
||||
* speed.
|
||||
*/
|
||||
#define MBEDTLS_SHA256_SMALLER
|
||||
|
|
|
@ -13,12 +13,9 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Root of trust key lengths
|
||||
* Length of the header for a hashed DER ROTPK.
|
||||
*/
|
||||
#ifndef ARM_ROTPK_HEADER_LEN
|
||||
#define ARM_ROTPK_HEADER_LEN 19
|
||||
#endif
|
||||
#ifndef ARM_ROTPK_HASH_LEN
|
||||
#define ARM_ROTPK_HASH_LEN 32
|
||||
#ifndef ARM_ROTPK_HASH_DER_HEADER_LEN
|
||||
#define ARM_ROTPK_HASH_DER_HEADER_LEN 19
|
||||
#endif
|
||||
#endif /* ROTPK_DEF_H */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2024, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* Copyright (C) 2017-2023 Nuvoton Ltd.
|
||||
*
|
||||
|
@ -30,10 +30,9 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Root of trust key hash lengths
|
||||
* Length of the header for a hashed DER ROTPK.
|
||||
*/
|
||||
#define ARM_ROTPK_HEADER_LEN 19
|
||||
#define ARM_ROTPK_HASH_LEN 32
|
||||
#define ARM_ROTPK_HASH_DER_HEADER_LEN 19
|
||||
|
||||
/* Special value used to verify platform parameters from BL2 to BL31 */
|
||||
#define ARM_BL31_PLAT_PARAM_VAL ULL(0x0f1e2d3c4b5a6978)
|
||||
|
|
|
@ -44,11 +44,11 @@ uintptr_t nv_cntr_base_addr[MAX_NV_CTR_IDS] = {
|
|||
#pragma weak plat_get_nv_ctr
|
||||
#pragma weak plat_set_nv_ctr
|
||||
|
||||
extern unsigned char arm_rotpk_header[], arm_rotpk_key[], arm_rotpk_hash_end[],
|
||||
extern unsigned char arm_rotpk_hash_der_header[], arm_rotpk_key[], arm_rotpk_hash_end[],
|
||||
arm_rotpk_key_end[];
|
||||
|
||||
#if (ARM_ROTPK_LOCATION_ID == ARM_ROTPK_REGS_ID)
|
||||
static unsigned char rotpk_hash_der[ARM_ROTPK_HEADER_LEN + ARM_ROTPK_HASH_LEN];
|
||||
static unsigned char rotpk_hash_der[ARM_ROTPK_HASH_DER_HEADER_LEN + ARM_ROTPK_HASH_LEN];
|
||||
#endif
|
||||
|
||||
#if (ARM_ROTPK_LOCATION_ID == ARM_ROTPK_REGS_ID)
|
||||
|
@ -68,8 +68,8 @@ int arm_get_rotpk_info_regs(void **key_ptr, unsigned int *key_len,
|
|||
|
||||
/* Copy the DER header */
|
||||
|
||||
memcpy(rotpk_hash_der, arm_rotpk_header, ARM_ROTPK_HEADER_LEN);
|
||||
dst = (uint8_t *)&rotpk_hash_der[ARM_ROTPK_HEADER_LEN];
|
||||
memcpy(rotpk_hash_der, arm_rotpk_hash_der_header, ARM_ROTPK_HASH_DER_HEADER_LEN);
|
||||
dst = (uint8_t *)&rotpk_hash_der[ARM_ROTPK_HASH_DER_HEADER_LEN];
|
||||
|
||||
words = ARM_ROTPK_HASH_LEN >> 2;
|
||||
|
||||
|
@ -95,8 +95,8 @@ int arm_get_rotpk_info_regs(void **key_ptr, unsigned int *key_len,
|
|||
int arm_get_rotpk_info_dev(void **key_ptr, unsigned int *key_len,
|
||||
unsigned int *flags)
|
||||
{
|
||||
*key_ptr = arm_rotpk_header;
|
||||
*key_len = arm_rotpk_hash_end - arm_rotpk_header;
|
||||
*key_ptr = arm_rotpk_hash_der_header;
|
||||
*key_len = arm_rotpk_hash_end - arm_rotpk_hash_der_header;
|
||||
*flags = ROTPK_IS_HASH;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
|
||||
# Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
@ -13,63 +13,70 @@ BL2_SOURCES += drivers/cfi/v2m/v2m_flash.c
|
|||
|
||||
ifneq (${TRUSTED_BOARD_BOOT},0)
|
||||
ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S
|
||||
ARM_ROTPK = $(BUILD_PLAT)/arm_rotpk.bin
|
||||
ARM_ROTPK_IS_HASH := 1
|
||||
$(eval $(call add_define_val,ARM_ROTPK,'"$(ARM_ROTPK)"'))
|
||||
|
||||
# ROTPK hash location
|
||||
ifeq (${ARM_ROTPK_LOCATION}, regs)
|
||||
ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID
|
||||
else ifeq (${ARM_ROTPK_LOCATION}, devel_rsa)
|
||||
else
|
||||
# The ROTPK is a development key
|
||||
ifeq (${ARM_ROTPK_LOCATION}, devel_rsa)
|
||||
CRYPTO_ALG=rsa
|
||||
ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_RSA_ID
|
||||
ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_rsa_sha256.bin
|
||||
$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
|
||||
$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
|
||||
ROT_KEY ?= plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem
|
||||
$(warning Development keys support for FVP is deprecated. Use `regs` \
|
||||
option instead)
|
||||
else ifeq (${ARM_ROTPK_LOCATION}, devel_ecdsa)
|
||||
CRYPTO_ALG=ec
|
||||
ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_ECDSA_ID
|
||||
ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_ecdsa_sha256.bin
|
||||
$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
|
||||
$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
|
||||
ROT_KEY ?= plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem
|
||||
$(warning Development keys support for FVP is deprecated. Use `regs` \
|
||||
option instead)
|
||||
else ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_rsa_key)
|
||||
CRYPTO_ALG=rsa
|
||||
ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID
|
||||
ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_rsa_rotpk.S
|
||||
ROT_KEY ?= plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem
|
||||
ARM_ROTPK_IS_HASH = 0
|
||||
$(warning Development keys support for FVP is deprecated. Use `regs` \
|
||||
option instead)
|
||||
else ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_ecdsa_key)
|
||||
CRYPTO_ALG=ec
|
||||
ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_ECDSA_KEY_ID
|
||||
ifeq (${KEY_SIZE},384)
|
||||
ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_ecdsa_p384_rotpk.S
|
||||
else
|
||||
ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_ecdsa_p256_rotpk.S
|
||||
endif
|
||||
ROT_KEY ?= plat/arm/board/common/rotpk/arm_rotprivk_ecdsa.pem
|
||||
ARM_ROTPK_IS_HASH = 0
|
||||
$(warning Development keys support for FVP is deprecated. Use `regs` \
|
||||
option instead)
|
||||
else
|
||||
$(error "Unsupported ARM_ROTPK_LOCATION value")
|
||||
endif
|
||||
$(BUILD_PLAT)/bl1/arm_dev_rotpk.o : $(ARM_ROTPK)
|
||||
$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK)
|
||||
endif
|
||||
|
||||
$(eval $(call add_define,ARM_ROTPK_LOCATION_ID))
|
||||
$(eval $(call add_define,ARM_ROTPK_IS_HASH))
|
||||
|
||||
ifeq (${ENABLE_RME}, 1)
|
||||
COT := cca
|
||||
endif
|
||||
|
||||
# Force generation of the new hash if ROT_KEY is specified
|
||||
# Force generation of the ROT public key if ROT_KEY is specified
|
||||
ifdef ROT_KEY
|
||||
HASH_PREREQUISITES = $(ROT_KEY) FORCE
|
||||
PK_PREREQUISITES = $(ROT_KEY) FORCE
|
||||
endif
|
||||
|
||||
$(ARM_ROTPK_HASH) : $(HASH_PREREQUISITES)
|
||||
$(ARM_ROTPK) : $(PK_PREREQUISITES)
|
||||
ifndef ROT_KEY
|
||||
$(error Cannot generate hash: no ROT_KEY defined)
|
||||
$(error Cannot generate public key: no ROT_KEY defined)
|
||||
endif
|
||||
ifeq ($(ARM_ROTPK_IS_HASH), 1)
|
||||
${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER | \
|
||||
${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@
|
||||
${OPENSSL_BIN_PATH}/openssl dgst -${HASH_ALG} -binary -out $@
|
||||
else
|
||||
${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER -out $@
|
||||
endif
|
||||
|
||||
# Certificate NV-Counters. Use values corresponding to tied off values in
|
||||
# ARM development platforms
|
||||
|
@ -85,50 +92,73 @@ BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
|
|||
BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
|
||||
${ARM_ROTPK_S}
|
||||
|
||||
ifeq ($(CRYPTO_ALG), ec)
|
||||
ifeq ($(KEY_SIZE), 384)
|
||||
ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_ecdsa_secp384r1.pem
|
||||
ARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_ecdsa_secp384r1.pem
|
||||
else
|
||||
ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_ecdsa.pem
|
||||
ARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_ecdsa.pem
|
||||
endif
|
||||
else
|
||||
ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
|
||||
ARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_rsa.pem
|
||||
endif
|
||||
|
||||
# Allows platform code to provide implementation variants depending on the
|
||||
# selected chain of trust.
|
||||
$(eval $(call add_define,ARM_COT_${COT}))
|
||||
|
||||
ifeq (${COT},dualroot)
|
||||
# Platform Root of Trust key files.
|
||||
ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
|
||||
ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
|
||||
ARM_PROTPK := $(BUILD_PLAT)/arm_protpk.bin
|
||||
|
||||
# Provide the private key to cert_create tool. It needs it to sign the images.
|
||||
PROT_KEY := ${ARM_PROT_KEY}
|
||||
|
||||
$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
|
||||
$(eval $(call add_define_val,ARM_PROTPK,'"$(ARM_PROTPK)"'))
|
||||
|
||||
BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
|
||||
BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
|
||||
|
||||
$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
|
||||
$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
|
||||
$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK)
|
||||
$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK)
|
||||
endif
|
||||
|
||||
ifeq (${COT},cca)
|
||||
# Platform and Secure World Root of Trust key files.
|
||||
ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
|
||||
ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
|
||||
ARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_rsa.pem
|
||||
ARM_SWD_ROTPK_HASH := plat/arm/board/common/swd_rotpk/arm_swd_rotpk_rsa_sha256.bin
|
||||
ARM_PROTPK := $(BUILD_PLAT)/arm_protpk.bin
|
||||
ARM_SWD_ROTPK := $(BUILD_PLAT)/arm_swd_rotpk.bin
|
||||
|
||||
# Provide the private keys to cert_create tool. It needs them to sign the images.
|
||||
PROT_KEY := ${ARM_PROT_KEY}
|
||||
SWD_ROT_KEY := ${ARM_SWD_ROT_KEY}
|
||||
|
||||
$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
|
||||
$(eval $(call add_define_val,ARM_SWD_ROTPK_HASH,'"$(ARM_SWD_ROTPK_HASH)"'))
|
||||
$(eval $(call add_define_val,ARM_PROTPK,'"$(ARM_PROTPK)"'))
|
||||
$(eval $(call add_define_val,ARM_SWD_ROTPK,'"$(ARM_SWD_ROTPK)"'))
|
||||
|
||||
BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \
|
||||
plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
|
||||
BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \
|
||||
plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
|
||||
|
||||
$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
|
||||
$(BUILD_PLAT)/bl1/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
|
||||
$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
|
||||
$(BUILD_PLAT)/bl2/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
|
||||
$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK)
|
||||
$(BUILD_PLAT)/bl1/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK)
|
||||
$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK)
|
||||
$(BUILD_PLAT)/bl2/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK)
|
||||
endif
|
||||
|
||||
$(ARM_PROTPK): $(ARM_PROT_KEY)
|
||||
ifndef ARM_PROT_KEY
|
||||
$(error Cannot generate hash: no PROT_KEY defined)
|
||||
endif
|
||||
${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in ${ARM_PROT_KEY} -pubout -outform DER | \
|
||||
${OPENSSL_BIN_PATH}/openssl dgst -${HASH_ALG} -binary -out $@
|
||||
|
||||
$(ARM_SWD_ROTPK): $(ARM_SWD_ROT_KEY)
|
||||
ifndef ARM_SWD_ROT_KEY
|
||||
$(error Cannot generate hash: no SWD_KEY defined)
|
||||
endif
|
||||
${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in ${ARM_SWD_ROT_KEY} -pubout -outform DER | \
|
||||
${OPENSSL_BIN_PATH}/openssl dgst -${HASH_ALG} -binary -out $@
|
||||
endif
|
||||
|
|
|
@ -6,9 +6,12 @@ root-of-trust key.
|
|||
|
||||
openssl genrsa 2048 > arm_protprivk_rsa.pem
|
||||
|
||||
* arm_protpk_rsa_sha256.bin is the SHA-256 hash of the DER-encoded public key
|
||||
associated with the above private key. It has been generated using the openssl
|
||||
command line tool:
|
||||
* arm_protprivk_ecdsa.pem is a P-256 ECSA private key in PEM format. It has been
|
||||
generated using the openssl command line tool:
|
||||
|
||||
openssl rsa -in arm_protprivk_rsa.pem -pubout -outform DER | \
|
||||
openssl dgst -sha256 -binary > arm_protpk_rsa_sha256.bin
|
||||
openssl ecparam -name prime256v1 -genkey -outform PEM -noout -out arm_protprivk_ecdsa.pem
|
||||
|
||||
* arm_protprivk_ecdsa_secp384r1.pem is a P-384 ECSA private key in PEM format. It has been
|
||||
generated using the openssl command line tool:
|
||||
|
||||
openssl ecparam -name secp384r1 -genkey -outform PEM -noout -out arm_protprivk_ecdsa_secp384r1.pem
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2024, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -9,10 +9,31 @@
|
|||
|
||||
.section .rodata.arm_protpk_hash, "a"
|
||||
|
||||
/*
|
||||
* The protpk header is dependent only on the algorithm used to
|
||||
* generate the hash.
|
||||
* ASN1_HASH_ALG is the last byte used to encode the OID for
|
||||
* the hash algorithm into the header,
|
||||
* this byte distinguishes between SHA256, SHA384 and SHA512.
|
||||
*/
|
||||
.equ HASH_ASN1_LEN, ARM_ROTPK_HASH_LEN
|
||||
#if ARM_ROTPK_HASH_LEN == 48
|
||||
.equ ASN1_HASH_ALG, 0x02
|
||||
.equ TOTAL_ASN1_LEN, 0x41
|
||||
#elif ARM_ROTPK_HASH_LEN == 64
|
||||
.equ ASN1_HASH_ALG, 0x03
|
||||
.equ TOTAL_ASN1_LEN, 0x51
|
||||
#elif ARM_ROTPK_HASH_LEN == 32
|
||||
.equ ASN1_HASH_ALG, 0x01
|
||||
.equ TOTAL_ASN1_LEN, 0x31
|
||||
#else
|
||||
.error "Invalid PROTPK hash length."
|
||||
#endif
|
||||
|
||||
arm_protpk_hash:
|
||||
/* DER header. */
|
||||
.byte 0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48
|
||||
.byte 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20
|
||||
.byte 0x30, TOTAL_ASN1_LEN, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48
|
||||
.byte 0x01, 0x65, 0x03, 0x04, 0x02, ASN1_HASH_ALG, 0x05, 0x00, 0x04, HASH_ASN1_LEN
|
||||
/* Key hash. */
|
||||
.incbin ARM_PROTPK_HASH
|
||||
.incbin ARM_PROTPK
|
||||
arm_protpk_hash_end:
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
œó6{W*…`Ÿtíve×·§è£ €¾P<C2BE>ÆK{9
|
5
plat/arm/board/common/protpk/arm_protprivk_ecdsa.pem
Normal file
5
plat/arm/board/common/protpk/arm_protprivk_ecdsa.pem
Normal file
|
@ -0,0 +1,5 @@
|
|||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEILviumKhnibRT6+73/WOURk8lCxu/AHRQVcbCn/nGAr8oAoGCCqGSM49
|
||||
AwEHoUQDQgAE2HPZeAd+P8kZKHcCMfNUE+MlZSKJV360gYYC1JEdogyYztJ/QbKj
|
||||
26CZijUU/He2b9kkCOpZoJp3UuMRlsQE4Q==
|
||||
-----END EC PRIVATE KEY-----
|
|
@ -0,0 +1,6 @@
|
|||
-----BEGIN EC PRIVATE KEY-----
|
||||
MIGkAgEBBDCn+L3kRlvrZKnemt8aDOH+ujwuhpdwAM2ZxacxudJPy5qrWCjXGIh1
|
||||
gOAMHlGESySgBwYFK4EEACKhZANiAASM5exqdUZi0msFLGi42bIMW7FPqWsJ8YmL
|
||||
scDkI6BUYRoP0V4XZWB7NOjP6y/tm5Uwid9q25QTlhNKUo5qki1YH3T6unHuylWN
|
||||
63KRHQLOaXCXZqhMhT0wccg0gG3hs+0=
|
||||
-----END EC PRIVATE KEY-----
|
|
@ -6,20 +6,64 @@
|
|||
|
||||
#include <plat/arm/board/common/rotpk/rotpk_def.h>
|
||||
|
||||
.global arm_rotpk_header
|
||||
#if ARM_ROTPK_IS_HASH == 1
|
||||
.global arm_rotpk_hash_der_header
|
||||
.global arm_rotpk_hash_end
|
||||
.section .rodata.arm_rotpk_hash, "a"
|
||||
|
||||
arm_rotpk_header:
|
||||
.byte 0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48
|
||||
.byte 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20
|
||||
arm_rotpk_header_len:
|
||||
#ifndef ARM_ROTPK_HASH_LEN
|
||||
.error "ROTPK hash not defined."
|
||||
#endif
|
||||
|
||||
#ifdef ARM_ROTPK_HASH
|
||||
.global arm_rotpk_hash_end
|
||||
.incbin ARM_ROTPK_HASH
|
||||
/*
|
||||
* The rotpk header is dependent only on the algorithm used to
|
||||
* generate the hash.
|
||||
* ASN1_HASH_ALG is the last byte used to encode the OID for
|
||||
* the hash algorithm into the header,
|
||||
* this byte distinguishes between SHA256, SHA384 and SHA512.
|
||||
*/
|
||||
.equ HASH_ASN1_LEN, ARM_ROTPK_HASH_LEN
|
||||
#if ARM_ROTPK_HASH_LEN == 48
|
||||
.equ ASN1_HASH_ALG, 0x02
|
||||
.equ TOTAL_ASN1_LEN, 0x41
|
||||
#elif ARM_ROTPK_HASH_LEN == 64
|
||||
.equ ASN1_HASH_ALG, 0x03
|
||||
.equ TOTAL_ASN1_LEN, 0x51
|
||||
#elif ARM_ROTPK_HASH_LEN == 32
|
||||
.equ ASN1_HASH_ALG, 0x01
|
||||
.equ TOTAL_ASN1_LEN, 0x31
|
||||
#else
|
||||
.error "Invalid ROTPK hash length."
|
||||
#endif
|
||||
|
||||
arm_rotpk_hash_der_header:
|
||||
.byte 0x30, TOTAL_ASN1_LEN, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48
|
||||
.byte 0x01, 0x65, 0x03, 0x04, 0x02, ASN1_HASH_ALG, 0x05, 0x00, 0x04, HASH_ASN1_LEN
|
||||
arm_rotpk_hash_der_header_len:
|
||||
|
||||
#ifdef ARM_ROTPK
|
||||
.incbin ARM_ROTPK
|
||||
arm_rotpk_hash_end:
|
||||
#endif
|
||||
|
||||
.if ARM_ROTPK_HEADER_LEN != arm_rotpk_header_len - arm_rotpk_header
|
||||
.error "Invalid ROTPK header length."
|
||||
.endif
|
||||
.if ARM_ROTPK_HASH_DER_HEADER_LEN != arm_rotpk_hash_der_header_len - arm_rotpk_hash_der_header
|
||||
.error "Invalid ROTPK header length."
|
||||
.endif
|
||||
|
||||
#else
|
||||
/*
|
||||
* The rotpk is an unhashed public key in DER format.
|
||||
* We do not need a header in this case.
|
||||
*/
|
||||
.global arm_rotpk_key
|
||||
.section .rodata.arm_rotpk_key, "a"
|
||||
|
||||
arm_rotpk_key:
|
||||
#ifdef ARM_ROTPK
|
||||
.global arm_rotpk_key_end
|
||||
.incbin ARM_ROTPK
|
||||
arm_rotpk_key_end:
|
||||
#else
|
||||
.error "ROTPK not found."
|
||||
#endif
|
||||
#endif
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
.global arm_rotpk_key
|
||||
.global arm_rotpk_key_end
|
||||
|
||||
.section .rodata.arm_rotpk_key, "a"
|
||||
|
||||
/* Derived from arm_rotprivk_ecdsa.pem private key file. */
|
||||
arm_rotpk_key:
|
||||
.byte 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D
|
||||
.byte 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01
|
||||
.byte 0x07, 0x03, 0x42, 0x00, 0x04, 0x9B, 0xE6, 0x48, 0xBD, 0x34, 0x38
|
||||
.byte 0xE1, 0xA2, 0xA4, 0xF3, 0x70, 0xE1, 0x54, 0xBB, 0x2F, 0xB0, 0x5A
|
||||
.byte 0x4A, 0x0C, 0xFF, 0xC2, 0x87, 0xDB, 0xC0, 0xFB, 0x81, 0xE9, 0xF9
|
||||
.byte 0xF9, 0x95, 0x7D, 0x7E, 0xA0, 0x0C, 0x7F, 0x0A, 0xD4, 0xE0, 0x62
|
||||
.byte 0x4A, 0x94, 0x5F, 0xEC, 0x52, 0x7D, 0x44, 0x63, 0xC8, 0x9F, 0x61
|
||||
.byte 0xFA, 0xC6, 0xCB, 0x7E, 0x6B, 0x53, 0xAD, 0x2C, 0xC5, 0x94, 0x0D
|
||||
.byte 0x1A, 0x86, 0x91
|
||||
arm_rotpk_key_end:
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
.global arm_rotpk_key
|
||||
.global arm_rotpk_key_end
|
||||
|
||||
.section .rodata.arm_rotpk_key, "a"
|
||||
|
||||
/* Derived from arm_rotprivk_ecdsa_secp384r1.pem private key file. */
|
||||
arm_rotpk_key:
|
||||
.byte 0x30, 0x76, 0x30, 0x10, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D
|
||||
.byte 0x02, 0x01, 0x06, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22, 0x03, 0x62
|
||||
.byte 0x00, 0x04, 0xB8, 0xB0, 0xC7, 0xC4, 0x57, 0x19, 0xB7, 0x5A, 0x06
|
||||
.byte 0x36, 0xC5, 0xD8, 0x3C, 0x4E, 0xC3, 0xB5, 0xE1, 0x15, 0x60, 0x0E
|
||||
.byte 0x63, 0xD8, 0xAF, 0x22, 0x2C, 0x6D, 0x79, 0x29, 0xDF, 0x46, 0xA9
|
||||
.byte 0x30, 0x12, 0x16, 0x2D, 0x4F, 0x0F, 0x96, 0x6B, 0x1F, 0x87, 0x06
|
||||
.byte 0xDB, 0x8F, 0xD7, 0x08, 0x46, 0xE4, 0x4C, 0x22, 0xF3, 0xDE, 0xCE
|
||||
.byte 0x0F, 0x72, 0x27, 0x00, 0xAA, 0xD8, 0xC3, 0x79, 0x80, 0x5E, 0xF1
|
||||
.byte 0x35, 0x1B, 0x33, 0xB6, 0x31, 0xC4, 0x59, 0xD4, 0xE9, 0x65, 0x91
|
||||
.byte 0x22, 0x58, 0x2F, 0x87, 0xF1, 0x6C, 0x27, 0xBE, 0x99, 0x6F, 0x5F
|
||||
.byte 0x6C, 0x14, 0xC5, 0x37, 0x0C, 0x73, 0xB4, 0xE4, 0x8A, 0x63
|
||||
arm_rotpk_key_end:
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2023, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
.global arm_rotpk_key
|
||||
.global arm_rotpk_key_end
|
||||
|
||||
.section .rodata.arm_rotpk_key, "a"
|
||||
|
||||
arm_rotpk_key:
|
||||
.byte 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48
|
||||
.byte 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01
|
||||
.byte 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00
|
||||
.byte 0xCB, 0x2C, 0x60, 0xD5, 0x8D, 0x63, 0xD4, 0x07, 0x79, 0x7E, 0xC7
|
||||
.byte 0x16, 0x96, 0xBD, 0x4D, 0x24, 0x4E, 0xAC, 0x86, 0xE6, 0xB7, 0x71
|
||||
.byte 0xE3, 0xC5, 0x54, 0x0B, 0xE7, 0x14, 0x1C, 0xBD, 0x29, 0x1A, 0xC1
|
||||
.byte 0x3F, 0x7A, 0xB6, 0x02, 0xAA, 0xAB, 0x36, 0xC4, 0xD9, 0x36, 0x69
|
||||
.byte 0x6C, 0xE2, 0x65, 0xC3, 0x9B, 0xB1, 0xBF, 0x3D, 0xA8, 0x56, 0x26
|
||||
.byte 0xCB, 0xFD, 0x04, 0x01, 0xBA, 0xAC, 0x3E, 0x54, 0x32, 0xCA, 0x79
|
||||
.byte 0x5E, 0xBB, 0xB2, 0x05, 0xEA, 0x06, 0x58, 0xF2, 0x74, 0xBA, 0xE1
|
||||
.byte 0xF4, 0x87, 0xC0, 0x19, 0x0A, 0x1F, 0x66, 0x07, 0x77, 0x84, 0x83
|
||||
.byte 0xA1, 0x1C, 0xEF, 0xFF, 0x28, 0x59, 0xE7, 0xC3, 0x68, 0x7D, 0x26
|
||||
.byte 0x20, 0x43, 0xEB, 0x56, 0x63, 0xF3, 0x39, 0x31, 0xD8, 0x2B, 0x51
|
||||
.byte 0xA9, 0xBC, 0x4F, 0xD0, 0xF6, 0xDE, 0x95, 0xDC, 0x5F, 0x5B, 0xC1
|
||||
.byte 0xED, 0x90, 0x6F, 0xEC, 0x28, 0x91, 0x7E, 0x17, 0xED, 0x78, 0x90
|
||||
.byte 0xF4, 0x60, 0xA7, 0xC4, 0xC7, 0x4F, 0x50, 0xED, 0x5D, 0x13, 0x3A
|
||||
.byte 0x21, 0x2B, 0x70, 0xC5, 0x61, 0x7B, 0x08, 0x21, 0x65, 0x3A, 0xCD
|
||||
.byte 0x82, 0x56, 0x8C, 0x7A, 0x47, 0xAC, 0x89, 0xE8, 0xA5, 0x48, 0x48
|
||||
.byte 0x31, 0xD9, 0x1D, 0x46, 0xE5, 0x85, 0x86, 0x98, 0xA0, 0xE5, 0xC0
|
||||
.byte 0xA6, 0x6A, 0xBD, 0x07, 0xE4, 0x92, 0x57, 0x61, 0x07, 0x8F, 0x7D
|
||||
.byte 0x5A, 0x4D, 0xCA, 0xAE, 0x36, 0xB9, 0x56, 0x04, 0x10, 0xF2, 0x6C
|
||||
.byte 0xBE, 0xF6, 0x3B, 0x6C, 0x80, 0x3E, 0xBE, 0x0E, 0xA3, 0x4D, 0xC7
|
||||
.byte 0xD4, 0x7E, 0xA7, 0x49, 0xD4, 0xF2, 0xD2, 0xBC, 0xCF, 0x30, 0xA8
|
||||
.byte 0xE7, 0x74, 0x8F, 0x64, 0xDF, 0xBC, 0x5C, 0x47, 0x68, 0xCC, 0x40
|
||||
.byte 0x4C, 0xF8, 0x83, 0xCC, 0xCB, 0x40, 0x35, 0x04, 0x60, 0xCA, 0xB3
|
||||
.byte 0xA4, 0x17, 0x9F, 0x03, 0xCA, 0x1D, 0x5A, 0xFA, 0xD1, 0xAF, 0x21
|
||||
.byte 0x57, 0x10, 0xD3, 0x02, 0x03, 0x01, 0x00, 0x01
|
||||
arm_rotpk_key_end:
|
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
.@<40>n<EFBFBD><12><>1q =<0B><><EFBFBD>iJ<69>닠<EFBFBD> <20>Nl
|
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
Аѓ<EFBFBD> <12>и:7zrGь2sщ<73>2тIYі^<5E>JJFи"<22>к
|
40
plat/arm/board/common/rotpk/arm_rotprivk_rsa_3k.pem
Normal file
40
plat/arm/board/common/rotpk/arm_rotprivk_rsa_3k.pem
Normal file
|
@ -0,0 +1,40 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIIG/QIBADANBgkqhkiG9w0BAQEFAASCBucwggbjAgEAAoIBgQCi82DxdQ1Z88RT
|
||||
DBoK8nBZ3SF4YSnOSV3KXODZHtEJq/D1HihLpCITsB1GkR17qGX5XzjcIvrS7tGC
|
||||
1Y/ELC+wL1DNoNlLsgwfZdQ3+MGGlkymnK37/b5Q1bvkuthAHg415skvdzX+6tpM
|
||||
y3bbGn55oW+hjynGo9lhixZiOA22sKhHFM6TBgpyNyXt/EpxGHcL4HM59LSWgB3I
|
||||
UX6l0Fb5MLb3XRzOkPcf6tQwnupDRS8rcRKHlkq8m0kIZ619zDkj4DZVW7VSU3hj
|
||||
vnzMMTEqbJ9uBnGFLdTqw2O822jOtKJ8pDqcN1xEe60a0CN0abN5uNzr9WPgLw5d
|
||||
ZjWqTx2kFVbjIr5nAiY6KTUoas/radidv/r5BY4wXvbi/SVNHip4oLoKCgu6T+Un
|
||||
pIc5DG0osXKO/xtT5gsQUZ/AXEztCsEeuwkueEZ8c1AG+ceoOul/zH4y0YrFGzxV
|
||||
apwwRuXZQtjU0lXpFlD1Yy83QzkrxWgEfE5mUm402TRF92oLsY8CAwEAAQKCAYA5
|
||||
QBwLyW3G8FPGP8a4mOQrVntncW/AN9uZeRdQgTi9VqkiXZWXudN1Klemzt5Wb1xg
|
||||
iHmQMkQArwJyHrlTmZippH4VuNEPfL8wmtS8U4wezpigowSnt8dRXD6XBqRqpoSk
|
||||
oHCH2jDg3r+S4ptgMIdGEZeIYiWx0ihSUo0rNflvedKtopxPYHx0E3cijZTT9l4B
|
||||
ELs7HgQCqoGMO0GtXSzpgRmPgCnaU2lXz+f8KyEwQFLpxuDVPVMFv+Mhblewjnrn
|
||||
IpDUAocRPI1n0cOrObHHnnp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wdn+wy72Ag5n
|
||||
snMgOVYWNXBweQKBwQCcsBEzAIzSNd8x8V6i/D7TLkreG1cwRf33FeaO7ntElxei
|
||||
7Ndvfj0qAJ2JQSo0yhpGHsP1a1hX2WxhTCsRdz+wFzYitTnTrmnwVSqSN1lnOyzi
|
||||
yJKzgXhZA7xg5NVJeCCqKgL6vJkdw+L4F8+MV0GM8Dt25ieI2WTHBm9S0SA0lZa0
|
||||
8Ol99uQ8Q5rtDZCYQm6x1c7z0Z4gyi2GZY9EihzVymQ7GxRUmpBhhOhuLEBtGKB8
|
||||
MCdROw7EAN9wcKdoRfECgcB5zqNzKu2kbpa0oeHLLDpcOK1w9e7khN3/j3dTrpRw
|
||||
em8+HoCF54PoyfkPWANTHfg+Bs2gktgvUsxfLy0/DDBIRUBQXo6AyztfB34D5/3L
|
||||
QIPyPjSgQKxOCnUCcDAkvVRY+6J7W6J/pW385ZhzikCUrRSKrbc3UYEu3UZwypSC
|
||||
mJGKLUzhDhPYvIginpIugE9Pv3WXfKas3HRrk7UdqjIMpJxIRF5CULsEaZua6tje
|
||||
1oA5miNwoiXHcxPoo2qMtz8=
|
||||
-----END PRIVATE KEY-----
|
52
plat/arm/board/common/rotpk/arm_rotprivk_rsa_4k.pem
Normal file
52
plat/arm/board/common/rotpk/arm_rotprivk_rsa_4k.pem
Normal file
|
@ -0,0 +1,52 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDGeG6dmMX7DHdx
|
||||
LJ5vi3HpqSLVfyiGzYmjN14bcOORf1efCXy+0KfZ4M/N1rw/fVzIH6LP6iKm8rrH
|
||||
HQleKMb2rklbu8Azchr9fAJCbbbhENjhbp+lnh5W+bMWlhz4ePoSft/VNDssK/30
|
||||
tedSX7AEqs8nXOcqIjcOTnkB1UocNSAd98WP+m7oeqcwrJZGFj2HKHPkZiveX4c6
|
||||
5pN7xsdeuJ00FbOau7R3tX+0hInbTCx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1Eb2Zhyvp2vuC+bgQ2EL4h8skfFLej63DiQUsdLJcEECA+Uc5dgtll6Ju/OPeWUb
|
||||
unvgo6JEyqN6Es7CmqtxG8FjfW/Zvxe9cscDwpKItzNpNacpEvUFOL6SN4LUACyI
|
||||
AaqDEKUCXctv+JN5nNmGZF8nOTgkpvEwmQsiUBjk+PYMP4Z0Jj16Z6jMtpxMnSBG
|
||||
FstgUHR/JjhyogO+s+enPY0QAn5jD/1msgelILUCggEBAMV5emeBvFBxcfUq2c5C
|
||||
kuIWMGdQR9FzemVfx9bYFDGugt79kc359s8qOwzOEQD0I9X1pgV3ntuFO4ep0zUU
|
||||
QnyFp3b9KLChE87O0WldKNxFRRV8Vqz8k5OlC4Cz07IWuLl71TS3pl6h4lyYi3F3
|
||||
WhT+zI8uhdCW6VZiFVcpLtCPDeqMZlp1n7m8MtB9MuxSoSgzZm3hMcg+CucecRCv
|
||||
IMfXSQ8CHwt4H9vhTq032Z5QfxOs1CUP5KY8Rx6UZoJE7gR7xl8eNWpw0g1NdAPf
|
||||
fi0Ms0K5No7Aurl2SAeiEqCnaK2kN8plel4QmVwC4liU91NCJ8BC6eA+wGdkOtJO
|
||||
CdkCggEAG6v3cc6mw/kA3l+z21NzAXFUnYy7Q9xxl6noNBdNtT+vBQJ2jbEISSqi
|
||||
RM48KKtky2pgFWB980XUS1ZI8SiZ9GveM9bCSgpN+zupSdKNBaxT7+AKO/MPKMeO
|
||||
hukkWqtNCwFs6opByhLMRMC2UAKRSvTZBlrCUyIBY2EB6IzsqqQGdoAHOw2fDWay
|
||||
7C79JxtEl/XH10Et7zeWEI2uz6JK4TmSd2ZZu6m/X1UU6BHZJTHpItZlTnp14QYc
|
||||
hpHcRHU5d5i+ARQ+kUUynfEyAabY6sBIn3lxXqa9FplR0vqbtxyZPtQh1ZP11drD
|
||||
ihQEUR+haaYi8LFFpxe3Lja8D5eclg==
|
||||
-----END PRIVATE KEY-----
|
|
@ -6,9 +6,12 @@ root-of-trust key used in the CCA chain of trust.
|
|||
|
||||
openssl genrsa 2048 > arm_swd_rotprivk_rsa.pem
|
||||
|
||||
* swd_rotpk_rsa_sha256.bin is the SHA-256 hash of the DER-encoded public key
|
||||
associated with the above private key. It has been generated using the openssl
|
||||
command line tool:
|
||||
* arm_swd_rotprivk_ecdsa.pem is a P-256 ECSA private key in PEM format. It has been
|
||||
generated using the openssl command line tool:
|
||||
|
||||
openssl rsa -in arm_swd_rotprivk_rsa.pem -pubout -outform DER | \
|
||||
openssl dgst -sha256 -binary > arm_swd_rotpk_rsa_sha256.bin
|
||||
openssl ecparam -name prime256v1 -genkey -outform PEM -noout -out arm_swd_rotprivk_ecdsa.pem
|
||||
|
||||
* arm_swd_rotprivk_ecdsa_secp384r1.pem is a P-384 ECSA private key in PEM format. It has been
|
||||
generated using the openssl command line tool:
|
||||
|
||||
openssl ecparam -name secp384r1 -genkey -outform PEM -noout -out arm_swd_rotprivk_ecdsa_secp384r1.pem
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2022-2024, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -9,10 +9,31 @@
|
|||
|
||||
.section .rodata.arm_swd_rotpk_hash, "a"
|
||||
|
||||
/*
|
||||
* The swd_roptpk header is dependent only on the algorithm used to
|
||||
* generate the hash.
|
||||
* ASN1_HASH_ALG is the last byte used to encode the OID for
|
||||
* the hash algorithm into the header,
|
||||
* this byte distinguishes between SHA256, SHA384 and SHA512.
|
||||
*/
|
||||
.equ HASH_ASN1_LEN, ARM_ROTPK_HASH_LEN
|
||||
#if ARM_ROTPK_HASH_LEN == 48
|
||||
.equ ASN1_HASH_ALG, 0x02
|
||||
.equ TOTAL_ASN1_LEN, 0x41
|
||||
#elif ARM_ROTPK_HASH_LEN == 64
|
||||
.equ ASN1_HASH_ALG, 0x03
|
||||
.equ TOTAL_ASN1_LEN, 0x51
|
||||
#elif ARM_ROTPK_HASH_LEN == 32
|
||||
.equ ASN1_HASH_ALG, 0x01
|
||||
.equ TOTAL_ASN1_LEN, 0x31
|
||||
#else
|
||||
.error "Invalid SWD_ROTPK hash length."
|
||||
#endif
|
||||
|
||||
arm_swd_rotpk_hash:
|
||||
/* DER header. */
|
||||
.byte 0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48
|
||||
.byte 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20
|
||||
.byte 0x30, TOTAL_ASN1_LEN, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48
|
||||
.byte 0x01, 0x65, 0x03, 0x04, 0x02, ASN1_HASH_ALG, 0x05, 0x00, 0x04, HASH_ASN1_LEN
|
||||
/* Key hash. */
|
||||
.incbin ARM_SWD_ROTPK_HASH
|
||||
.incbin ARM_SWD_ROTPK
|
||||
arm_swd_rotpk_hash_end:
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
0ľâĂ’ćśČË“(ě¨0ŠwIÓ<49>Őéăˇgk
|
|
@ -0,0 +1,5 @@
|
|||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIFmIjAPUmyqDfKXT+kKRMvyFzQfaZekczIzSPfLeQUGyoAoGCCqGSM49
|
||||
AwEHoUQDQgAEtZB8OrBV7hPl+lBrc5ypKetwGsUi+SpTK8OoMw0GwA17rGDYdBTV
|
||||
JK2ttZNtCsGzlDrXeHu6bcTmrleMdW9NdQ==
|
||||
-----END EC PRIVATE KEY-----
|
|
@ -0,0 +1,6 @@
|
|||
-----BEGIN EC PRIVATE KEY-----
|
||||
MIGkAgEBBDC348NhWsLI30vzJnWofKae6t3S6YIb5rdLEJSUyI9XwKj8FyJO8N3G
|
||||
DNgvVBwk4NigBwYFK4EEACKhZANiAARodLWP/EGH7/SrImvwDJr1zACOrh8acVH/
|
||||
eymfvZW2af4DPRMPyUC5Ftzv6NwGz6yPzBbAg9+qDgLgO7cqwXOwVON+hAU+ECEZ
|
||||
3AIQ7zLDfnXcfNz8dv1kwkwhfDJeQCs=
|
||||
-----END EC PRIVATE KEY-----
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2020, ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2019-2024, ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -14,9 +14,9 @@
|
|||
|
||||
#if (ARM_ROTPK_LOCATION_ID == ARM_ROTPK_REGS_ID)
|
||||
|
||||
static unsigned char rotpk_hash_der[ARM_ROTPK_HEADER_LEN + ARM_ROTPK_HASH_LEN];
|
||||
static unsigned char rotpk_hash_der[ARM_ROTPK_HASH_DER_HEADER_LEN + ARM_ROTPK_HASH_LEN];
|
||||
|
||||
extern unsigned char arm_rotpk_header[];
|
||||
extern unsigned char arm_rotpk_hash_der_header[];
|
||||
|
||||
/*
|
||||
* Return the ROTPK hash stored in the registers of Juno board.
|
||||
|
@ -33,8 +33,8 @@ static int juno_get_rotpk_info_regs(void **key_ptr, unsigned int *key_len,
|
|||
assert(flags != NULL);
|
||||
|
||||
/* Copy the DER header */
|
||||
memcpy(rotpk_hash_der, arm_rotpk_header, ARM_ROTPK_HEADER_LEN);
|
||||
dst = (uint8_t *)&rotpk_hash_der[ARM_ROTPK_HEADER_LEN];
|
||||
memcpy(rotpk_hash_der, arm_rotpk_hash_der_header, ARM_ROTPK_HASH_DER_HEADER_LEN);
|
||||
dst = (uint8_t *)&rotpk_hash_der[ARM_ROTPK_HASH_DER_HEADER_LEN];
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -382,12 +382,14 @@ endif
|
|||
ifneq ($(filter 1,${MEASURED_BOOT} ${TRUSTED_BOARD_BOOT} ${DRTM_SUPPORT}),)
|
||||
PLAT_INCLUDES += -Iplat/arm/common \
|
||||
-Iinclude/drivers/auth/mbedtls
|
||||
# Specify mbed TLS configuration file
|
||||
ifeq (${PSA_CRYPTO},1)
|
||||
MBEDTLS_CONFIG_FILE ?= "<plat_arm_psa_mbedtls_config.h>"
|
||||
ifeq (${HASH_ALG}, sha512)
|
||||
ARM_ROTPK_HASH_LEN := 64
|
||||
else ifeq (${HASH_ALG}, sha384)
|
||||
ARM_ROTPK_HASH_LEN := 48
|
||||
else
|
||||
MBEDTLS_CONFIG_FILE ?= "<plat_arm_mbedtls_config.h>"
|
||||
ARM_ROTPK_HASH_LEN := 32
|
||||
endif
|
||||
$(eval $(call add_define,ARM_ROTPK_HASH_LEN))
|
||||
endif
|
||||
|
||||
ifneq (${TRUSTED_BOARD_BOOT},0)
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Arm Ltd. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef PLAT_ARM_MBEDTLS_CONFIG_H
|
||||
#define PLAT_ARM_MBEDTLS_CONFIG_H
|
||||
|
||||
#include <default_mbedtls_config.h>
|
||||
|
||||
/**
|
||||
* On Arm platforms, the ROTPK is always hashed using the SHA-256
|
||||
* algorithm.
|
||||
* TODO: Update to hash the ROTPK with the selected HASH_ALG to avoid
|
||||
* the need for explicitly enabling the SHA-256 configuration in mbedTLS.
|
||||
*/
|
||||
#define MBEDTLS_SHA256_C
|
||||
|
||||
/*
|
||||
* Use an implementation of SHA-256 with a smaller memory footprint
|
||||
* but reduced speed.
|
||||
*/
|
||||
#define MBEDTLS_SHA256_SMALLER
|
||||
|
||||
#endif /* PLAT_ARM_MBEDTLS_CONFIG_H */
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Arm Ltd. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef PLAT_ARM_PSA_MBEDTLS_CONFIG_H
|
||||
#define PLAT_ARM_PSA_MBEDTLS_CONFIG_H
|
||||
|
||||
#include "plat_arm_mbedtls_config.h"
|
||||
|
||||
#define MBEDTLS_PSA_CRYPTO_C
|
||||
#define MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
|
||||
|
||||
/*
|
||||
* Using PSA crypto API requires an RNG right now. If we don't define the macro
|
||||
* below then we get build errors.
|
||||
*
|
||||
* This is a functionality gap in mbedTLS. The technical limitation is that
|
||||
* psa_crypto_init() is all-or-nothing, and fixing that would require separate
|
||||
* initialization of the keystore, the RNG, etc.
|
||||
*
|
||||
* By defining MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG, we pretend using an external
|
||||
* RNG. As a result, the PSA crypto init code does nothing when it comes to
|
||||
* initializing the RNG, as we are supposed to take care of that ourselves.
|
||||
*/
|
||||
#define MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
|
||||
|
||||
/*
|
||||
* Override heap size for PSA Crypto when RSA key size > 2048.
|
||||
*/
|
||||
#if TF_MBEDTLS_USE_RSA && TF_MBEDTLS_KEY_SIZE > 2048
|
||||
#undef TF_MBEDTLS_HEAP_SIZE
|
||||
#define TF_MBEDTLS_HEAP_SIZE U(12 * 1024)
|
||||
#endif
|
||||
|
||||
#endif /* PLAT_ARM_PSA_MBEDTLS_CONFIG_H */
|
Loading…
Add table
Reference in a new issue