From e19977d664027bb16324b1b5e1aaa0ca097e637b Mon Sep 17 00:00:00 2001 From: Manish V Badarkhe <Manish.Badarkhe@arm.com> Date: Tue, 27 Aug 2024 10:48:38 +0100 Subject: [PATCH] fix(cot-dt2c): use processed Device Tree source file as input Update the test files to eliminate the use of preprocessor macros, as the tool now requires processed output. The documentation has also been revised accordingly. Additionally, remove the Device Tree Source test files that were added to test the #ifdef conditions. Change-Id: I13a682db20e5e44170fc25a2e2dbedd45b9c7321 Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com> --- changelog.yaml | 3 + docs/tools/cot-dt2c.rst | 48 +--- .../cot_dt2c/tests/test_invalid_bracket.dtsi | 15 +- tools/cot_dt2c/tests/test_invalid_ifdef.dtsi | 59 ---- tools/cot_dt2c/tests/test_invalid_ifdef2.dtsi | 61 ---- .../tests/test_invalid_missing_attribute.dtsi | 197 ++----------- .../test_invalid_missing_attribute2.dtsi | 269 ------------------ .../tests/test_invalid_missing_ctr.dtsi | 11 +- .../tests/test_invalid_undefined_parent.dtsi | 196 ++----------- 9 files changed, 61 insertions(+), 798 deletions(-) delete mode 100644 tools/cot_dt2c/tests/test_invalid_ifdef.dtsi delete mode 100644 tools/cot_dt2c/tests/test_invalid_ifdef2.dtsi delete mode 100644 tools/cot_dt2c/tests/test_invalid_missing_attribute2.dtsi diff --git a/changelog.yaml b/changelog.yaml index df0476f8e..dbbff992e 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -1450,6 +1450,9 @@ subsections: - title: Transfer List Compiler scope: tlc + - title: Chain of Trust device tree to C source file + scope: cot-dt2c + - title: Dependencies scope: deps diff --git a/docs/tools/cot-dt2c.rst b/docs/tools/cot-dt2c.rst index 7b7e56fde..e8bb1aced 100644 --- a/docs/tools/cot-dt2c.rst +++ b/docs/tools/cot-dt2c.rst @@ -13,23 +13,15 @@ Prerequisites #. Python (3.8 or later) #. `Poetry`_ Python package manager - Getting Started ~~~~~~~~~~~~~~~ -#. Install the tool - - .. code:: - - make install - - -#. Verify that the tool runs correctly - - .. code:: - - make test +``cot-dt2c`` is installed by default with TF-A's poetry environment. All of it's +dependencies are listed in `tools/cot_dt2c/pyproject.toml`_. +``cot-dt2c`` requires a standard DTS file without #ifdef, macros, or other +preprocessor directives. Therefore, you need to provide a preprocessed device +tree source(DTS) as input to the tool. #. Usage of the tool @@ -53,29 +45,6 @@ Getting Started visualize-cot validate-dt -#. Uninstall the tool - .. code:: - - make uninstall - - This command will uninstall the tool - - -#. Uninstall the tool and clean all the build file - .. code:: - - make clean - - This command will clean all the build file and implicitly uninstall the tool - - -#. Call the make file from TF-A root directory - .. code:: - - make -C tools/cot-dt2c install - make -C tools/cot-dt2c uninstall - make -C tools/cot-dt2c clean - Convert CoT descriptors to C file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -88,7 +57,7 @@ the validity of the CoT DT file. .. code:: - cot-dt2c convert-to-c [INPUT DTB PATH] [OUTPUT C PATH] + cot-dt2c convert-to-c [INPUT DTS PATH] [OUTPUT C PATH] cot-dt2c convert-to-c fdts/tbbr_cot_descriptors.dtsi test.c @@ -111,7 +80,7 @@ Currently the validation is specifically for checking the CoT DT file .. code:: - cot-dt2c validate-cot [INPUT DTB PATH] + cot-dt2c validate-cot [INPUT DTS PATH] cot-dt2c validate-cot fdts/tbbr_cot_descriptors.dtsi @@ -123,7 +92,7 @@ the certificates and the image of a CoT DT file. .. code:: - cot-dt2c visualize-cot [INPUT DTB PATH] + cot-dt2c visualize-cot [INPUT DTS PATH] cot-dt2c visualize-cot fdts/tbbr_cot_descriptors.dtsi @@ -146,4 +115,5 @@ is not installed along with the tool. *Copyright (c) 2024, Arm Limited. All rights reserved.* +.. _tools/cot_dt2c/pyproject.toml: https://review.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a/+/refs/heads/integration/tools/cot_dt2c/pyproject.toml .. _Poetry: https://python-poetry.org/docs/ diff --git a/tools/cot_dt2c/tests/test_invalid_bracket.dtsi b/tools/cot_dt2c/tests/test_invalid_bracket.dtsi index ec5f9c7f1..9752ecfa2 100644 --- a/tools/cot_dt2c/tests/test_invalid_bracket.dtsi +++ b/tools/cot_dt2c/tests/test_invalid_bracket.dtsi @@ -8,21 +8,18 @@ * */ -#include <example/example.h> -#include <example/example/example.h> - cot { manifests { compatible = "arm, cert-descs"; example_cert: example_cert { root-certificate; - image-id =<EXAMPLE_ID>; + image-id =<2>; antirollback-counter = <&example_ctr>; example_hash: example_hash { - oid = EXAMPLE_HASH_ID; + oid = "1.3.6.1.4.1.4128.2100.101"; }; }; @@ -32,7 +29,7 @@ cot { compatible = "arm, img-descs"; example { - image-id = <EXAMPLE_ID>; + image-id = <2>; parent = <&example_cert>; hash = <&example_hash>; }; @@ -45,13 +42,13 @@ non_volatile_counters: non_volatile_counters { #size-cells = <0>; example_ctr: example_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = CCA_FW_NVCOUNTER_OID; + id = <0>; + oid = "1.3.6.1.4.1.4128.2100.3"; }; }; rot_keys { example_pk: example_pk { - oid = EXAMPLE_PK_OID; + oid = "1.3.6.1.4.1.4128.2100.101"; }; }; diff --git a/tools/cot_dt2c/tests/test_invalid_ifdef.dtsi b/tools/cot_dt2c/tests/test_invalid_ifdef.dtsi deleted file mode 100644 index 5bc6bb9e2..000000000 --- a/tools/cot_dt2c/tests/test_invalid_ifdef.dtsi +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2024, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * This file provide a malformed CoT DT file that there is - * unmatching ifdef macro - * - */ - -#include <example/example.h> -#include <example/example/example.h> - -cot { - manifests { - compatible = "arm, cert-descs"; - - example_cert: example_cert { - root-certificate; - image-id =<EXAMPLE_ID>; - antirollback-counter = <&example_ctr>; - - example_hash: example_hash - { - oid = EXAMPLE_HASH_ID; - }; - - }; - }; - -#if defined(test) - images { - compatible = "arm, img-descs"; - - example { - image-id = <EXAMPLE_ID>; - parent = <&example_cert>; - hash = <&example_hash>; - }; - }; -}; - -non_volatile_counters: non_volatile_counters { - compatible = "arm, non-volatile-counter"; - - #address-cells = <1>; - #size-cells = <0>; - - example_ctr: example_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = CCA_FW_NVCOUNTER_OID; - }; -}; - -rot_keys { - example_pk: example_pk { - oid = EXAMPLE_PK_OID; - }; -}; diff --git a/tools/cot_dt2c/tests/test_invalid_ifdef2.dtsi b/tools/cot_dt2c/tests/test_invalid_ifdef2.dtsi deleted file mode 100644 index c915168e2..000000000 --- a/tools/cot_dt2c/tests/test_invalid_ifdef2.dtsi +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2024, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * This file provide a malformed CoT DT file that there is - * unmatching ifdef macro - * - */ - -#include <example/example.h> -#include <example/example/example.h> - -cot { - manifests { - compatible = "arm, cert-descs"; - - example_cert: example_cert { - root-certificate; - image-id =<EXAMPLE_ID>; - antirollback-counter = <&example_ctr>; - - example_hash: example_hash - { - oid = EXAMPLE_HASH_ID; - }; - - }; - }; - -#if defined(test) - images { - compatible = "arm, img-descs"; - - example { - image-id = <EXAMPLE_ID>; - parent = <&example_cert>; - hash = <&example_hash>; - }; - }; -#endif -#endif -}; - -non_volatile_counters: non_volatile_counters { - compatible = "arm, non-volatile-counter"; - - #address-cells = <1>; - #size-cells = <0>; - - example_ctr: example_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = CCA_FW_NVCOUNTER_OID; - }; -}; - -rot_keys { - example_pk: example_pk { - oid = EXAMPLE_PK_OID; - }; -}; diff --git a/tools/cot_dt2c/tests/test_invalid_missing_attribute.dtsi b/tools/cot_dt2c/tests/test_invalid_missing_attribute.dtsi index 9c0a5f271..e35ab7372 100644 --- a/tools/cot_dt2c/tests/test_invalid_missing_attribute.dtsi +++ b/tools/cot_dt2c/tests/test_invalid_missing_attribute.dtsi @@ -8,10 +8,6 @@ * */ -#include <tools_share/cca_oid.h> -#include <common/tbbr/tbbr_img_def.h> -#include <common/nv_cntr_ids.h> - cot { manifests { compatible = "arm, cert-descs"; @@ -20,218 +16,63 @@ cot { root-certificate; antirollback-counter = <&cca_nv_ctr>; - tb_fw_hash: tb_fw_hash { - oid = TRUSTED_BOOT_FW_HASH_OID; - }; - tb_fw_config_hash: tb_fw_config_hash { - oid = TRUSTED_BOOT_FW_CONFIG_HASH_OID; - }; hw_config_hash: hw_config_hash { }; - fw_config_hash: fw_config_hash { - oid = FW_CONFIG_HASH_OID; - }; - soc_fw_hash: soc_fw_hash { - oid = SOC_AP_FW_HASH_OID; - }; + soc_fw_config_hash: soc_fw_config_hash { - oid = SOC_FW_CONFIG_HASH_OID; - }; - rmm_hash: rmm_hash { - oid = RMM_HASH_OID; - }; - }; - - core_swd_key_cert: core_swd_key_cert { - root-certificate; - image-id = <CORE_SWD_KEY_CERT_ID>; - signing-key = <&swd_rot_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - core_swd_pk: core_swd_pk { - oid = CORE_SWD_PK_OID; - }; - }; - - trusted_os_fw_content_cert: trusted_os_fw_content_cert { - image-id = <TRUSTED_OS_FW_CONTENT_CERT_ID>; - parent = <&core_swd_key_cert>; - signing-key = <&core_swd_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - tos_fw_hash: tos_fw_hash { - oid = TRUSTED_OS_FW_HASH_OID; - }; - tos_fw_config_hash: tos_fw_config_hash { - oid = TRUSTED_OS_FW_CONFIG_HASH_OID; + oid = "1.3.6.1.4.1.4128.2100.604"; }; }; plat_key_cert: plat_key_cert { root-certificate; - image-id = <PLAT_KEY_CERT_ID>; + image-id = <38>; signing-key = <&prot_pk>; antirollback-counter = <&non_trusted_nv_ctr>; plat_pk: plat_pk { - oid = PLAT_PK_OID; + oid = "1.3.6.1.4.1.4128.2100.1105"; }; }; non_trusted_fw_content_cert: non_trusted_fw_content_cert { - image-id = <NON_TRUSTED_FW_CONTENT_CERT_ID>; - parent = <&plat_key_cert>; + image-id = <15>; signing-key = <&plat_pk>; antirollback-counter = <&non_trusted_nv_ctr>; nt_world_bl_hash: nt_world_bl_hash { - oid = NON_TRUSTED_WORLD_BOOTLOADER_HASH_OID; + oid = "1.3.6.1.4.1.4128.2100.1201"; }; nt_fw_config_hash: nt_fw_config_hash { - oid = NON_TRUSTED_FW_CONFIG_HASH_OID; + oid = "1.3.6.1.4.1.4128.2100.1202"; }; }; -#if defined(SPD_spmd) - sip_sp_content_cert: sip_sp_content_cert { - image-id = <SIP_SP_CONTENT_CERT_ID>; - parent = <&core_swd_key_cert>; - signing-key = <&core_swd_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - sp_pkg1_hash: sp_pkg1_hash { - oid = SP_PKG1_HASH_OID; - }; - sp_pkg2_hash: sp_pkg2_hash { - oid = SP_PKG2_HASH_OID; - }; - sp_pkg3_hash: sp_pkg3_hash { - oid = SP_PKG3_HASH_OID; - }; - sp_pkg4_hash: sp_pkg4_hash { - oid = SP_PKG4_HASH_OID; - }; - }; - - plat_sp_content_cert: plat_sp_content_cert { - parent = <&plat_key_cert>; - signing-key = <&plat_pk>; - antirollback-counter = <&non_trusted_nv_ctr>; - - sp_pkg5_hash: sp_pkg5_hash { - oid = SP_PKG5_HASH_OID; - }; - sp_pkg6_hash: sp_pkg6_hash { - oid = SP_PKG6_HASH_OID; - }; - sp_pkg7_hash: sp_pkg7_hash { - oid = SP_PKG7_HASH_OID; - }; - sp_pkg8_hash: sp_pkg8_hash { - oid = SP_PKG8_HASH_OID; - }; - }; -#endif - }; - images { compatible = "arm, img-descs"; hw_config { - image-id = <HW_CONFIG_ID>; + image-id = <23>; hash = <&hw_config_hash>; }; - bl31_image { - image-id = <BL31_IMAGE_ID>; - parent = <&cca_content_cert>; - hash = <&soc_fw_hash>; - }; - soc_fw_config { - image-id = <SOC_FW_CONFIG_ID>; + image-id = <25>; parent = <&cca_content_cert>; hash = <&soc_fw_config_hash>; }; - rmm_image { - image-id = <RMM_IMAGE_ID>; - parent = <&cca_content_cert>; - hash = <&rmm_hash>; - }; - - bl32_image { - image-id = <BL32_IMAGE_ID>; - parent = <&trusted_os_fw_content_cert>; - hash = <&tos_fw_hash>; - }; - - tos_fw_config { - image-id = <TOS_FW_CONFIG_ID>; - parent = <&trusted_os_fw_content_cert>; - hash = <&tos_fw_config_hash>; - }; - bl33_image { - image-id = <BL33_IMAGE_ID>; + image-id = <5>; parent = <&non_trusted_fw_content_cert>; hash = <&nt_world_bl_hash>; }; nt_fw_config { - image-id = <NT_FW_CONFIG_ID>; + image-id = <27>; parent = <&non_trusted_fw_content_cert>; hash = <&nt_fw_config_hash>; }; - -#if defined(SPD_spmd) - sp_pkg1 { - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg1_hash>; - }; - - sp_pkg2 { - image-id = <SP_PKG2_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg2_hash>; - }; - - sp_pkg3 { - image-id = <SP_PKG3_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg3_hash>; - }; - - sp_pkg4 { - image-id = <SP_PKG4_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg4_hash>; - }; - - sp_pkg5 { - image-id = <SP_PKG5_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg5_hash>; - }; - - sp_pkg6 { - image-id = <SP_PKG6_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg6_hash>; - }; - - sp_pkg7 { - image-id = <SP_PKG7_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg7_hash>; - }; - - sp_pkg8 { - image-id = <SP_PKG8_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg8_hash>; - }; -#endif }; }; @@ -242,26 +83,26 @@ non_volatile_counters: non_volatile_counters { #size-cells = <0>; cca_nv_ctr: cca_nv_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = CCA_FW_NVCOUNTER_OID; + id = <0>; + oid = "1.3.6.1.4.1.4128.2100.3"; }; trusted_nv_ctr: trusted_nv_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = TRUSTED_FW_NVCOUNTER_OID; + id = <0>; + oid = "1.3.6.1.4.1.4128.2100.1"; }; non_trusted_nv_ctr: non_trusted_nv_ctr { - id = <NON_TRUSTED_NV_CTR_ID>; - oid = NON_TRUSTED_FW_NVCOUNTER_OID; + id = <1>; + oid = "1.3.6.1.4.1.4128.2100.2"; }; }; rot_keys { swd_rot_pk: swd_rot_pk { - oid = SWD_ROT_PK_OID; + oid = "1.3.6.1.4.1.4128.2100.1103"; }; prot_pk: prot_pk { - oid = PROT_PK_OID; + oid = "1.3.6.1.4.1.4128.2100.1102"; }; }; diff --git a/tools/cot_dt2c/tests/test_invalid_missing_attribute2.dtsi b/tools/cot_dt2c/tests/test_invalid_missing_attribute2.dtsi deleted file mode 100644 index 01b259794..000000000 --- a/tools/cot_dt2c/tests/test_invalid_missing_attribute2.dtsi +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (c) 2024, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * This file provide a malformed CoT DT file that there - * are image/certificate that points to invalid parent - * - */ - -#include <tools_share/cca_oid.h> -#include <common/tbbr/tbbr_img_def.h> -#include <common/nv_cntr_ids.h> - -cot { - manifests { - compatible = "arm, cert-descs"; - - cca_content_cert: cca_content_cert { - root-certificate; - image-id =<CCA_CONTENT_CERT_ID>; - antirollback-counter = <&cca_nv_ctr>; - - tb_fw_hash: tb_fw_hash { - oid = TRUSTED_BOOT_FW_HASH_OID; - }; - tb_fw_config_hash: tb_fw_config_hash { - oid = TRUSTED_BOOT_FW_CONFIG_HASH_OID; - }; - hw_config_hash: hw_config_hash { - oid = HW_CONFIG_HASH_OID; - }; - fw_config_hash: fw_config_hash { - oid = FW_CONFIG_HASH_OID; - }; - soc_fw_hash: soc_fw_hash { - oid = SOC_AP_FW_HASH_OID; - }; - soc_fw_config_hash: soc_fw_config_hash { - oid = SOC_FW_CONFIG_HASH_OID; - }; - rmm_hash: rmm_hash { - oid = RMM_HASH_OID; - }; - }; - - core_swd_key_cert: core_swd_key_cert { - root-certificate; - image-id = <CORE_SWD_KEY_CERT_ID>; - signing-key = <&swd_rot_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - core_swd_pk: core_swd_pk { - oid = CORE_SWD_PK_OID; - }; - }; - - trusted_os_fw_content_cert: trusted_os_fw_content_cert { - image-id = <TRUSTED_OS_FW_CONTENT_CERT_ID>; - parent = <&core_swd_key_cert>; - signing-key = <&core_swd_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - tos_fw_hash: tos_fw_hash { - oid = TRUSTED_OS_FW_HASH_OID; - }; - tos_fw_config_hash: tos_fw_config_hash { - oid = TRUSTED_OS_FW_CONFIG_HASH_OID; - }; - }; - - plat_key_cert: plat_key_cert { - root-certificate; - image-id = <PLAT_KEY_CERT_ID>; - signing-key = <&prot_pk>; - antirollback-counter = <&non_trusted_nv_ctr>; - - plat_pk: plat_pk { - oid = PLAT_PK_OID; - }; - }; - - non_trusted_fw_content_cert: non_trusted_fw_content_cert { - image-id = <NON_TRUSTED_FW_CONTENT_CERT_ID>; - parent = <&cca_content_cert>; - signing-key = <&plat_pk>; - antirollback-counter = <&non_trusted_nv_ctr>; - - nt_world_bl_hash: nt_world_bl_hash { - oid = NON_TRUSTED_WORLD_BOOTLOADER_HASH_OID; - }; - nt_fw_config_hash: nt_fw_config_hash { - oid = NON_TRUSTED_FW_CONFIG_HASH_OID; - }; - }; - -#if defined(SPD_spmd) - sip_sp_content_cert: sip_sp_content_cert { - image-id = <SIP_SP_CONTENT_CERT_ID>; - parent = <&cca_content_cert>; - signing-key = <&core_swd_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - sp_pkg1_hash: sp_pkg1_hash { - oid = SP_PKG1_HASH_OID; - }; - sp_pkg2_hash: sp_pkg2_hash { - oid = SP_PKG2_HASH_OID; - }; - sp_pkg3_hash: sp_pkg3_hash { - oid = SP_PKG3_HASH_OID; - }; - sp_pkg4_hash: sp_pkg4_hash { - oid = SP_PKG4_HASH_OID; - }; - }; - - plat_sp_content_cert: plat_sp_content_cert { - image-id = <PLAT_SP_CONTENT_CERT_ID>; - signing-key = <&plat_pk>; - antirollback-counter = <&non_trusted_nv_ctr>; - - sp_pkg5_hash: sp_pkg5_hash { - oid = SP_PKG5_HASH_OID; - }; - sp_pkg6_hash: sp_pkg6_hash { - oid = SP_PKG6_HASH_OID; - }; - sp_pkg7_hash: sp_pkg7_hash { - oid = SP_PKG7_HASH_OID; - }; - sp_pkg8_hash: sp_pkg8_hash { - oid = SP_PKG8_HASH_OID; - }; - }; -#endif - }; - - images { - compatible = "arm, img-descs"; - - hw_config { - image-id = <HW_CONFIG_ID>; - parent = <&cca_content_cert>; - hash = <&hw_config_hash>; - }; - - bl31_image { - image-id = <BL31_IMAGE_ID>; - parent = <&cca_content_cert>; - hash = <&soc_fw_hash>; - }; - - soc_fw_config { - image-id = <SOC_FW_CONFIG_ID>; - parent = <&cca_content_cert>; - hash = <&soc_fw_config_hash>; - }; - - rmm_image { - image-id = <RMM_IMAGE_ID>; - parent = <&cca_content_cert>; - hash = <&rmm_hash>; - }; - - bl32_image { - image-id = <BL32_IMAGE_ID>; - parent = <&trusted_os_fw_content_cert>; - hash = <&tos_fw_hash>; - }; - - tos_fw_config { - image-id = <TOS_FW_CONFIG_ID>; - parent = <&trusted_os_fw_content_cert>; - hash = <&tos_fw_config_hash>; - }; - - bl33_image { - image-id = <BL33_IMAGE_ID>; - parent = <&non_trusted_fw_content_cert>; - hash = <&nt_world_bl_hash>; - }; - - nt_fw_config { - image-id = <NT_FW_CONFIG_ID>; - hash = <&nt_fw_config_hash>; - }; - -#if defined(SPD_spmd) - sp_pkg1 { - image-id = <SP_PKG1_ID>; - hash = <&sp_pkg1_hash>; - }; - - sp_pkg2 { - image-id = <SP_PKG2_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg2_hash>; - }; - - sp_pkg3 { - image-id = <SP_PKG3_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg3_hash>; - }; - - sp_pkg4 { - image-id = <SP_PKG4_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg4_hash>; - }; - - sp_pkg5 { - image-id = <SP_PKG5_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg5_hash>; - }; - - sp_pkg6 { - image-id = <SP_PKG6_ID>; - parent = <&wrong_parent>; - hash = <&sp_pkg6_hash>; - }; - - sp_pkg7 { - image-id = <SP_PKG7_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg7_hash>; - }; - - sp_pkg8 { - image-id = <SP_PKG8_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg8_hash>; - }; -#endif - }; -}; - -non_volatile_counters: non_volatile_counters { - compatible = "arm, non-volatile-counter"; - - #address-cells = <1>; - #size-cells = <0>; - - cca_nv_ctr: cca_nv_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = CCA_FW_NVCOUNTER_OID; - }; - - trusted_nv_ctr: trusted_nv_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = TRUSTED_FW_NVCOUNTER_OID; - }; - - non_trusted_nv_ctr: non_trusted_nv_ctr { - id = <NON_TRUSTED_NV_CTR_ID>; - oid = NON_TRUSTED_FW_NVCOUNTER_OID; - }; -}; - -rot_keys { - swd_rot_pk: swd_rot_pk { - oid = SWD_ROT_PK_OID; - }; - prot_pk: prot_pk { - oid = PROT_PK_OID; - }; -}; diff --git a/tools/cot_dt2c/tests/test_invalid_missing_ctr.dtsi b/tools/cot_dt2c/tests/test_invalid_missing_ctr.dtsi index 5958f5d46..c572b1af3 100644 --- a/tools/cot_dt2c/tests/test_invalid_missing_ctr.dtsi +++ b/tools/cot_dt2c/tests/test_invalid_missing_ctr.dtsi @@ -9,22 +9,19 @@ * */ -#include <example/example.h> -#include <example/example/example.h> - cot { manifests { compatible = "arm, cert-descs"; example_cert: example_cert { root-certificate; - image-id =<EXAMPLE_ID>; + image-id =<2>; signing-key = <&swd_rot_pk>; antirollback-counter = <&example_ctr>; example_hash: example_hash { - oid = EXAMPLE_HASH_ID; + oid = "1.3.6.1.4.1.4128.2100.104"; }; }; @@ -34,7 +31,7 @@ cot { compatible = "arm, img-descs"; example { - image-id = <EXAMPLE_ID>; + image-id = <2>; parent = <&example_cert>; hash = <&example_hash>; }; @@ -51,6 +48,6 @@ non_volatile_counters: non_volatile_counters { rot_keys { example_pk: example_pk { - oid = EXAMPLE_PK_OID; + oid = "1.3.6.1.4.1.4128.2100.104"; }; }; diff --git a/tools/cot_dt2c/tests/test_invalid_undefined_parent.dtsi b/tools/cot_dt2c/tests/test_invalid_undefined_parent.dtsi index b761beb34..b6056caf2 100644 --- a/tools/cot_dt2c/tests/test_invalid_undefined_parent.dtsi +++ b/tools/cot_dt2c/tests/test_invalid_undefined_parent.dtsi @@ -8,75 +8,31 @@ * */ -#include <tools_share/cca_oid.h> -#include <common/tbbr/tbbr_img_def.h> -#include <common/nv_cntr_ids.h> - cot { manifests { compatible = "arm, cert-descs"; cca_content_cert: cca_content_cert { root-certificate; - image-id =<CCA_CONTENT_CERT_ID>; + image-id =<36>; antirollback-counter = <&cca_nv_ctr>; - tb_fw_hash: tb_fw_hash { - oid = TRUSTED_BOOT_FW_HASH_OID; - }; - tb_fw_config_hash: tb_fw_config_hash { - oid = TRUSTED_BOOT_FW_CONFIG_HASH_OID; - }; hw_config_hash: hw_config_hash { - oid = HW_CONFIG_HASH_OID; - }; - fw_config_hash: fw_config_hash { - oid = FW_CONFIG_HASH_OID; - }; - soc_fw_hash: soc_fw_hash { - oid = SOC_AP_FW_HASH_OID; + oid = "1.3.6.1.4.1.4128.2100.203"; }; soc_fw_config_hash: soc_fw_config_hash { - oid = SOC_FW_CONFIG_HASH_OID; - }; - rmm_hash: rmm_hash { - oid = RMM_HASH_OID; - }; - }; - - core_swd_key_cert: core_swd_key_cert { - root-certificate; - image-id = <CORE_SWD_KEY_CERT_ID>; - signing-key = <&swd_rot_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - core_swd_pk: core_swd_pk { - oid = CORE_SWD_PK_OID; - }; - }; - - trusted_os_fw_content_cert: trusted_os_fw_content_cert { - image-id = <TRUSTED_OS_FW_CONTENT_CERT_ID>; - parent = <&core_swd_key_cert>; - signing-key = <&core_swd_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - tos_fw_hash: tos_fw_hash { - oid = TRUSTED_OS_FW_HASH_OID; - }; - tos_fw_config_hash: tos_fw_config_hash { - oid = TRUSTED_OS_FW_CONFIG_HASH_OID; + oid = "1.3.6.1.4.1.4128.2100.604"; }; }; plat_key_cert: plat_key_cert { root-certificate; - image-id = <PLAT_KEY_CERT_ID>; + image-id = <38>; signing-key = <&prot_pk>; antirollback-counter = <&non_trusted_nv_ctr>; plat_pk: plat_pk { - oid = PLAT_PK_OID; + oid = "1.3.6.1.4.1.4128.2100.1105"; }; }; @@ -87,153 +43,40 @@ cot { antirollback-counter = <&non_trusted_nv_ctr>; nt_world_bl_hash: nt_world_bl_hash { - oid = NON_TRUSTED_WORLD_BOOTLOADER_HASH_OID; + oid = "1.3.6.1.4.1.4128.2100.1201"; }; nt_fw_config_hash: nt_fw_config_hash { - oid = NON_TRUSTED_FW_CONFIG_HASH_OID; + oid = "1.3.6.1.4.1.4128.2100.1202"; }; }; -#if defined(SPD_spmd) - sip_sp_content_cert: sip_sp_content_cert { - image-id = <SIP_SP_CONTENT_CERT_ID>; - parent = <&wrong_parent>; - signing-key = <&core_swd_pk>; - antirollback-counter = <&trusted_nv_ctr>; - - sp_pkg1_hash: sp_pkg1_hash { - oid = SP_PKG1_HASH_OID; - }; - sp_pkg2_hash: sp_pkg2_hash { - oid = SP_PKG2_HASH_OID; - }; - sp_pkg3_hash: sp_pkg3_hash { - oid = SP_PKG3_HASH_OID; - }; - sp_pkg4_hash: sp_pkg4_hash { - oid = SP_PKG4_HASH_OID; - }; - }; - - plat_sp_content_cert: plat_sp_content_cert { - image-id = <PLAT_SP_CONTENT_CERT_ID>; - signing-key = <&plat_pk>; - antirollback-counter = <&non_trusted_nv_ctr>; - - sp_pkg5_hash: sp_pkg5_hash { - oid = SP_PKG5_HASH_OID; - }; - sp_pkg6_hash: sp_pkg6_hash { - oid = SP_PKG6_HASH_OID; - }; - sp_pkg7_hash: sp_pkg7_hash { - oid = SP_PKG7_HASH_OID; - }; - sp_pkg8_hash: sp_pkg8_hash { - oid = SP_PKG8_HASH_OID; - }; - }; -#endif }; images { compatible = "arm, img-descs"; hw_config { - image-id = <HW_CONFIG_ID>; + image-id = <23>; parent = <&cca_content_cert>; hash = <&hw_config_hash>; }; - bl31_image { - image-id = <BL31_IMAGE_ID>; - parent = <&cca_content_cert>; - hash = <&soc_fw_hash>; - }; - soc_fw_config { - image-id = <SOC_FW_CONFIG_ID>; + image-id = <25>; parent = <&cca_content_cert>; hash = <&soc_fw_config_hash>; }; - rmm_image { - image-id = <RMM_IMAGE_ID>; - parent = <&cca_content_cert>; - hash = <&rmm_hash>; - }; - - bl32_image { - image-id = <BL32_IMAGE_ID>; - parent = <&trusted_os_fw_content_cert>; - hash = <&tos_fw_hash>; - }; - - tos_fw_config { - image-id = <TOS_FW_CONFIG_ID>; - parent = <&trusted_os_fw_content_cert>; - hash = <&tos_fw_config_hash>; - }; - bl33_image { - image-id = <BL33_IMAGE_ID>; + image-id = <5>; parent = <&non_trusted_fw_content_cert>; hash = <&nt_world_bl_hash>; }; nt_fw_config { - image-id = <NT_FW_CONFIG_ID>; + image-id = <27>; hash = <&nt_fw_config_hash>; }; - -#if defined(SPD_spmd) - sp_pkg1 { - image-id = <SP_PKG1_ID>; - hash = <&sp_pkg1_hash>; - }; - - sp_pkg2 { - image-id = <SP_PKG2_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg2_hash>; - }; - - sp_pkg3 { - image-id = <SP_PKG3_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg3_hash>; - }; - - sp_pkg4 { - image-id = <SP_PKG4_ID>; - parent = <&sip_sp_content_cert>; - hash = <&sp_pkg4_hash>; - }; - - sp_pkg5 { - image-id = <SP_PKG5_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg5_hash>; - }; - - sp_pkg6 { - image-id = <SP_PKG6_ID>; - parent = <&wrong_parent>; - hash = <&sp_pkg6_hash>; - }; - - sp_pkg7 { - image-id = <SP_PKG7_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg7_hash>; - }; - - sp_pkg8 { - image-id = <SP_PKG8_ID>; - parent = <&plat_sp_content_cert>; - hash = <&sp_pkg8_hash>; - }; -#endif }; }; @@ -244,26 +87,27 @@ non_volatile_counters: non_volatile_counters { #size-cells = <0>; cca_nv_ctr: cca_nv_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = CCA_FW_NVCOUNTER_OID; + id = <0>; + oid = "1.3.6.1.4.1.4128.2100.3"; }; trusted_nv_ctr: trusted_nv_ctr { - id = <TRUSTED_NV_CTR_ID>; - oid = TRUSTED_FW_NVCOUNTER_OID; + id = <0>; + oid = "1.3.6.1.4.1.4128.2100.1"; }; non_trusted_nv_ctr: non_trusted_nv_ctr { - id = <NON_TRUSTED_NV_CTR_ID>; - oid = NON_TRUSTED_FW_NVCOUNTER_OID; + id = <1>; + oid = "1.3.6.1.4.1.4128.2100.2"; }; }; rot_keys { swd_rot_pk: swd_rot_pk { - oid = SWD_ROT_PK_OID; + oid = "1.3.6.1.4.1.4128.2100.1103"; }; + prot_pk: prot_pk { - oid = PROT_PK_OID; + oid = "1.3.6.1.4.1.4128.2100.1102"; }; };