public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Teddy Reed <teddy.reed@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC][PATCH] spl: vboot: Verify content before using load_addr
Date: Tue, 5 Jun 2018 21:08:57 -0400	[thread overview]
Message-ID: <20180605210857.688122cf3f44bbd0e5bfa152@gmail.com> (raw)

When using verified-boot in the SPL, the FIT content must be
verified before it can be used.

Currently the load_addr FIT property is read and used as input to
memcpy before the property is verified.

Signed-off-by: Teddy Reed <teddy.reed@gmail.com>
---
 common/spl/spl_fit.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 2321ebb0dde..a35c6092cee 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -244,6 +244,16 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 		src = (void *)data;
 	}
 
+#ifdef CONFIG_SPL_FIT_SIGNATURE
+	printf("## Checking hash(es) for Image %s ...\n",
+	       fit_get_name(fit, node, NULL));
+	ret = fit_image_verify_with_data(fit, node,
+					 (const void *)src, length);
+	printf("\n");
+	if (!ret)
+		return 1;
+#endif
+
 #ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS
 	board_fit_image_post_process(&src, &length);
 #endif
@@ -269,16 +279,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 		image_info->entry_point = fdt_getprop_u32(fit, node, "entry");
 	}
 
-#ifdef CONFIG_SPL_FIT_SIGNATURE
-	printf("## Checking hash(es) for Image %s ...\n",
-	       fit_get_name(fit, node, NULL));
-	ret = fit_image_verify_with_data(fit, node,
-					 (const void *)load_addr, length);
-	printf("\n");
-	return !ret;
-#else
 	return 0;
-#endif
 }
 
 static int spl_fit_append_fdt(struct spl_image_info *spl_image,
-- 
2.13.5

             reply	other threads:[~2018-06-06  1:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06  1:08 Teddy Reed [this message]
2018-06-06  8:35 ` [U-Boot] [RFC][PATCH] spl: vboot: Verify content before using load_addr Jun Nie
2018-06-06 15:32   ` Teddy Reed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180605210857.688122cf3f44bbd0e5bfa152@gmail.com \
    --to=teddy.reed@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox