From: Adrian Freihofer <[email protected]>

The existing SPL signing tests use the default settings of
uboot-sign.bbclass which sign the individual images.

Add test_sign_standalone_uboot_fit_image_conf which covers the
non-default case: SPL_SIGN_CONF = "1" and SPL_SIGN_INDIVIDUAL = "0".
It verifies that the configuration is signed instead of the individual
images and that the public key in the SPL DTB is required for "conf".

Signed-off-by: Adrian Freihofer <[email protected]>
---
 meta/lib/oeqa/selftest/cases/fitimage.py | 43 ++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py 
b/meta/lib/oeqa/selftest/cases/fitimage.py
index c5c446dabf..6fe41b769f 100644
--- a/meta/lib/oeqa/selftest/cases/fitimage.py
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -2087,6 +2087,49 @@ UBOOT_FIT_HASH_ALG = "sha256"
         self._test_fitimage(bb_vars)
 
 
+    def test_sign_standalone_uboot_fit_image_conf(self):
+        """
+        Summary:     Check if U-Boot FIT image and Image Tree Source (its) are
+                     created and signed correctly when the FIT configuration
+                     is signed (SPL_SIGN_CONF = "1") instead of the individual
+                     images (SPL_SIGN_INDIVIDUAL = "0").
+        Expected:    1) U-Boot its and FIT image are built successfully
+                     2) The its file has a hash node in each image node, no
+                        image signature nodes, and a signature node in the
+                        configuration which covers the loadables and the fdt
+                     3) Dumping the FIT image shows hashes for the images and
+                        a signature for the configuration only
+                     4) The public key in the SPL DTB is required for "conf"
+                     5) SPL_MKIMAGE_SIGN_ARGS is passed to mkimage
+        Product:     oe-core
+        """
+        machine = self._get_machine_or_skip()
+        config = """
+# There's no U-boot defconfig with CONFIG_FIT_SIGNATURE yet, so we need at
+# least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set
+# Enable creation and signing of the U-Boot fitImage configuration
+UBOOT_FITIMAGE_ENABLE = "1"
+SPL_SIGN_ENABLE = "1"
+SPL_SIGN_CONF = "1"
+SPL_SIGN_INDIVIDUAL = "0"
+SPL_SIGN_KEYNAME = "spl-conf-oe-selftest"
+SPL_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
+UBOOT_ENTRYPOINT  = "0x80000000"
+UBOOT_LOADADDRESS = "0x80000000"
+UBOOT_DTB_LOADADDRESS = "0x82000000"
+SPL_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
+SPL_MKIMAGE_SIGN_ARGS = "-c 'a smart U-Boot conf comment'"
+UBOOT_EXTLINUX = "0"
+UBOOT_FIT_GENERATE_KEYS = "1"
+UBOOT_FIT_HASH_ALG = "sha256"
+"""
+        config = FitImageTestCase._config_add_machine_settings(config, 
machine, keys=["UBOOT_MACHINE", "SPL_BINARY", "UBOOT_DTB_BINARY", "UBOOT_ARCH"])
+        config = self._require_machine_capability(config, machine, 
'_cap_spl_dtb')
+        self.write_config(config)
+        bb_vars = self._fit_get_bb_vars()
+        self._test_fitimage(bb_vars)
+
+
     def test_sign_cascaded_uboot_fit_image(self):
         """
         Summary:     Check if U-Boot FIT image and Image Tree Source (its) are
-- 
2.56.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#248625): 
https://lists.openembedded.org/g/openembedded-core/message/248625
Mute This Topic: https://lists.openembedded.org/mt/121930804/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to