[PATCH v2 0/5] fit: cipher: bounds checks on the ciphered image path
Pranav Rajendran <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
Changes in v2:
- Kept patches 1-3 as separate changes per Simon's request (distinct
Fixes: targets, easier to back-port independently).
- Patch 2: documented the new -EINVAL return in the kernel-doc block,
per Simon's review comment.
- Added patch 5: a fit_cipher sandbox test suite covering all three
defects (non-block-aligned 'data', a truncated
'data-size-unciphered', and an oversized unciphered size), per
Simon's request for regression tests since these are security fixes.
- Added patch 4 as a prerequisite for patch 5: <u-boot/aes.h> defines
the disabled-config cipher stubs with external linkage, so a second
translation unit including it (the new test file) failed to link
until those stubs were made static inline. Found while writing the
test, not previously reported.
Patches 1 and 3 are unchanged from v1 and carry Simon's Reviewed-by.
checkpatch-clean, builds for sandbox (CONFIG_FIT_CIPHER=y) with no new
warnings at W=1, and the new fit_cipher suite plus the existing
lib_test_aes and fit_verity suites pass under `ut`.
Pranav Rajendran (5):
lib: aes: reject a ciphertext length that is not a whole number of
blocks
image-fit: check the length of the data-size-unciphered property
lib: aes: reject an unciphered size larger than the ciphertext
include: u-boot: aes: make disabled cipher stubs static inline
test: boot: add regression tests for the FIT cipher bounds checks
boot/image-fit.c | 7 ++-
include/u-boot/aes.h | 17 ++++---
lib/aes/aes-decrypt.c | 21 +++++++-
test/boot/Makefile | 1 +
test/boot/fit_cipher.c | 113 +++++++++++++++++++++++++++++++++++++++++
test/cmd_ut.c | 2 +
6 files changed, 151 insertions(+), 10 deletions(-)
create mode 100644 test/boot/fit_cipher.c
--
2.50.1 (Apple Git-155)