image-fit-sig: close the image-signature fail-open gate
cover image-fit-sig: close the image-signature fail-open gate
fit_image_verify_required_sigs() returns success when the U-Boot control devicetree has no "/signature" node, so a FIT whose image signatures are absent, malformed or invalid verifies anyway and the only indication is a debug() call which a normal build compiles out. I reported this on the list on 2026-09-07 as "[SECURITY] FIT signature enforcement fails open when the control DTB has no /signature node".
Ludwig Nussel's "Improve FIT signature handling" closes the same fail-open condition on the configuration gate with FIT_REQUIRE_CONFIG_SIGS. It does not touch the image gate, which has its own early return in a different function. This series adds the matching option for that gate, FIT_REQUIRE_IMAGE_SIGS, along with SPL_FIT_REQUIRE_IMAGE_SIGS, both defaulting to n, and a test/py case covering the missing-node path.
1/2 also raises the missing-node report from debug() to log_warning(), once per boot. Ludwig's configuration gate deliberately keeps debug() after Jonas Karlman pointed out that Rockchip enables FIT_SIGNATURE for image hash integrity alone and has no "/signature" node by design. The commit message of 1/2 explains why this gate diverges. Jonas is on Cc.
Based on next at 9e002445cd0d with Ludwig's v10 applied on top, following Tom's request on the v9 thread on 2026-09-16, "Please make sure v10 is based on the current next branch". v10 is at
https://lore.kernel.org/u-boot/[email protected]/
and its seven patches are listed as prerequisite-patch-id below. Note that the series does not apply to main: v10 4/7 depends on f252d228be ("tools:
fit: sign all config image references"), which is on next only.
checkpatch warns on a 119-character line in patch 1; it is a verbatim console transcript and re-wrapping it would misrepresent what the binary printed.
Eva Crystal (2):
image-fit-sig: fail when the control FDT has no /signature node
test: vboot: add coverage for a control FDT with no /signature node
boot/Kconfig | 34 +++++++++++ boot/image-fit-sig.c | 15 ++++- test/py/tests/test_vboot.py | 109 ++++++++++++++++++++++++++++++++++++ tools/mkimage.h | 1 + 4 files changed, 157 insertions(+), 2 deletions(-)
base-commit: 9e002445cd0d47d3965312f12e97a18e1ed8bd53
prerequisite-patch-id: 538dac9ee272034842d8a60d8df4f8b070018d33
prerequisite-patch-id: 5fa9f72555e76e6c88a57610b4c1d802408e1989
prerequisite-patch-id: e8d9d6c807dd9998e7f666dd283838e58ae54a7f
prerequisite-patch-id: 99c40b0d120a323d736144ed1e918d61076d3ddd
prerequisite-patch-id: 6089c7c67ff501e18182647ca27e5a111bbd5247
prerequisite-patch-id: c30e2a1afe9372416f5af90a2e6eff1a181e06af
prerequisite-patch-id: 1cdb386dab84419340acfea28362cb56e9a60cd4
Signature · 1 line
2.53.0
PATCH 1/2 image-fit-sig: fail when the control FDT has no /signature node
fit_image_verify_required_sigs() looks up the "/signature" node of the U-Boot control devicetree to work out which keys are marked required. When that node is absent it sets *no_sigsp and returns 0, so every caller treats the image as not requiring signatures. Nothing downstream can fail it after that: a FIT whose signatures are absent, malformed or invalid verifies successfully, and the only indication is a debug() call, which is compiled out of a normal build.
Against a control devicetree holding no "/signature" node at all, and a FIT whose configuration signature carries no "value", an unpatched build reports both images as verified:
## Checking hash(es) for FIT Image at 10400100 ...
Hash(es) for Image 0 (kernel): sha256+ OK Hash(es) for Image 1 (fdt-1): sha256+ OK
That '+' is fit_image_verify_with_data() reporting the signature as verified, on a board holding no keys whatsoever.
Add FIT_REQUIRE_IMAGE_SIGS, which turns a missing "/signature" node into a verification failure on this gate, and report the missing node with log_warning() so that the condition is no longer silent. With CONFIG_FIT_REQUIRE_IMAGE_SIGS=y the same image is refused:
## Checking hash(es) for FIT Image at 10400100 ...
Hash(es) for Image 0 (kernel): fit_image_verify_required_sigs() No signature node in control FDT: FDT_ERR_NOTFOUND
error!
Unable to verify required signature for '' hash node in 'kernel' image node
Bad hash in FIT image!
The adjacent configuration gate in fit_config_verify_required_keys() reports the same missing node with debug(), after Jonas Karlman objected that a verbose error is wrong on a Rockchip board which enables FIT_SIGNATURE for image hashes alone and has no /signature node by design. This gate keeps log_warning() for a reason specific to the image side. Under bootm the refusal surfaces as Bad Data Hash, indistinguishable from a corrupt image, and nothing in this function can tell an intentional hash-only configuration from a control FDT that lost its /signature node, so a silent return withholds the signal from exactly the case this patch exists for. The message fires once per boot rather than once per image, the level is LOGL_WARNING rather than an error, and CONFIG_LOGLEVEL suppresses it for boards which do not want it. On evb-rk3568_defconfig the shipped CONFIG_SPL_LOGLEVEL is 4, so on that board at its default configuration this message appears once in SPL.
That same case is why enforcement is a separate option which defaults to n. Setups which enable FIT_SIGNATURE only for image integrity, and which legitimately carry no keys, must keep booting exactly as before, so failing the gate is opt-in.
Measured on sandbox with test/py, running the vboot tests:
option at its default (not set): 32 passed, 0 failed CONFIG_FIT_REQUIRE_IMAGE_SIGS=y: 19 passed, 13 failed
The 32 are the 31 pre-existing vboot tests, which all pass on an unpatched build of the same tree, plus the one added by 2/2; the default configuration is unchanged. The 13 are by design, not a defect:test_vboot.py boots an unsigned-images FIT against a key-less devicetree and asserts that it boots, which is precisely the contract this option withdraws.
boot/image-fit-sig.c is also built into mkimage and fit_check_sign, where <log.h> is not included. tools/mkimage.h already shims log_debug() onto debug(); log_warning() is shimmed there the same way, so host tool output is unchanged.
Not tested:
- SPL: compile coverage only, on evb-rk3568_defconfig with CONFIG_SPL_FIT_SIGNATURE=y and CONFIG_SPL_FIT_REQUIRE_IMAGE_SIGS=y. spl/boot/image-fit-sig.o compiles and spl/u-boot-spl links with no warnings, and the gate's message string is present in the SPL binary and absent without the patch. No SPL image was booted, so there is no SPL runtime coverage.
- Sandbox only, on x86-64. No signed-boot hardware.
- Jonas's Rockchip setup was not reproduced.
No Fixes: tag. The early return is original behaviour rather than a regression. The oldest commit touching it in this path is commit b983cc2da0ba ("lib: rsa: decouple rsa from FIT image verification"), which moves the code from common/image-sig.c to common/image-fit-sig.c rather than introducing it.
--- boot/Kconfig | 34 ++++++++++++++++++++++++++++++++++ boot/image-fit-sig.c | 15 +++++++++++++-- tools/mkimage.h | 1 + 3 files changed, 48 insertions(+), 2 deletions(-)
boot/Kconfig +34 -0
@@ -154,6 +154,32 @@ config FIT_REQUIRE_CONFIG_SIGS need to reuse the same u-boot binary in setups without keys or rely on image node only signatures. +config FIT_REQUIRE_IMAGE_SIGS + bool "Fail image verification when the control FDT has no /signature node" + depends on FIT_SIGNATURE + help + fit_image_verify_required_sigs() looks up the "/signature" node of + the U-Boot control devicetree to work out which keys are marked + required. When that node is absent it returns success, so no image + signature can ever be required: a FIT image whose signatures are + absent, malformed or invalid verifies successfully. + + Enable this option to treat a missing "/signature" node as an image + verification failure instead. + + The missing node is reported once per boot with log_warning(), + whether or not this option is enabled, so the condition is visible + at the default loglevel and can be suppressed through + CONFIG_LOGLEVEL. + + This option covers image signatures only. Signatures on the FIT + configuration nodes are checked by a separate gate which this + option does not affect. + + Say N if the same U-Boot binary must also run in setups which carry + no keys, or which enable FIT_SIGNATURE only for image hash + integrity checking rather than for signature enforcement. + config FIT_SIGNATURE_MAX_SIZE hex "Max size of signed FIT structures" depends on FIT_SIGNATURE
@@ -281,6 +307,14 @@ config SPL_FIT_REQUIRE_CONFIG_SIGS depends on SPL_FIT_SIGNATURE select FIT_REQUIRE_CONFIG_SIGS +config SPL_FIT_REQUIRE_IMAGE_SIGS + bool "Fail image verification when the SPL control FDT has no /signature node" + depends on SPL_FIT_SIGNATURE + select FIT_REQUIRE_IMAGE_SIGS + help + Enable the FIT_REQUIRE_IMAGE_SIGS behaviour in SPL. See the help text + of FIT_REQUIRE_IMAGE_SIGS for details. + config SPL_LOAD_FIT bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)" depends on SPL
boot/image-fit-sig.c +13 -2
@@ -188,6 +188,7 @@ int fit_image_verify_required_sigs(const void *fit, int image_noffset, const char *data, size_t size, const void *key_blob, int *no_sigsp) { + static bool reported;int verify_count =0 ;int noffset;int key_node;
@@ -201,8 +202,18 @@ int fit_image_verify_required_sigs(const void *fit, int image_noffset, *no_sigsp =1 ; key_node =fdt_subnode_offset (key_blob,0 ,FIT_SIG_NODENAME );if (key_node <0 ) { -debug ("%s: No signature node found: %s\n" , __func__, -fdt_strerror (key_node)); +/* +* The control FDT is a property of the board rather than of +* the image, so report this once per boot instead of once +* per image. +*/ +if (!reported) { + reported = true; +log_warning ("No signature node in control FDT: %s\n" , +fdt_strerror (key_node)); + } +if (CONFIG_IS_ENABLED (FIT_REQUIRE_IMAGE_SIGS )) +return -EPERM ;return 0 ; }
tools/mkimage.h +1 -0
@@ -32,6 +32,7 @@ #define log_debug(fmt, args...) debug(fmt, ##args) #define log_info(fmt, args...) printf(fmt, ##args) +#define log_warning(fmt, args...) debug(fmt, ##args)/* * Use stdout rather than stderr so error messages stay * interleaved with normal output in the order produced.
Signature · 1 line
2.53.0
Re: [PATCH 1/2] image-fit-sig: fail when the control FDT has no /signature node
Hi Eva,
Quoted 32 lines · Eva Crystal
image-fit-sig: fail when the control FDT has no /signature node
fit_image_verify_required_sigs()looks up the "/signature" node of the U-Boot control devicetree to work out which keys are marked required. When that node is absent it sets*no_sigspand returns 0, so every caller treats the image as not requiring signatures. Nothing downstream can fail it after that: a FIT whose signatures are absent, malformed or invalid verifies successfully, and the only indication is adebug()call, which is compiled out of a normal build.Against a control devicetree holding no "/signature" node at all, and a FIT whose configuration signature carries no "value", an unpatched build reports both images as verified:
## Checking hash(es) for FIT Image at 10400100 ...
Hash(es) for Image 0 (kernel): sha256+ OK Hash(es) for Image 1 (fdt-1): sha256+ OKThat '+' is
fit_image_verify_with_data()reporting the signature as verified, on a board holding no keys whatsoever.Add
FIT_REQUIRE_IMAGE_SIGS, which turns a missing "/signature" node into a verification failure on this gate, and report the missing node withlog_warning()so that the condition is no longer silent. WithCONFIG_FIT_REQUIRE_IMAGE_SIGS=ythe same image is refused:## Checking hash(es) for FIT Image at 10400100 ...
Hash(es) for Image 0 (kernel):fit_image_verify_required_sigs()No signature node in control FDT:FDT_ERR_NOTFOUND
error!
Unable to verify required signature for '' hash node in 'kernel' image node
Bad hash in FIT image!
Quoted 14 lines
The adjacent configuration gate in
fit_config_verify_required_keys()reports the same missing node withdebug(), after Jonas Karlman objected that a verbose error is wrong on a Rockchip board which enablesFIT_SIGNATUREfor image hashes alone and has no /signature node by design. This gate keepslog_warning()for a reason specific to the image side. Under bootm the refusal surfaces as Bad Data Hash, indistinguishable from a corrupt image, and nothing in this function can tell an intentional hash-only configuration from a control FDT that lost its /signature node, so a silent return withholds the signal from exactly the case this patch exists for. The message fires once per boot rather than once per image, the level isLOGL_WARNINGrather than an error, andCONFIG_LOGLEVELsuppresses it for boards which do not want it. On evb-rk3568_defconfig the shippedCONFIG_SPL_LOGLEVELis 4, so on that board at its default configuration this message appears once in SPL.
Not quite. CONFIG_LOGLEVEL only filters output at runtime when CONFIG_LOG is enabled. Without it, as with evb-rk3568_defconfig in both SPL and U-Boot proper, log() in include/log.h prints anything at or below LOGL_INFO with a plain printf(), whatever CONFIG_LOGLEVEL says. So the Rockchip boards Jonas mentioned would see this message in SPL and again in U-Boot proper, and cannot turn it off without enabling LOG. The help text makes the same claim, so please can you fix both.
Quoted 1 line
Measured on sandbox with test/py, running the vboot tests:
The commit message is very long. The test counts, the 'Not tested' list and the Fixes: discussion are useful for reviewers but belong below the --- line or in the cover letter. The paragraph answering Jonas could be cut to a couple of sentences. Please can you trim it to the problem, the new option and the reason for the warning?
boot/Kconfig config SPL_FIT_SIGNATURE_MAX_SIZE · line 288
Quoted 13 lines
[...]
boot/Kconfig | 34 ++++++++++++++++++++++++++++++++++
boot/image-fit-sig.c | 15 +++++++++++++-- tools/mkimage.h | 1 + 3 files changed, 48 insertions(+), 2 deletions(-)boot/Kconfig +4
-0@@ -259,6 +285,14 @@ config SPL_FIT_SIGNATURE_MAX_SIZE +config SPL_FIT_REQUIRE_IMAGE_SIGS + bool "Fail image verification when the SPL control FDT has no /signature node" + depends on SPL_FIT_SIGNATURE + select FIT_REQUIRE_IMAGE_SIGS
The select seems wrong. In SPL, CONFIG_IS_ENABLED(FIT_REQUIRE_IMAGE_SIGS) checks CONFIG_SPL_FIT_REQUIRE_IMAGE_SIGS, so the SPL option already works by itself. The select only forces enforcement on in U-Boot proper as well, so a board cannot enforce in SPL alone. Please drop it so the two options are independent, as with the other SPL_ variants.
boot/image-fit-sig.c int fit_image_verify_required_sigs(const void *fit, int image_noffset, · line 209
Quoted 10 lines
boot/image-fit-sig.c +8
-0@@ -201,8 +202,18 @@ int fit_image_verify_required_sigs(const void *fit, int image_noffset, +if (!reported) { + reported = true; +log_warning ("No signature node in control FDT: %s\n" , +fdt_strerror (key_node)); + } +if (CONFIG_IS_ENABLED (FIT_REQUIRE_IMAGE_SIGS )) +return -EPERM ; +return 0 ;
I'm not keen on the warning when the option is off. Without FIT_REQUIRE_IMAGE_SIGS, a missing node is the documented hash-only setup, which this function cannot tell apart from a misconfigured board, so the warning is noise for every such board, as Jonas said for the configuration gate. Also, the static 'reported' flag adds state to library code just to rate-limit one message, and when enforcement is on, the second and later images fail with only 'error!' and no reason.
I suggest log_err() on the enforcing path, with no rate-limiting since it is fatal anyway, and debug() otherwise to match fit_config_verify_required_keys(). That also removes the need for the mkimage.h shim. If you want people to know about the fail-open case, the Kconfig help and the docs are a better place for that. What do you think?
Regards,
Simon
PATCH 2/2 test: vboot: add coverage for a control FDT with no /signature node
In reply to Eva CrystalBuild a control devicetree with no "/signature" node and an unsigned FIT, then check that the boot is refused when CONFIG_FIT_REQUIRE_IMAGE_SIGS is enabled, and that the historical fail-open behaviour is kept when it is not.
The missing node is reported whether or not the option is enabled, so the warning is expected in both cases and only the boot outcome differs.
--- test/py/tests/test_vboot.py | 109 ++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+)
test/py/tests/test_vboot.py +109 -0
@@ -950,3 +950,112 @@ def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): # keys created in test_vboot test test_add_pubkey(sha_algo, padding, sign_options) + + [email protected]('sandbox') [email protected]('fit_signature') [email protected]('dtc') [email protected]('fdtget') [email protected]('openssl') +def test_vboot_no_sig_node(ubman): + """Test a control FDT which contains no /signature node. + + fit_image_verify_required_sigs() looks up the "/signature" node of the + U-Boot control devicetree to work out which keys are marked required. + When that node is absent there are no required keys, so nothing + downstream can fail the image and a FIT whose signatures are absent or + invalid verifies successfully. + + The missing node is reported with log_warning() whether or not + CONFIG_FIT_REQUIRE_IMAGE_SIGS is enabled, so the warning is expected in + both cases and only the boot outcome differs. With the option the image + gate fails and the boot must be refused. Without it the historical + fail-open behaviour is kept, so that boards using FIT_SIGNATURE only for + image hash integrity keep booting. + + This works using sandbox only as it needs to control the device tree + used by U-Boot. + """ + sha_algo = 'sha256' + + def run_bootm(test_type, expect_strings, boots): + """Run a 'bootm' command in U-Boot. + + Args: + test_type: A string identifying the test type. + expect_strings: A list of strings which are all expected in the + output. + boots: True if the image is expected to boot, False if the boot + is expected to be refused. + """ + ubman.restart_uboot() + with ubman.log.section('Verified boot %s %s' % (sha_algo, test_type)): + output = ubman.run_command_list( + ['host load hostfs - 100 %s' % fit, + 'fdt addr 100', + 'bootm 100']) + text = ''.join(output) + for expect_string in expect_strings: + assert expect_string in text + if boots: + assert 'sandbox: continuing, as we cannot run' in text + else: + assert 'sandbox: continuing, as we cannot run' not in text + + tmpdir = os.path.join(ubman.config.result_dir, 'no-sig-node') + '/' + if not os.path.exists(tmpdir): + os.mkdir(tmpdir) + datadir = ubman.config.source_dir + '/test/py/tests/vboot/' + fit = '%stest.fit' % tmpdir + mkimage = ubman.config.build_dir + '/tools/mkimage' + dtc_args = '-I dts -O dtb -i %s' % tmpdir + dtb = '%ssandbox-u-boot.dtb' % tmpdir + + bcfg = ubman.config.buildconfig + require_image_sigs = bcfg.get('config_fit_require_image_sigs', False) + + # Create a kernel image filled with zeroes + with open('%stest-kernel.bin' % tmpdir, 'wb') as fd: + fd.write(500 * b'\0') + + # We need to use our own device tree file. Remember to restore it + # afterwards. + old_dtb = ubman.config.dtb + try: + ubman.config.dtb = dtb + + # Compile the control devicetree. sandbox-u-boot.dts holds no keys, + # and mkimage is deliberately not asked to add any, so the resulting + # blob has no /signature node at all. + dtc('sandbox-kernel.dts', ubman, dtc_args, datadir, tmpdir, dtb) + dtc('sandbox-u-boot.dts', ubman, dtc_args, datadir, tmpdir, dtb) + + # Confirm the premise of the test: no /signature node is present. + out = utils.run_and_log(ubman, 'fdtget -l %s /' % dtb) + assert 'signature' not in out + + # Build a FIT whose configuration signature has no 'value', i.e. it + # is unsigned. + ubman.log.action('%s: Test unsigned FIT with no keys in control FDT' + % sha_algo) + make_fit('sign-configs-%s.its' % sha_algo, ubman, mkimage, dtc_args, + datadir, fit) + + # The missing "/signature" node is reported either way, so the + # warning is expected in both branches and only the outcome differs. + warning = 'No signature node in control FDT' + if require_image_sigs: + # The image gate fails and the boot is refused. + run_bootm('no signature node', + [warning, 'Unable to verify required signature'], + False) + else: + # Fail-open is kept: the image still verifies and the board + # boots, but the condition is no longer silent. + run_bootm('no signature node', + [warning, 'Verifying Hash Integrity'], + True) + finally: + # Go back to the original U-Boot with the correct dtb. + ubman.config.dtb = old_dtb + ubman.restart_uboot()
Signature · 1 line
2.53.0
Re: [PATCH 2/2] test: vboot: add coverage for a control FDT with no /signature node
Hi Eva,
Quoted 19 lines · Eva Crystal
test: vboot: add coverage for a control FDT with no /signature node
Build a control devicetree with no "/signature" node and an unsigned FIT, then check that the boot is refused when
CONFIG_FIT_REQUIRE_IMAGE_SIGSis enabled, and that the historical fail-open behaviour is kept when it is not.The missing node is reported whether or not the option is enabled, so the warning is expected in both cases and only the boot outcome differs.
Cc Jonas Karlman <[email protected]>Signed-off-by Eva Crystal <[email protected]>
test/py/tests/test_vboot.py| 109 ++++++++++++++++++++++++++++++++++++++++++++1 file changed, 109 insertions(+)
test/py/tests/test_vboot.py def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): · line 854
Quoted 2 lines
test/py/tests/test_vboot.py +2
-0@@ -853,3 +853,112 @@ def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): + bcfg = ubman.config.buildconfig + require_image_sigs = bcfg.get('config_fit_require_image_sigs', False)
No defconfig enables FIT_REQUIRE_IMAGE_SIGS, so CI only runs the fail-open branch, never the one that tests the new option. Also, as 1/2 notes, enabling the option on sandbox makes 13 existing test_vboot cases fail, so nobody can turn it on without the suite going red. Please can you deal with both? One approach is to add @pytest.mark.notbuildconfigspec('fit_require_image_sigs') to test_vboot(), or have it expect the refusal where relevant, then enable the option in a sandbox config that CI builds (e.g. sandbox_flattree or a new small defconfig) or a CI job, so the refused path runs. Without that, the most important half of this test is dead code.
test/py/tests/test_vboot.py def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): · line 858
Quoted 8 lines
test/py/tests/test_vboot.py +6
-0@@ -853,3 +853,112 @@ def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): + else: + # Fail-open is kept: the image still verifies and the board + # boots, but the condition is no longer silent. + run_bootm('no signature node', + [warning, 'Verifying Hash Integrity'], + True)
test_vboot() already covers this case: test_with_algo() builds a fresh sandbox-u-boot.dtb with no keys, builds sign-configs-*.its and checks that 'unsigned config' boots. The only new thing here is the warning check. I suspect it would be simpler to add the warning assertion (and the refusal expectation, per the comment above) to that existing run_bootm() call, rather than adding a near-copy of the setup and of run_bootm(). What do you think?
Also, 'Verifying Hash Integrity' is printed before any check is done, so it shows nothing here. If you keep this, 'sha256+ OK' would at least pin down the output you describe in patch 1.
test/py/tests/test_vboot.py def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): · line 855
Quoted 5 lines
test/py/tests/test_vboot.py +3
-0@@ -853,3 +853,112 @@ def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): [email protected]('fdtget') [email protected]('openssl') +def test_vboot_no_sig_node(ubman):
No keys are created here, so openssl isn't needed. Please drop that marker.
test/py/tests/test_vboot.py def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): · line 855
Quoted 5 lines
test/py/tests/test_vboot.py +3
-0@@ -853,3 +853,112 @@ def test_fdt_add_pubkey(ubman, name, sha_algo, padding, sign_options, algo_arg): + run_bootm('no signature node', + [warning, 'Unable to verify required signature'], + False)
The full message here is "Unable to verify required signature for '' hash node in 'kernel' image node". The empty name is misleading, since no hash node is involved when the control FDT has no /signature node. The message comes from 1/2, so it may be worth fixing there. It would also be good to assert that the warning appears only once, since 'once per boot' is part of the contract in 1/2. The FIT has two images, so a count check would catch a regression.
Regards,
Simon
Hi Eva,
Quoted 6 lines · Eva Crystal
Ludwig Nussel's "Improve FIT signature handling" closes the same fail-open condition on the configuration gate with
FIT_REQUIRE_CONFIG_SIGS. It does not touch the image gate, which has its own early return in a different function. This series adds the matching option for that gate,FIT_REQUIRE_IMAGE_SIGS, along withSPL_FIT_REQUIRE_IMAGE_SIGS, both defaulting to n
This leaves two options (four, counting SPL) for what a board maintainer sees as one decision: 'this board requires signed FITs'. I cannot think of a sensible setup where one gate fails closed while the other stays open, so a board that enables only one is probably wrong without knowing it. Please can you work with Ludwig so that a single option controls both gates, perhaps his FIT_REQUIRE_CONFIG_SIGS renamed to something broader? The easiest way may be for this patch to go into his series. What do you think?
There is also no documentation update. doc/usage/fit/signature.rst describes required keys and how the control FDT is used, so it should explain what happens when there is no /signature node and how to make that fail closed.
Quoted 3 lines
Note that
the series does not apply to main: v10 4/7 depends onf252d228be("tools:
fit: sign all config image references"), which is on next only.
Just to check: both patches apply cleanly to next at 9e002445cd0d without Ludwig's v10, and FWICT nothing in them depends on his code. If the dependency is only conceptual, please say so in the cover letter, so maintainers know the order in which the two series land does not matter.
Regards,
Simon
Hi Simon,
Thanks for the review, here and on 1/2. I agree with your points on 1/2: the CONFIG_LOGLEVEL wording is wrong, the select is redundant, and the test overlaps test_vboot.py.
Agreed that one option should control both gates. Rather than posting a v2 of this series, I think the image gate is best folded into Ludwig's series, together with the doc/usage/fit/signature.rst update you asked for.
On the dependency: the patches do not apply to bare next at 9e002445cd0d, 1/2 conflicts in boot/Kconfig and tools/mkimage.h with Ludwig's v10. The conflict is textual, not functional.
Ludwig, if you take the image gate (fit_image_verify_required_sigs() returning success when the control FDT has no /signature node, reported on Sep 7) into your series, I would appreciate a Reported-by:
Eva Crystal <[email protected]> on that patch.
Eva Crystal (0xiviel)
XSource Security
https://xsourcesec.com
Quoted 9 lines · Simon Glass
Quoted 6 lines · Eva Crystal
Ludwig Nussel's "Improve FIT signature handling" closes the same fail-open condition on the configuration gate with
FIT_REQUIRE_CONFIG_SIGS. It does not touch the image gate, which has its own early return in a different function. This series adds the matching option for that gate,FIT_REQUIRE_IMAGE_SIGS, along withSPL_FIT_REQUIRE_IMAGE_SIGS, both defaulting to n
Quoted 8 lines
This leaves two options (four, counting SPL) for what a board maintainer sees as one decision: 'this board requires signed FITs'. I cannot think of a sensible setup where one gate fails closed while the other stays open, so a board that enables only one is probably wrong without knowing it. Please can you work with Ludwig so that a single option controls both gates, perhaps his
FIT_REQUIRE_CONFIG_SIGSrenamed to something broader? The easiest way may be for this patch to go into his series. What do you think?
IIUC the config signature verification logic includes the image hashes and does run the image verification logic to check the hashes as well. So if we enforce config signatures, enforcing image signatures as well would be redundant and surprising.
So the code would have to enforce config signatures and disable checking image signatures when loading images via the config path. At the same time it has to enforce image signatures when loading images directly, without going through the config loading. (Or don't allow direct image loading when enforcing config signatures).
At this point I cannot put the effort to implement that extra logic though. I can remove the config sig enforcement stuff from my series if someone want's to do it though.
Not sure it makes sense to invest too much here anyway.
Time would be better spent on https://github.com/open-source-firmware/flat-image-tree/pull/44 to pave the way for whole-fit signing in a simpler way IMO.
cu
Ludwig
Signature · 3 lines
Ludwig Nussel Siemens AG www.siemens.com
Quoted 3 lines · Ludwig Nussel
At this point I cannot put the effort to implement that extra logic though. I can remove the config sig enforcement stuff from my series if someone want's to do it though.
Thanks Ludwig, that makes sense. I can't take on the combined config/image logic either, so please keep FIT_REQUIRE_CONFIG_SIGS in your series as it is, since it already closes the common path.
I'm withdrawing my image-gate series. The image-signature fail-open stays documented in this thread for whoever picks it up later, possibly together with the whole-FIT signing work.
Eva Crystal (0xiviel)
XSource Security
https://xsourcesec.com