mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
Merge changes from topic "full_dev_rsa_key" into integration
* changes: docs(arm): add ARM_ROTPK_LOCATION variant full key feat(arm): add ARM_ROTPK_LOCATION variant full key
This commit is contained in:
commit
abd6d7ea60
7 changed files with 76 additions and 21 deletions
|
@ -42,7 +42,7 @@ images with support for these features:
|
|||
are loaded from that path instead of the default OS path. Export this
|
||||
variable if necessary.
|
||||
|
||||
In the case of Arm platforms, the location of the ROTPK hash must also be
|
||||
In the case of Arm platforms, the location of the ROTPK must also be
|
||||
specified at build time. The following locations are currently supported (see
|
||||
``ARM_ROTPK_LOCATION`` build option):
|
||||
|
||||
|
@ -62,6 +62,9 @@ images with support for these features:
|
|||
``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_full_dev_rsa_key``: use the key located in
|
||||
``plat/arm/board/common/rotpk/arm_full_dev_rsa_rotpk.S``.
|
||||
|
||||
Example of command line using RSA development keys:
|
||||
|
||||
.. code:: shell
|
||||
|
|
|
@ -49,7 +49,7 @@ Arm Platform Build Options
|
|||
field of power-state parameter.
|
||||
|
||||
- ``ARM_ROTPK_LOCATION``: used when ``TRUSTED_BOARD_BOOT=1``. It specifies the
|
||||
location of the ROTPK hash returned by the function ``plat_get_rotpk_info()``
|
||||
location of the ROTPK returned by the function ``plat_get_rotpk_info()``
|
||||
for Arm platforms. Depending on the selected option, the proper private key
|
||||
must be specified using the ``ROT_KEY`` option when building the Trusted
|
||||
Firmware. This private key will be used by the certificate generation tool
|
||||
|
@ -68,12 +68,16 @@ Arm Platform Build Options
|
|||
``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_*``. 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.
|
||||
- ``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.
|
||||
|
||||
- ``ARM_TSP_RAM_LOCATION``: location of the TSP binary. Options:
|
||||
|
||||
|
|
|
@ -20,10 +20,12 @@
|
|||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Root of trust key hash lengths
|
||||
* Root of trust key lengths
|
||||
*/
|
||||
#define ARM_ROTPK_HEADER_LEN 19
|
||||
#define ARM_ROTPK_HASH_LEN 32
|
||||
/* ARM_ROTPK_KEY_LEN includes DER header + raw key material */
|
||||
#define ARM_ROTPK_KEY_LEN 294
|
||||
|
||||
/* Special value used to verify platform parameters from BL2 to BL31 */
|
||||
#define ARM_BL31_PLAT_PARAM_VAL ULL(0x0f1e2d3c4b5a6978)
|
||||
|
|
|
@ -159,7 +159,7 @@ void arm_setup_romlib(void);
|
|||
#define ARM_ROTPK_REGS_ID 1
|
||||
#define ARM_ROTPK_DEVEL_RSA_ID 2
|
||||
#define ARM_ROTPK_DEVEL_ECDSA_ID 3
|
||||
|
||||
#define ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID 4
|
||||
|
||||
/* IO storage utility functions */
|
||||
int arm_io_setup(void);
|
||||
|
|
|
@ -47,7 +47,8 @@ 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_hash_end[];
|
||||
extern unsigned char arm_rotpk_header[], arm_rotpk_key[], arm_rotpk_hash_end[],
|
||||
arm_rotpk_key_end[];
|
||||
|
||||
#if (ARM_ROTPK_LOCATION_ID == ARM_ROTPK_REGS_ID) || ARM_CRYPTOCELL_INTEG
|
||||
static unsigned char rotpk_hash_der[ARM_ROTPK_HEADER_LEN + ARM_ROTPK_HASH_LEN];
|
||||
|
@ -93,16 +94,20 @@ int arm_get_rotpk_info_regs(void **key_ptr, unsigned int *key_len,
|
|||
#endif
|
||||
|
||||
#if (ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_RSA_ID) || \
|
||||
(ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_ECDSA_ID)
|
||||
/*
|
||||
* Return development ROTPK hash generated from ROT_KEY.
|
||||
*/
|
||||
(ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_ECDSA_ID) || \
|
||||
(ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID)
|
||||
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;
|
||||
*flags = ROTPK_IS_HASH;
|
||||
if (ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID) {
|
||||
*key_ptr = arm_rotpk_key;
|
||||
*key_len = arm_rotpk_key_end - arm_rotpk_key;
|
||||
*flags = 0;
|
||||
} else {
|
||||
*key_ptr = arm_rotpk_header;
|
||||
*key_len = arm_rotpk_hash_end - arm_rotpk_header;
|
||||
*flags = ROTPK_IS_HASH;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -130,7 +135,7 @@ int arm_get_rotpk_info_cc(void **key_ptr, unsigned int *key_len,
|
|||
#endif
|
||||
|
||||
/*
|
||||
* Wrapper function for most Arm platforms to get ROTPK hash.
|
||||
* Wrapper function for most Arm platforms to get ROTPK info.
|
||||
*/
|
||||
static int get_rotpk_info(void **key_ptr, unsigned int *key_len,
|
||||
unsigned int *flags)
|
||||
|
@ -140,7 +145,8 @@ static int get_rotpk_info(void **key_ptr, unsigned int *key_len,
|
|||
#else
|
||||
|
||||
#if (ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_RSA_ID) || \
|
||||
(ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_ECDSA_ID)
|
||||
(ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_ECDSA_ID) || \
|
||||
(ARM_ROTPK_LOCATION_ID == ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID)
|
||||
return arm_get_rotpk_info_dev(key_ptr, key_len, flags);
|
||||
#elif (ARM_ROTPK_LOCATION_ID == ARM_ROTPK_REGS_ID)
|
||||
return arm_get_rotpk_info_regs(key_ptr, key_len, flags);
|
||||
|
|
|
@ -20,6 +20,7 @@ else 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
|
||||
ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S
|
||||
$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
|
||||
$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
|
||||
$(warning Development keys support for FVP is deprecated. Use `regs` \
|
||||
|
@ -28,10 +29,17 @@ 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
|
||||
ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S
|
||||
$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
|
||||
$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
|
||||
$(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
|
||||
$(warning Development keys support for FVP is deprecated. Use `regs` \
|
||||
option instead)
|
||||
else
|
||||
$(error "Unsupported ARM_ROTPK_LOCATION value")
|
||||
endif
|
||||
|
@ -67,9 +75,9 @@ TFW_NVCTR_VAL ?= 0
|
|||
NTFW_NVCTR_VAL ?= 0
|
||||
endif
|
||||
BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
|
||||
plat/arm/board/common/rotpk/arm_dev_rotpk.S
|
||||
${ARM_ROTPK_S}
|
||||
BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
|
||||
plat/arm/board/common/rotpk/arm_dev_rotpk.S
|
||||
${ARM_ROTPK_S}
|
||||
|
||||
# Allows platform code to provide implementation variants depending on the
|
||||
# selected chain of trust.
|
||||
|
|
32
plat/arm/board/common/rotpk/arm_full_dev_rsa_rotpk.S
Normal file
32
plat/arm/board/common/rotpk/arm_full_dev_rsa_rotpk.S
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/* corstone1000 platform provides custom values for the macros defined in
|
||||
* arm_def.h , so only platform_def.h needs to be included
|
||||
*/
|
||||
#if !defined(TARGET_PLATFORM_FVP) && !defined(TARGET_PLATFORM_FPGA)
|
||||
#include "plat/arm/common/arm_def.h"
|
||||
#else
|
||||
#include <platform_def.h>
|
||||
#endif
|
||||
|
||||
.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, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01
|
||||
.byte 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01
|
||||
.byte 0x00, 0xCB, 0x2C, 0x60, 0xD5, 0x8D, 0x63, 0xD4, 0x07, 0x79, 0x7E, 0xC7, 0x16, 0x96, 0xBD, 0x4D, 0x24, 0x4E, 0xAC, 0x86, 0xE6, 0xB7, 0x71, 0xE3, 0xC5, 0x54, 0x0B, 0xE7, 0x14, 0x1C, 0xBD, 0x29, 0x1A, 0xC1, 0x3F, 0x7A, 0xB6, 0x02, 0xAA, 0xAB, 0x36, 0xC4, 0xD9, 0x36, 0x69, 0x6C, 0xE2, 0x65, 0xC3, 0x9B, 0xB1, 0xBF, 0x3D, 0xA8, 0x56, 0x26, 0xCB, 0xFD, 0x04, 0x01, 0xBA, 0xAC, 0x3E, 0x54, 0x32, 0xCA, 0x79, 0x5E, 0xBB, 0xB2, 0x05, 0xEA, 0x06, 0x58, 0xF2, 0x74, 0xBA,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, 0x01, 0x00, 0x01
|
||||
|
||||
arm_rotpk_key_end:
|
||||
|
||||
.if ARM_ROTPK_KEY_LEN != arm_rotpk_key_end - arm_rotpk_key
|
||||
.error "Invalid ROTPK length."
|
||||
.endif
|
||||
|
Loading…
Add table
Reference in a new issue