mirror of
https://github.com/CTCaer/switch-l4t-atf.git
synced 2024-11-24 02:09:46 +00:00
Merge changes from topic "sb/dualroot" into integration
* changes: Build system: Changes to drive cert_create for dualroot CoT cert_create: Define the dualroot CoT Introduce a new "dualroot" chain of trust
This commit is contained in:
commit
e31026776b
814
drivers/auth/dualroot/cot.c
Normal file
814
drivers/auth/dualroot/cot.c
Normal file
@ -0,0 +1,814 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
#include <drivers/auth/mbedtls/mbedtls_config.h>
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
#include <tools_share/dualroot_oid.h>
|
||||
|
||||
/*
|
||||
* TODO: Remove dependency on mbedTLS. The chain of trust should be agnostic of
|
||||
* the specific cryptographic library in use.
|
||||
*/
|
||||
/*
|
||||
* Maximum key and hash sizes (in DER format).
|
||||
*
|
||||
* Both RSA and ECDSA keys may be used at the same time. In this case, the key
|
||||
* buffers must be big enough to hold either. As RSA keys are bigger than ECDSA
|
||||
* ones for all key sizes we support, they impose the minimum size of these
|
||||
* buffers.
|
||||
*/
|
||||
#if TF_MBEDTLS_USE_RSA
|
||||
#if TF_MBEDTLS_KEY_SIZE == 1024
|
||||
#define PK_DER_LEN 162
|
||||
#elif TF_MBEDTLS_KEY_SIZE == 2048
|
||||
#define PK_DER_LEN 294
|
||||
#elif TF_MBEDTLS_KEY_SIZE == 3072
|
||||
#define PK_DER_LEN 422
|
||||
#elif TF_MBEDTLS_KEY_SIZE == 4096
|
||||
#define PK_DER_LEN 550
|
||||
#else
|
||||
#error "Invalid value for TF_MBEDTLS_KEY_SIZE"
|
||||
#endif
|
||||
#else /* Only using ECDSA keys. */
|
||||
#define PK_DER_LEN 91
|
||||
#endif
|
||||
|
||||
#if TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA256
|
||||
#define HASH_DER_LEN 51
|
||||
#elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA384
|
||||
#define HASH_DER_LEN 67
|
||||
#elif TF_MBEDTLS_HASH_ALG_ID == TF_MBEDTLS_SHA512
|
||||
#define HASH_DER_LEN 83
|
||||
#else
|
||||
#error "Invalid value for TF_MBEDTLS_HASH_ALG_ID"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate static buffers to store the authentication parameters extracted from
|
||||
* the certificates.
|
||||
*/
|
||||
static unsigned char tb_fw_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char tb_fw_config_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char hw_config_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char scp_fw_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char nt_world_bl_hash_buf[HASH_DER_LEN];
|
||||
|
||||
#ifdef IMAGE_BL2
|
||||
static unsigned char soc_fw_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char tos_fw_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char tos_fw_extra1_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char tos_fw_extra2_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char soc_fw_config_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char tos_fw_config_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char nt_fw_config_hash_buf[HASH_DER_LEN];
|
||||
|
||||
static unsigned char trusted_world_pk_buf[PK_DER_LEN];
|
||||
static unsigned char content_pk_buf[PK_DER_LEN];
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Parameter type descriptors.
|
||||
*/
|
||||
static auth_param_type_desc_t trusted_nv_ctr = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_NV_CTR, TRUSTED_FW_NVCOUNTER_OID);
|
||||
static auth_param_type_desc_t subject_pk = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_PUB_KEY, 0);
|
||||
static auth_param_type_desc_t sig = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_SIG, 0);
|
||||
static auth_param_type_desc_t sig_alg = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_SIG_ALG, 0);
|
||||
static auth_param_type_desc_t raw_data = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_RAW_DATA, 0);
|
||||
|
||||
static auth_param_type_desc_t tb_fw_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, TRUSTED_BOOT_FW_HASH_OID);
|
||||
static auth_param_type_desc_t tb_fw_config_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, TRUSTED_BOOT_FW_CONFIG_HASH_OID);
|
||||
static auth_param_type_desc_t hw_config_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, HW_CONFIG_HASH_OID);
|
||||
#ifdef IMAGE_BL1
|
||||
static auth_param_type_desc_t scp_bl2u_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, SCP_FWU_CFG_HASH_OID);
|
||||
static auth_param_type_desc_t bl2u_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, AP_FWU_CFG_HASH_OID);
|
||||
static auth_param_type_desc_t ns_bl2u_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, FWU_HASH_OID);
|
||||
#endif /* IMAGE_BL1 */
|
||||
|
||||
#ifdef IMAGE_BL2
|
||||
static auth_param_type_desc_t non_trusted_nv_ctr = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_NV_CTR, NON_TRUSTED_FW_NVCOUNTER_OID);
|
||||
|
||||
static auth_param_type_desc_t trusted_world_pk = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_PUB_KEY, TRUSTED_WORLD_PK_OID);
|
||||
static auth_param_type_desc_t scp_fw_content_pk = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_PUB_KEY, SCP_FW_CONTENT_CERT_PK_OID);
|
||||
static auth_param_type_desc_t soc_fw_content_pk = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_PUB_KEY, SOC_FW_CONTENT_CERT_PK_OID);
|
||||
static auth_param_type_desc_t tos_fw_content_pk = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_PUB_KEY, TRUSTED_OS_FW_CONTENT_CERT_PK_OID);
|
||||
static auth_param_type_desc_t prot_pk = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_PUB_KEY, PROT_PK_OID);
|
||||
|
||||
static auth_param_type_desc_t scp_fw_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, SCP_FW_HASH_OID);
|
||||
static auth_param_type_desc_t soc_fw_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, SOC_AP_FW_HASH_OID);
|
||||
static auth_param_type_desc_t soc_fw_config_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, SOC_FW_CONFIG_HASH_OID);
|
||||
static auth_param_type_desc_t tos_fw_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, TRUSTED_OS_FW_HASH_OID);
|
||||
static auth_param_type_desc_t tos_fw_config_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, TRUSTED_OS_FW_CONFIG_HASH_OID);
|
||||
static auth_param_type_desc_t tos_fw_extra1_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, TRUSTED_OS_FW_EXTRA1_HASH_OID);
|
||||
static auth_param_type_desc_t tos_fw_extra2_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, TRUSTED_OS_FW_EXTRA2_HASH_OID);
|
||||
static auth_param_type_desc_t nt_world_bl_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, NON_TRUSTED_WORLD_BOOTLOADER_HASH_OID);
|
||||
static auth_param_type_desc_t nt_fw_config_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, NON_TRUSTED_FW_CONFIG_HASH_OID);
|
||||
#endif /* IMAGE_BL2 */
|
||||
|
||||
|
||||
/* BL2 */
|
||||
static const auth_img_desc_t trusted_boot_fw_cert = {
|
||||
.img_id = TRUSTED_BOOT_FW_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = NULL,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &subject_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &trusted_nv_ctr,
|
||||
.plat_nv_ctr = &trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &tb_fw_hash,
|
||||
.data = {
|
||||
.ptr = (void *)tb_fw_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type_desc = &tb_fw_config_hash,
|
||||
.data = {
|
||||
.ptr = (void *)tb_fw_config_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[2] = {
|
||||
.type_desc = &hw_config_hash,
|
||||
.data = {
|
||||
.ptr = (void *)hw_config_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef IMAGE_BL1
|
||||
static const auth_img_desc_t bl2_image = {
|
||||
.img_id = BL2_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &trusted_boot_fw_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &tb_fw_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif /* IMAGE_BL1 */
|
||||
|
||||
/* HW Config */
|
||||
static const auth_img_desc_t hw_config = {
|
||||
.img_id = HW_CONFIG_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &trusted_boot_fw_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &hw_config_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* TB FW Config */
|
||||
#ifdef IMAGE_BL1
|
||||
static const auth_img_desc_t tb_fw_config = {
|
||||
.img_id = TB_FW_CONFIG_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &trusted_boot_fw_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &tb_fw_config_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif /* IMAGE_BL1 */
|
||||
|
||||
#ifdef IMAGE_BL2
|
||||
/* Trusted key certificate */
|
||||
static const auth_img_desc_t trusted_key_cert = {
|
||||
.img_id = TRUSTED_KEY_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = NULL,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &subject_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &trusted_nv_ctr,
|
||||
.plat_nv_ctr = &trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &trusted_world_pk,
|
||||
.data = {
|
||||
.ptr = (void *)trusted_world_pk_buf,
|
||||
.len = (unsigned int)PK_DER_LEN
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/* SCP Firmware */
|
||||
static const auth_img_desc_t scp_fw_key_cert = {
|
||||
.img_id = SCP_FW_KEY_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = &trusted_key_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &trusted_world_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &trusted_nv_ctr,
|
||||
.plat_nv_ctr = &trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &scp_fw_content_pk,
|
||||
.data = {
|
||||
.ptr = (void *)content_pk_buf,
|
||||
.len = (unsigned int)PK_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t scp_fw_content_cert = {
|
||||
.img_id = SCP_FW_CONTENT_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = &scp_fw_key_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &scp_fw_content_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &trusted_nv_ctr,
|
||||
.plat_nv_ctr = &trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &scp_fw_hash,
|
||||
.data = {
|
||||
.ptr = (void *)scp_fw_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t scp_bl2_image = {
|
||||
.img_id = SCP_BL2_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &scp_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &scp_fw_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* SoC Firmware */
|
||||
static const auth_img_desc_t soc_fw_key_cert = {
|
||||
.img_id = SOC_FW_KEY_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = &trusted_key_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &trusted_world_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &trusted_nv_ctr,
|
||||
.plat_nv_ctr = &trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &soc_fw_content_pk,
|
||||
.data = {
|
||||
.ptr = (void *)content_pk_buf,
|
||||
.len = (unsigned int)PK_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t soc_fw_content_cert = {
|
||||
.img_id = SOC_FW_CONTENT_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = &soc_fw_key_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &soc_fw_content_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &trusted_nv_ctr,
|
||||
.plat_nv_ctr = &trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &soc_fw_hash,
|
||||
.data = {
|
||||
.ptr = (void *)soc_fw_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type_desc = &soc_fw_config_hash,
|
||||
.data = {
|
||||
.ptr = (void *)soc_fw_config_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t bl31_image = {
|
||||
.img_id = BL31_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &soc_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &soc_fw_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* SOC FW Config */
|
||||
static const auth_img_desc_t soc_fw_config = {
|
||||
.img_id = SOC_FW_CONFIG_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &soc_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &soc_fw_config_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Trusted OS Firmware */
|
||||
static const auth_img_desc_t trusted_os_fw_key_cert = {
|
||||
.img_id = TRUSTED_OS_FW_KEY_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = &trusted_key_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &trusted_world_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &trusted_nv_ctr,
|
||||
.plat_nv_ctr = &trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &tos_fw_content_pk,
|
||||
.data = {
|
||||
.ptr = (void *)content_pk_buf,
|
||||
.len = (unsigned int)PK_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t trusted_os_fw_content_cert = {
|
||||
.img_id = TRUSTED_OS_FW_CONTENT_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = &trusted_os_fw_key_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &tos_fw_content_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &trusted_nv_ctr,
|
||||
.plat_nv_ctr = &trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &tos_fw_hash,
|
||||
.data = {
|
||||
.ptr = (void *)tos_fw_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type_desc = &tos_fw_extra1_hash,
|
||||
.data = {
|
||||
.ptr = (void *)tos_fw_extra1_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[2] = {
|
||||
.type_desc = &tos_fw_extra2_hash,
|
||||
.data = {
|
||||
.ptr = (void *)tos_fw_extra2_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[3] = {
|
||||
.type_desc = &tos_fw_config_hash,
|
||||
.data = {
|
||||
.ptr = (void *)tos_fw_config_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t bl32_image = {
|
||||
.img_id = BL32_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &trusted_os_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &tos_fw_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t bl32_extra1_image = {
|
||||
.img_id = BL32_EXTRA1_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &trusted_os_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &tos_fw_extra1_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t bl32_extra2_image = {
|
||||
.img_id = BL32_EXTRA2_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &trusted_os_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &tos_fw_extra2_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* TOS FW Config */
|
||||
static const auth_img_desc_t tos_fw_config = {
|
||||
.img_id = TOS_FW_CONFIG_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &trusted_os_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &tos_fw_config_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Non-Trusted Firmware */
|
||||
static const auth_img_desc_t non_trusted_fw_content_cert = {
|
||||
.img_id = NON_TRUSTED_FW_CONTENT_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = NULL, /* Root certificate. */
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &prot_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type = AUTH_METHOD_NV_CTR,
|
||||
.param.nv_ctr = {
|
||||
.cert_nv_ctr = &non_trusted_nv_ctr,
|
||||
.plat_nv_ctr = &non_trusted_nv_ctr
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &nt_world_bl_hash,
|
||||
.data = {
|
||||
.ptr = (void *)nt_world_bl_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type_desc = &nt_fw_config_hash,
|
||||
.data = {
|
||||
.ptr = (void *)nt_fw_config_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const auth_img_desc_t bl33_image = {
|
||||
.img_id = BL33_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &non_trusted_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &nt_world_bl_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* NT FW Config */
|
||||
static const auth_img_desc_t nt_fw_config = {
|
||||
.img_id = NT_FW_CONFIG_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &non_trusted_fw_content_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &nt_fw_config_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#else /* IMAGE_BL2 */
|
||||
|
||||
/* FWU auth descriptor */
|
||||
static const auth_img_desc_t fwu_cert = {
|
||||
.img_id = FWU_CERT_ID,
|
||||
.img_type = IMG_CERT,
|
||||
.parent = NULL,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_SIG,
|
||||
.param.sig = {
|
||||
.pk = &subject_pk,
|
||||
.sig = &sig,
|
||||
.alg = &sig_alg,
|
||||
.data = &raw_data
|
||||
}
|
||||
}
|
||||
},
|
||||
.authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) {
|
||||
[0] = {
|
||||
.type_desc = &scp_bl2u_hash,
|
||||
.data = {
|
||||
.ptr = (void *)scp_fw_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[1] = {
|
||||
.type_desc = &bl2u_hash,
|
||||
.data = {
|
||||
.ptr = (void *)tb_fw_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
},
|
||||
[2] = {
|
||||
.type_desc = &ns_bl2u_hash,
|
||||
.data = {
|
||||
.ptr = (void *)nt_world_bl_hash_buf,
|
||||
.len = (unsigned int)HASH_DER_LEN
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* SCP_BL2U */
|
||||
static const auth_img_desc_t scp_bl2u_image = {
|
||||
.img_id = SCP_BL2U_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &fwu_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &scp_bl2u_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* BL2U */
|
||||
static const auth_img_desc_t bl2u_image = {
|
||||
.img_id = BL2U_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &fwu_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &bl2u_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* NS_BL2U */
|
||||
static const auth_img_desc_t ns_bl2u_image = {
|
||||
.img_id = NS_BL2U_IMAGE_ID,
|
||||
.img_type = IMG_RAW,
|
||||
.parent = &fwu_cert,
|
||||
.img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) {
|
||||
[0] = {
|
||||
.type = AUTH_METHOD_HASH,
|
||||
.param.hash = {
|
||||
.data = &raw_data,
|
||||
.hash = &ns_bl2u_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif /* IMAGE_BL2 */
|
||||
|
||||
/*
|
||||
* Chain of trust definition
|
||||
*/
|
||||
#ifdef IMAGE_BL1
|
||||
static const auth_img_desc_t * const cot_desc[] = {
|
||||
[TRUSTED_BOOT_FW_CERT_ID] = &trusted_boot_fw_cert,
|
||||
[BL2_IMAGE_ID] = &bl2_image,
|
||||
[HW_CONFIG_ID] = &hw_config,
|
||||
[TB_FW_CONFIG_ID] = &tb_fw_config,
|
||||
[FWU_CERT_ID] = &fwu_cert,
|
||||
[SCP_BL2U_IMAGE_ID] = &scp_bl2u_image,
|
||||
[BL2U_IMAGE_ID] = &bl2u_image,
|
||||
[NS_BL2U_IMAGE_ID] = &ns_bl2u_image
|
||||
};
|
||||
#else /* IMAGE_BL2 */
|
||||
static const auth_img_desc_t * const cot_desc[] = {
|
||||
[TRUSTED_BOOT_FW_CERT_ID] = &trusted_boot_fw_cert,
|
||||
[HW_CONFIG_ID] = &hw_config,
|
||||
[TRUSTED_KEY_CERT_ID] = &trusted_key_cert,
|
||||
[SCP_FW_KEY_CERT_ID] = &scp_fw_key_cert,
|
||||
[SCP_FW_CONTENT_CERT_ID] = &scp_fw_content_cert,
|
||||
[SCP_BL2_IMAGE_ID] = &scp_bl2_image,
|
||||
[SOC_FW_KEY_CERT_ID] = &soc_fw_key_cert,
|
||||
[SOC_FW_CONTENT_CERT_ID] = &soc_fw_content_cert,
|
||||
[BL31_IMAGE_ID] = &bl31_image,
|
||||
[SOC_FW_CONFIG_ID] = &soc_fw_config,
|
||||
[TRUSTED_OS_FW_KEY_CERT_ID] = &trusted_os_fw_key_cert,
|
||||
[TRUSTED_OS_FW_CONTENT_CERT_ID] = &trusted_os_fw_content_cert,
|
||||
[BL32_IMAGE_ID] = &bl32_image,
|
||||
[BL32_EXTRA1_IMAGE_ID] = &bl32_extra1_image,
|
||||
[BL32_EXTRA2_IMAGE_ID] = &bl32_extra2_image,
|
||||
[TOS_FW_CONFIG_ID] = &tos_fw_config,
|
||||
[NON_TRUSTED_FW_CONTENT_CERT_ID] = &non_trusted_fw_content_cert,
|
||||
[BL33_IMAGE_ID] = &bl33_image,
|
||||
[NT_FW_CONFIG_ID] = &nt_fw_config,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Register the CoT in the authentication module */
|
||||
REGISTER_COT(cot_desc);
|
19
include/tools_share/dualroot_oid.h
Normal file
19
include/tools_share/dualroot_oid.h
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef DUALROOT_OID_H
|
||||
#define DUALROOT_OID_H
|
||||
|
||||
/* Reuse the Object IDs defined by TBBR for certificate extensions. */
|
||||
#include "tbbr_oid.h"
|
||||
|
||||
/*
|
||||
* Platform root-of-trust public key.
|
||||
* Arbitrary value that does not conflict with any of the TBBR reserved OIDs.
|
||||
*/
|
||||
#define PROT_PK_OID "1.3.6.1.4.1.4128.2100.1102"
|
||||
|
||||
#endif /* DUALROOT_OID_H */
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
|
||||
# Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
@ -23,6 +23,7 @@
|
||||
# KEY_ALG
|
||||
# KEY_SIZE
|
||||
# ROT_KEY
|
||||
# PROT_KEY
|
||||
# TRUSTED_WORLD_KEY
|
||||
# NON_TRUSTED_WORLD_KEY
|
||||
# SCP_BL2_KEY
|
||||
@ -57,6 +58,7 @@ $(if ${KEY_SIZE},$(eval $(call CERT_ADD_CMD_OPT,${KEY_SIZE},--key-size)))
|
||||
$(if ${HASH_ALG},$(eval $(call CERT_ADD_CMD_OPT,${HASH_ALG},--hash-alg)))
|
||||
$(if ${ROT_KEY},$(eval $(call CERT_ADD_CMD_OPT,${ROT_KEY},--rot-key)))
|
||||
$(if ${ROT_KEY},$(eval $(call CERT_ADD_CMD_OPT,${ROT_KEY},--rot-key,FWU_)))
|
||||
$(if ${PROT_KEY},$(eval $(call CERT_ADD_CMD_OPT,${PROT_KEY},--prot-key)))
|
||||
$(if ${TRUSTED_WORLD_KEY},$(eval $(call CERT_ADD_CMD_OPT,${TRUSTED_WORLD_KEY},--trusted-world-key)))
|
||||
$(if ${NON_TRUSTED_WORLD_KEY},$(eval $(call CERT_ADD_CMD_OPT,${NON_TRUSTED_WORLD_KEY},--non-trusted-world-key)))
|
||||
|
||||
@ -93,5 +95,7 @@ endif
|
||||
ifneq (${BL33},)
|
||||
$(if ${BL33_KEY},$(eval $(call CERT_ADD_CMD_OPT,${BL33_KEY},--nt-fw-key)))
|
||||
$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/nt_fw_content.crt,--nt-fw-cert))
|
||||
ifneq (${COT},dualroot)
|
||||
$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/nt_fw_key.crt,--nt-fw-key-cert))
|
||||
endif
|
||||
endif
|
||||
|
@ -27,6 +27,8 @@ OBJECTS := src/cert.o \
|
||||
# Chain of trust.
|
||||
ifeq (${COT},tbbr)
|
||||
include src/tbbr/tbbr.mk
|
||||
else ifeq (${COT},dualroot)
|
||||
include src/dualroot/cot.mk
|
||||
else
|
||||
$(error Unknown chain of trust ${COT})
|
||||
endif
|
||||
|
70
tools/cert_create/include/dualroot/cot.h
Normal file
70
tools/cert_create/include/dualroot/cot.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef DUALROOT_COT_H
|
||||
#define DUALROOT_COT_H
|
||||
|
||||
/* Certificates. */
|
||||
enum {
|
||||
/* Certificates owned by the silicon provider. */
|
||||
TRUSTED_BOOT_FW_CERT,
|
||||
TRUSTED_KEY_CERT,
|
||||
SCP_FW_KEY_CERT,
|
||||
SCP_FW_CONTENT_CERT,
|
||||
SOC_FW_KEY_CERT,
|
||||
SOC_FW_CONTENT_CERT,
|
||||
TRUSTED_OS_FW_KEY_CERT,
|
||||
TRUSTED_OS_FW_CONTENT_CERT,
|
||||
FWU_CERT,
|
||||
|
||||
/* Certificates owned by the platform owner. */
|
||||
NON_TRUSTED_FW_CONTENT_CERT,
|
||||
};
|
||||
|
||||
/* Certificate extensions. */
|
||||
enum {
|
||||
/* Extensions used in certificates owned by the silicon provider. */
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
TRUSTED_BOOT_FW_HASH_EXT,
|
||||
TRUSTED_BOOT_FW_CONFIG_HASH_EXT,
|
||||
HW_CONFIG_HASH_EXT,
|
||||
TRUSTED_WORLD_PK_EXT,
|
||||
SCP_FW_CONTENT_CERT_PK_EXT,
|
||||
SCP_FW_HASH_EXT,
|
||||
SOC_FW_CONTENT_CERT_PK_EXT,
|
||||
SOC_AP_FW_HASH_EXT,
|
||||
SOC_FW_CONFIG_HASH_EXT,
|
||||
TRUSTED_OS_FW_CONTENT_CERT_PK_EXT,
|
||||
TRUSTED_OS_FW_HASH_EXT,
|
||||
TRUSTED_OS_FW_EXTRA1_HASH_EXT,
|
||||
TRUSTED_OS_FW_EXTRA2_HASH_EXT,
|
||||
TRUSTED_OS_FW_CONFIG_HASH_EXT,
|
||||
SCP_FWU_CFG_HASH_EXT,
|
||||
AP_FWU_CFG_HASH_EXT,
|
||||
FWU_HASH_EXT,
|
||||
|
||||
/* Extensions used in certificates owned by the platform owner. */
|
||||
PROT_PK_EXT,
|
||||
NON_TRUSTED_FW_NVCOUNTER_EXT,
|
||||
NON_TRUSTED_FW_CONTENT_CERT_PK_EXT,
|
||||
NON_TRUSTED_WORLD_BOOTLOADER_HASH_EXT,
|
||||
NON_TRUSTED_FW_CONFIG_HASH_EXT,
|
||||
};
|
||||
|
||||
/* Keys. */
|
||||
enum {
|
||||
/* Keys owned by the silicon provider. */
|
||||
ROT_KEY,
|
||||
TRUSTED_WORLD_KEY,
|
||||
SCP_FW_CONTENT_CERT_KEY,
|
||||
SOC_FW_CONTENT_CERT_KEY,
|
||||
TRUSTED_OS_FW_CONTENT_CERT_KEY,
|
||||
|
||||
/* Keys owned by the platform owner. */
|
||||
PROT_KEY,
|
||||
};
|
||||
|
||||
#endif /* DUALROOT_COT_H */
|
453
tools/cert_create/src/dualroot/cot.c
Normal file
453
tools/cert_create/src/dualroot/cot.c
Normal file
@ -0,0 +1,453 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <dualroot_oid.h>
|
||||
|
||||
#include "cert.h"
|
||||
#include "ext.h"
|
||||
#include "key.h"
|
||||
|
||||
#include "dualroot/cot.h"
|
||||
|
||||
/*
|
||||
* Certificates used in the chain of trust.
|
||||
*
|
||||
* All certificates are self-signed so the issuer certificate field points to
|
||||
* itself.
|
||||
*/
|
||||
static cert_t cot_certs[] = {
|
||||
[TRUSTED_BOOT_FW_CERT] = {
|
||||
.id = TRUSTED_BOOT_FW_CERT,
|
||||
.opt = "tb-fw-cert",
|
||||
.help_msg = "Trusted Boot FW Certificate (output file)",
|
||||
.cn = "Trusted Boot FW Certificate",
|
||||
.key = ROT_KEY,
|
||||
.issuer = TRUSTED_BOOT_FW_CERT,
|
||||
.ext = {
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
TRUSTED_BOOT_FW_HASH_EXT,
|
||||
TRUSTED_BOOT_FW_CONFIG_HASH_EXT,
|
||||
HW_CONFIG_HASH_EXT
|
||||
},
|
||||
.num_ext = 4
|
||||
},
|
||||
|
||||
[TRUSTED_KEY_CERT] = {
|
||||
.id = TRUSTED_KEY_CERT,
|
||||
.opt = "trusted-key-cert",
|
||||
.help_msg = "Trusted Key Certificate (output file)",
|
||||
.cn = "Trusted Key Certificate",
|
||||
.key = ROT_KEY,
|
||||
.issuer = TRUSTED_KEY_CERT,
|
||||
.ext = {
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
TRUSTED_WORLD_PK_EXT,
|
||||
},
|
||||
.num_ext = 2
|
||||
},
|
||||
|
||||
[SCP_FW_KEY_CERT] = {
|
||||
.id = SCP_FW_KEY_CERT,
|
||||
.opt = "scp-fw-key-cert",
|
||||
.help_msg = "SCP Firmware Key Certificate (output file)",
|
||||
.cn = "SCP Firmware Key Certificate",
|
||||
.key = TRUSTED_WORLD_KEY,
|
||||
.issuer = SCP_FW_KEY_CERT,
|
||||
.ext = {
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
SCP_FW_CONTENT_CERT_PK_EXT
|
||||
},
|
||||
.num_ext = 2
|
||||
},
|
||||
|
||||
[SCP_FW_CONTENT_CERT] = {
|
||||
.id = SCP_FW_CONTENT_CERT,
|
||||
.opt = "scp-fw-cert",
|
||||
.help_msg = "SCP Firmware Content Certificate (output file)",
|
||||
.cn = "SCP Firmware Content Certificate",
|
||||
.key = SCP_FW_CONTENT_CERT_KEY,
|
||||
.issuer = SCP_FW_CONTENT_CERT,
|
||||
.ext = {
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
SCP_FW_HASH_EXT
|
||||
},
|
||||
.num_ext = 2
|
||||
},
|
||||
|
||||
[SOC_FW_KEY_CERT] = {
|
||||
.id = SOC_FW_KEY_CERT,
|
||||
.opt = "soc-fw-key-cert",
|
||||
.help_msg = "SoC Firmware Key Certificate (output file)",
|
||||
.cn = "SoC Firmware Key Certificate",
|
||||
.key = TRUSTED_WORLD_KEY,
|
||||
.issuer = SOC_FW_KEY_CERT,
|
||||
.ext = {
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
SOC_FW_CONTENT_CERT_PK_EXT
|
||||
},
|
||||
.num_ext = 2
|
||||
},
|
||||
|
||||
[SOC_FW_CONTENT_CERT] = {
|
||||
.id = SOC_FW_CONTENT_CERT,
|
||||
.opt = "soc-fw-cert",
|
||||
.help_msg = "SoC Firmware Content Certificate (output file)",
|
||||
.cn = "SoC Firmware Content Certificate",
|
||||
.key = SOC_FW_CONTENT_CERT_KEY,
|
||||
.issuer = SOC_FW_CONTENT_CERT,
|
||||
.ext = {
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
SOC_AP_FW_HASH_EXT,
|
||||
SOC_FW_CONFIG_HASH_EXT,
|
||||
},
|
||||
.num_ext = 3
|
||||
},
|
||||
|
||||
[TRUSTED_OS_FW_KEY_CERT] = {
|
||||
.id = TRUSTED_OS_FW_KEY_CERT,
|
||||
.opt = "tos-fw-key-cert",
|
||||
.help_msg = "Trusted OS Firmware Key Certificate (output file)",
|
||||
.cn = "Trusted OS Firmware Key Certificate",
|
||||
.key = TRUSTED_WORLD_KEY,
|
||||
.issuer = TRUSTED_OS_FW_KEY_CERT,
|
||||
.ext = {
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
TRUSTED_OS_FW_CONTENT_CERT_PK_EXT
|
||||
},
|
||||
.num_ext = 2
|
||||
},
|
||||
|
||||
[TRUSTED_OS_FW_CONTENT_CERT] = {
|
||||
.id = TRUSTED_OS_FW_CONTENT_CERT,
|
||||
.opt = "tos-fw-cert",
|
||||
.help_msg = "Trusted OS Firmware Content Certificate (output file)",
|
||||
.cn = "Trusted OS Firmware Content Certificate",
|
||||
.key = TRUSTED_OS_FW_CONTENT_CERT_KEY,
|
||||
.issuer = TRUSTED_OS_FW_CONTENT_CERT,
|
||||
.ext = {
|
||||
TRUSTED_FW_NVCOUNTER_EXT,
|
||||
TRUSTED_OS_FW_HASH_EXT,
|
||||
TRUSTED_OS_FW_EXTRA1_HASH_EXT,
|
||||
TRUSTED_OS_FW_EXTRA2_HASH_EXT,
|
||||
TRUSTED_OS_FW_CONFIG_HASH_EXT,
|
||||
},
|
||||
.num_ext = 5
|
||||
},
|
||||
|
||||
[FWU_CERT] = {
|
||||
.id = FWU_CERT,
|
||||
.opt = "fwu-cert",
|
||||
.help_msg = "Firmware Update Certificate (output file)",
|
||||
.cn = "Firmware Update Certificate",
|
||||
.key = ROT_KEY,
|
||||
.issuer = FWU_CERT,
|
||||
.ext = {
|
||||
SCP_FWU_CFG_HASH_EXT,
|
||||
AP_FWU_CFG_HASH_EXT,
|
||||
FWU_HASH_EXT
|
||||
},
|
||||
.num_ext = 3
|
||||
},
|
||||
|
||||
[NON_TRUSTED_FW_CONTENT_CERT] = {
|
||||
.id = NON_TRUSTED_FW_CONTENT_CERT,
|
||||
.opt = "nt-fw-cert",
|
||||
.help_msg = "Non-Trusted Firmware Content Certificate (output file)",
|
||||
.cn = "Non-Trusted Firmware Content Certificate",
|
||||
.key = PROT_KEY,
|
||||
.issuer = NON_TRUSTED_FW_CONTENT_CERT,
|
||||
.ext = {
|
||||
NON_TRUSTED_FW_NVCOUNTER_EXT,
|
||||
NON_TRUSTED_WORLD_BOOTLOADER_HASH_EXT,
|
||||
NON_TRUSTED_FW_CONFIG_HASH_EXT,
|
||||
PROT_PK_EXT,
|
||||
},
|
||||
.num_ext = 4
|
||||
},
|
||||
};
|
||||
|
||||
REGISTER_COT(cot_certs);
|
||||
|
||||
|
||||
/* Certificate extensions. */
|
||||
static ext_t cot_ext[] = {
|
||||
[TRUSTED_FW_NVCOUNTER_EXT] = {
|
||||
.oid = TRUSTED_FW_NVCOUNTER_OID,
|
||||
.opt = "tfw-nvctr",
|
||||
.help_msg = "Trusted Firmware Non-Volatile counter value",
|
||||
.sn = "TrustedWorldNVCounter",
|
||||
.ln = "Trusted World Non-Volatile counter",
|
||||
.asn1_type = V_ASN1_INTEGER,
|
||||
.type = EXT_TYPE_NVCOUNTER,
|
||||
.attr.nvctr_type = NVCTR_TYPE_TFW
|
||||
},
|
||||
|
||||
[TRUSTED_BOOT_FW_HASH_EXT] = {
|
||||
.oid = TRUSTED_BOOT_FW_HASH_OID,
|
||||
.opt = "tb-fw",
|
||||
.help_msg = "Trusted Boot Firmware image file",
|
||||
.sn = "TrustedBootFirmwareHash",
|
||||
.ln = "Trusted Boot Firmware hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH
|
||||
},
|
||||
|
||||
[TRUSTED_BOOT_FW_CONFIG_HASH_EXT] = {
|
||||
.oid = TRUSTED_BOOT_FW_CONFIG_HASH_OID,
|
||||
.opt = "tb-fw-config",
|
||||
.help_msg = "Trusted Boot Firmware Config file",
|
||||
.sn = "TrustedBootFirmwareConfigHash",
|
||||
.ln = "Trusted Boot Firmware Config hash",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[HW_CONFIG_HASH_EXT] = {
|
||||
.oid = HW_CONFIG_HASH_OID,
|
||||
.opt = "hw-config",
|
||||
.help_msg = "HW Config file",
|
||||
.sn = "HWConfigHash",
|
||||
.ln = "HW Config hash",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[TRUSTED_WORLD_PK_EXT] = {
|
||||
.oid = TRUSTED_WORLD_PK_OID,
|
||||
.sn = "TrustedWorldPublicKey",
|
||||
.ln = "Trusted World Public Key",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_PKEY,
|
||||
.attr.key = TRUSTED_WORLD_KEY
|
||||
},
|
||||
|
||||
[SCP_FW_CONTENT_CERT_PK_EXT] = {
|
||||
.oid = SCP_FW_CONTENT_CERT_PK_OID,
|
||||
.sn = "SCPFirmwareContentCertPK",
|
||||
.ln = "SCP Firmware content certificate public key",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_PKEY,
|
||||
.attr.key = SCP_FW_CONTENT_CERT_KEY
|
||||
},
|
||||
|
||||
[SCP_FW_HASH_EXT] = {
|
||||
.oid = SCP_FW_HASH_OID,
|
||||
.opt = "scp-fw",
|
||||
.help_msg = "SCP Firmware image file",
|
||||
.sn = "SCPFirmwareHash",
|
||||
.ln = "SCP Firmware hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH
|
||||
},
|
||||
|
||||
[SOC_FW_CONTENT_CERT_PK_EXT] = {
|
||||
.oid = SOC_FW_CONTENT_CERT_PK_OID,
|
||||
.sn = "SoCFirmwareContentCertPK",
|
||||
.ln = "SoC Firmware content certificate public key",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_PKEY,
|
||||
.attr.key = SOC_FW_CONTENT_CERT_KEY
|
||||
},
|
||||
|
||||
[SOC_AP_FW_HASH_EXT] = {
|
||||
.oid = SOC_AP_FW_HASH_OID,
|
||||
.opt = "soc-fw",
|
||||
.help_msg = "SoC AP Firmware image file",
|
||||
.sn = "SoCAPFirmwareHash",
|
||||
.ln = "SoC AP Firmware hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH
|
||||
},
|
||||
|
||||
[SOC_FW_CONFIG_HASH_EXT] = {
|
||||
.oid = SOC_FW_CONFIG_HASH_OID,
|
||||
.opt = "soc-fw-config",
|
||||
.help_msg = "SoC Firmware Config file",
|
||||
.sn = "SocFirmwareConfigHash",
|
||||
.ln = "SoC Firmware Config hash",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[TRUSTED_OS_FW_CONTENT_CERT_PK_EXT] = {
|
||||
.oid = TRUSTED_OS_FW_CONTENT_CERT_PK_OID,
|
||||
.sn = "TrustedOSFirmwareContentCertPK",
|
||||
.ln = "Trusted OS Firmware content certificate public key",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_PKEY,
|
||||
.attr.key = TRUSTED_OS_FW_CONTENT_CERT_KEY
|
||||
},
|
||||
|
||||
[TRUSTED_OS_FW_HASH_EXT] = {
|
||||
.oid = TRUSTED_OS_FW_HASH_OID,
|
||||
.opt = "tos-fw",
|
||||
.help_msg = "Trusted OS image file",
|
||||
.sn = "TrustedOSHash",
|
||||
.ln = "Trusted OS hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH
|
||||
},
|
||||
|
||||
[TRUSTED_OS_FW_EXTRA1_HASH_EXT] = {
|
||||
.oid = TRUSTED_OS_FW_EXTRA1_HASH_OID,
|
||||
.opt = "tos-fw-extra1",
|
||||
.help_msg = "Trusted OS Extra1 image file",
|
||||
.sn = "TrustedOSExtra1Hash",
|
||||
.ln = "Trusted OS Extra1 hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[TRUSTED_OS_FW_EXTRA2_HASH_EXT] = {
|
||||
.oid = TRUSTED_OS_FW_EXTRA2_HASH_OID,
|
||||
.opt = "tos-fw-extra2",
|
||||
.help_msg = "Trusted OS Extra2 image file",
|
||||
.sn = "TrustedOSExtra2Hash",
|
||||
.ln = "Trusted OS Extra2 hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[TRUSTED_OS_FW_CONFIG_HASH_EXT] = {
|
||||
.oid = TRUSTED_OS_FW_CONFIG_HASH_OID,
|
||||
.opt = "tos-fw-config",
|
||||
.help_msg = "Trusted OS Firmware Config file",
|
||||
.sn = "TrustedOSFirmwareConfigHash",
|
||||
.ln = "Trusted OS Firmware Config hash",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[SCP_FWU_CFG_HASH_EXT] = {
|
||||
.oid = SCP_FWU_CFG_HASH_OID,
|
||||
.opt = "scp-fwu-cfg",
|
||||
.help_msg = "SCP Firmware Update Config image file",
|
||||
.sn = "SCPFWUpdateConfig",
|
||||
.ln = "SCP Firmware Update Config hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[AP_FWU_CFG_HASH_EXT] = {
|
||||
.oid = AP_FWU_CFG_HASH_OID,
|
||||
.opt = "ap-fwu-cfg",
|
||||
.help_msg = "AP Firmware Update Config image file",
|
||||
.sn = "APFWUpdateConfig",
|
||||
.ln = "AP Firmware Update Config hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[FWU_HASH_EXT] = {
|
||||
.oid = FWU_HASH_OID,
|
||||
.opt = "fwu",
|
||||
.help_msg = "Firmware Updater image file",
|
||||
.sn = "FWUpdaterHash",
|
||||
.ln = "Firmware Updater hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
|
||||
[PROT_PK_EXT] = {
|
||||
.oid = PROT_PK_OID,
|
||||
.sn = "PlatformRoTKey",
|
||||
.ln = "Platform Root of Trust Public Key",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_PKEY,
|
||||
.attr.key = PROT_KEY
|
||||
},
|
||||
|
||||
[NON_TRUSTED_FW_NVCOUNTER_EXT] = {
|
||||
.oid = NON_TRUSTED_FW_NVCOUNTER_OID,
|
||||
.opt = "ntfw-nvctr",
|
||||
.help_msg = "Non-Trusted Firmware Non-Volatile counter value",
|
||||
.sn = "NormalWorldNVCounter",
|
||||
.ln = "Non-Trusted Firmware Non-Volatile counter",
|
||||
.asn1_type = V_ASN1_INTEGER,
|
||||
.type = EXT_TYPE_NVCOUNTER,
|
||||
.attr.nvctr_type = NVCTR_TYPE_NTFW
|
||||
},
|
||||
|
||||
[NON_TRUSTED_WORLD_BOOTLOADER_HASH_EXT] = {
|
||||
.oid = NON_TRUSTED_WORLD_BOOTLOADER_HASH_OID,
|
||||
.opt = "nt-fw",
|
||||
.help_msg = "Non-Trusted World Bootloader image file",
|
||||
.sn = "NonTrustedWorldBootloaderHash",
|
||||
.ln = "Non-Trusted World hash (SHA256)",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH
|
||||
},
|
||||
|
||||
[NON_TRUSTED_FW_CONFIG_HASH_EXT] = {
|
||||
.oid = NON_TRUSTED_FW_CONFIG_HASH_OID,
|
||||
.opt = "nt-fw-config",
|
||||
.help_msg = "Non Trusted OS Firmware Config file",
|
||||
.sn = "NonTrustedOSFirmwareConfigHash",
|
||||
.ln = "Non-Trusted OS Firmware Config hash",
|
||||
.asn1_type = V_ASN1_OCTET_STRING,
|
||||
.type = EXT_TYPE_HASH,
|
||||
.optional = 1
|
||||
},
|
||||
};
|
||||
|
||||
REGISTER_EXTENSIONS(cot_ext);
|
||||
|
||||
|
||||
/* Keys used to establish the chain of trust. */
|
||||
static key_t cot_keys[] = {
|
||||
[ROT_KEY] = {
|
||||
.id = ROT_KEY,
|
||||
.opt = "rot-key",
|
||||
.help_msg = "Root Of Trust key (input/output file)",
|
||||
.desc = "Root Of Trust key"
|
||||
},
|
||||
|
||||
[TRUSTED_WORLD_KEY] = {
|
||||
.id = TRUSTED_WORLD_KEY,
|
||||
.opt = "trusted-world-key",
|
||||
.help_msg = "Trusted World key (input/output file)",
|
||||
.desc = "Trusted World key"
|
||||
},
|
||||
|
||||
[SCP_FW_CONTENT_CERT_KEY] = {
|
||||
.id = SCP_FW_CONTENT_CERT_KEY,
|
||||
.opt = "scp-fw-key",
|
||||
.help_msg = "SCP Firmware Content Certificate key (input/output file)",
|
||||
.desc = "SCP Firmware Content Certificate key"
|
||||
},
|
||||
|
||||
[SOC_FW_CONTENT_CERT_KEY] = {
|
||||
.id = SOC_FW_CONTENT_CERT_KEY,
|
||||
.opt = "soc-fw-key",
|
||||
.help_msg = "SoC Firmware Content Certificate key (input/output file)",
|
||||
.desc = "SoC Firmware Content Certificate key"
|
||||
},
|
||||
|
||||
[TRUSTED_OS_FW_CONTENT_CERT_KEY] = {
|
||||
.id = TRUSTED_OS_FW_CONTENT_CERT_KEY,
|
||||
.opt = "tos-fw-key",
|
||||
.help_msg = "Trusted OS Firmware Content Certificate key (input/output file)",
|
||||
.desc = "Trusted OS Firmware Content Certificate key"
|
||||
},
|
||||
|
||||
[PROT_KEY] = {
|
||||
.id = PROT_KEY,
|
||||
.opt = "prot-key",
|
||||
.help_msg = "Platform Root of Trust key",
|
||||
.desc = "Platform Root of Trust key"
|
||||
},
|
||||
};
|
||||
|
||||
REGISTER_KEYS(cot_keys);
|
10
tools/cert_create/src/dualroot/cot.mk
Normal file
10
tools/cert_create/src/dualroot/cot.mk
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
PLAT_MSG := Dual root of trust
|
||||
PLAT_INCLUDE := ../../include/tools_share
|
||||
|
||||
OBJECTS += src/dualroot/cot.o
|
Loading…
Reference in New Issue
Block a user