refactor(arm): rename ARM_ROTPK_HEADER_LEN

This variable had a misleading name, as it is the length
of the header only when the ROTPK is a hash.
Also rename arm_rotpk_header to match the new pattern.

Change-Id: I36c29998eebf50c356a6ca959ec9223c8837b540
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
Ryan Everett 2024-11-13 17:37:03 +00:00
parent 4639f8909b
commit bd9b01c683
5 changed files with 20 additions and 20 deletions

View file

@ -13,9 +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
#ifndef ARM_ROTPK_HASH_DER_HEADER_LEN
#define ARM_ROTPK_HASH_DER_HEADER_LEN 19
#endif
#endif /* ROTPK_DEF_H */

View file

@ -30,9 +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_DER_HEADER_LEN 19
/* Special value used to verify platform parameters from BL2 to BL31 */
#define ARM_BL31_PLAT_PARAM_VAL ULL(0x0f1e2d3c4b5a6978)

View file

@ -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;
}

View file

@ -7,7 +7,7 @@
#include <plat/arm/board/common/rotpk/rotpk_def.h>
#if ARM_ROTPK_IS_HASH == 1
.global arm_rotpk_header
.global arm_rotpk_hash_der_header
.global arm_rotpk_hash_end
.section .rodata.arm_rotpk_hash, "a"
@ -36,17 +36,17 @@
.error "Invalid ROTPK hash length."
#endif
arm_rotpk_header:
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_header_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
.if ARM_ROTPK_HASH_DER_HEADER_LEN != arm_rotpk_hash_der_header_len - arm_rotpk_hash_der_header
.error "Invalid ROTPK header length."
.endif

View file

@ -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];
/*