blob: fed3c3dcb9a48f95f4814afa97d683affba02924 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 7346c1e192d63cd35f99c7e845e53c5d4d0bdc24 Mon Sep 17 00:00:00 2001
2From: Teddy Reed <teddy.reed@gmail.com>
3Date: Sat, 9 Jun 2018 11:45:20 -0400
4Subject: [PATCH] vboot: Do not use hashed-strings offset
5
6The hashed-strings signature property includes two uint32_t values.
7The first is unneeded as there should never be a start offset into the
8strings region. The second, the size, is needed because the added
9signature node appends to this region.
10
11See tools/image-host.c, where a static 0 value is used for the offset.
12
13Signed-off-by: Teddy Reed <teddy.reed@gmail.com>
14Reviewed-by: Simon Glass <sjg@chromium.org>
15
16Upstream-Status: Backport[http://git.denx.de/?p=u-boot.git;a=commit;
17 h=7346c1e192d63cd35f99c7e845e53c5d4d0bdc24]
18
19CVE: CVE-2018-1000205
20
21Signed-off-by: Changqing Li <changqing.li@windriver.com>
22---
23 common/image-sig.c | 7 +++++--
24 tools/image-host.c | 1 +
25 2 files changed, 6 insertions(+), 2 deletions(-)
26
27diff --git a/common/image-sig.c b/common/image-sig.c
28index 8d2fd10..5a269d3 100644
29--- a/common/image-sig.c
30+++ b/common/image-sig.c
31@@ -377,8 +377,11 @@ int fit_config_check_sig(const void *fit, int noffset, int required_keynode,
32 /* Add the strings */
33 strings = fdt_getprop(fit, noffset, "hashed-strings", NULL);
34 if (strings) {
35- fdt_regions[count].offset = fdt_off_dt_strings(fit) +
36- fdt32_to_cpu(strings[0]);
37+ /*
38+ * The strings region offset must be a static 0x0.
39+ * This is set in tool/image-host.c
40+ */
41+ fdt_regions[count].offset = fdt_off_dt_strings(fit);
42 fdt_regions[count].size = fdt32_to_cpu(strings[1]);
43 count++;
44 }
45diff --git a/tools/image-host.c b/tools/image-host.c
46index 8e43671..be2d59b 100644
47--- a/tools/image-host.c
48+++ b/tools/image-host.c
49@@ -135,6 +135,7 @@ static int fit_image_write_sig(void *fit, int noffset, uint8_t *value,
50
51 ret = fdt_setprop(fit, noffset, "hashed-nodes",
52 region_prop, region_proplen);
53+ /* This is a legacy offset, it is unused, and must remain 0. */
54 strdata[0] = 0;
55 strdata[1] = cpu_to_fdt32(string_size);
56 if (!ret) {
57--
582.7.4
59