mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 10:39:08 +00:00
Prevent a buffer overflow in mkimage when signing with SHA256
Due to the FIT_MAX_HASH_LEN constant not having been updated to support SHA256 signatures one will always see a buffer overflow in fit_image_process_hash when signing images that use this larger hash. This is exposed by vboot_test.sh. Signed-off-by: Michael van der Westhuizen <michael@smart-africa.com> Acked-by: Simon Glass <sjg@chromium.org> [trini: Rework a bit so move the exportable parts of hash.h outside of !USE_HOSTCC and only need that as a new include to image.h] Signed-off-by: Tom Rini <trini@ti.com>
This commit is contained in:
parent
d835e91d56
commit
1de7bb4f27
2 changed files with 15 additions and 12 deletions
|
@ -45,6 +45,7 @@ struct lmb;
|
|||
#endif /* USE_HOSTCC */
|
||||
|
||||
#if defined(CONFIG_FIT)
|
||||
#include <hash.h>
|
||||
#include <libfdt.h>
|
||||
#include <fdt_support.h>
|
||||
# ifdef CONFIG_SPL_BUILD
|
||||
|
@ -706,7 +707,7 @@ int bootz_setup(ulong image, ulong *start, ulong *end);
|
|||
#define FIT_FDT_PROP "fdt"
|
||||
#define FIT_DEFAULT_PROP "default"
|
||||
|
||||
#define FIT_MAX_HASH_LEN 20 /* max(crc32_len(4), sha1_len(20)) */
|
||||
#define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
|
||||
|
||||
/* cmdline argument format parsing */
|
||||
int fit_parse_conf(const char *spec, ulong addr_curr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue