Skip to content

image-fit-sig: bind required image keys and honour required-mode

anon87111 u-boot 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 4 repliesIn review
  2. v21 patch 1 replySuperseded
  3. v11 patch 1 replySuperseded

Changes in v3 from the cover letter

- add required-mode support on the image gate, default "all" (Simon Glass)
- add a regression test plus the prod hinted image fixture (Simon Glass)
- rebase from next onto main, which carries the ecdsa test rework

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3image-fit-sig: bind a required image key to its own verificationboot/image-fit-sig.c+2 -11 reply
2/3image-fit-sig: honour required-mode on the image gateboot/image-fit-sig.c doc/usage/fit/signature.rst+35 -101 reply
3/3test: vboot: cover required image keystest/py/tests/test_vboot.py test/py/tests/vboot/sign-images-sha256-rsa2048-prod.its+117 -231 reply

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchSimon Glass
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] image-fit-sig: bind required image keys and honour required-mode

A key marked required = "image" in the control FDT is never bound to its own verification. fit_image_verify_required_sigs() passes each required key's node offset to fit_image_verify_sig(), which ignores it and calls fit_image_check_sig() with required_keynode set to -1, documented in tree as "any signature will do". Every required key iteration is then satisfied by any signature verifying under any key in the FDT, so two keys marked required = "image" collapse to one.

Patch 1 binds the key. Patch 2 adds required-mode on the image gate so the two gates behave the same way, defaulting to "all". Patch 3 adds the fixture and the regression test.

Changes in v3:
- add required-mode support on the image gate, default "all" (Simon Glass)
- add a regression test plus the prod hinted image fixture (Simon Glass)
- rebase from next onto main, which carries the ecdsa test rework

Changes in v2:
- add a Fixes tag (Yao Zi)
- move coordination context below the line and trim the commit message (Yao Zi)
---
On the anonymity question from the v2 review: pseudonymous rather than anonymous. anon87111 is a stable identity and reachable at this address.

Verification, against main at 32eb8bb43b:

38 passed, 0 failed in the vboot suite. sha256-required-image passes with patch 1 applied.
With patch 1 reverted and patches 2 and 3 kept, it fails on the run_bootm(boots=False) oracle, so the test does catch the defect:
AssertionError: assert 'sandbox: continuing, as we cannot run' not in
sha256-pss-required and sha256-pss-pad-required still pass, so the configuration gate is unchanged by patch 2.

Why patch 3 adds a fixture rather than reusing the existing ones. All nine in tree sign-images-*.its hint "dev", and sign-configs-sha256-rsa2048-pss-prod.its is the only prod hinted file in the tree. mkimage -g cannot redirect a hint the node already carries:
tools/image-host.c reads FIT_KEY_HINT from the node at four sites and the -g fallback fires only when the node has no hint. So two keys both marked required = "image" cannot be produced from the existing fixtures by any flag.

Based on main rather than next. next is an ancestor of main and 316 commits behind it, so it is not the development tip.

Separate from "[PATCH 0/2] image-fit-sig: close the image-signature fail-open gate", which is a control FDT with no /signature node at all. Neither fix covers the other. Also separate from "[PATCH v10 0/7] Improve FIT signature handling" [1], which is the configuration gate and is not landed anywhere as of today.

[1] https://lore.kernel.org/u-boot/[email protected]/

anon87111 (3):
image-fit-sig: bind a required image key to its own verification
image-fit-sig: honour required-mode on the image gate
test: vboot: cover required image keys

 boot/image-fit-sig.c                          | 35 ++++++-
 doc/usage/fit/signature.rst                   | 13 +--
 test/py/tests/test_vboot.py                   | 98 ++++++++++++++-----
 .../vboot/sign-images-sha256-rsa2048-prod.its | 42 ++++++++
 4 files changed, 154 insertions(+), 34 deletions(-)
 create mode 100644 test/py/tests/vboot/sign-images-sha256-rsa2048-prod.its
Signature · 1 line
2.53.0