mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Maik Otto <m.otto@phytec.de>
To: barebox@lists.infradead.org
Cc: Maik Otto <m.otto@phytec.de>
Subject: [PATCH] habv4: add the possibility to changing the signing area from Kconfig
Date: Tue, 10 Dec 2019 16:06:27 +0100	[thread overview]
Message-ID: <1575990387-9905-1-git-send-email-m.otto@phytec.de> (raw)

the whole barebox with mbr and partition table will be signed by default
add the possibility in the Kconfig to change from full signing to skip-mbr
and from-dcdofs

Signed-off-by: Maik Otto <m.otto@phytec.de>
---
 arch/arm/mach-imx/Kconfig                          | 26 ++++++++++++++++++++++
 arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h |  2 +-
 scripts/imx/imx.c                                  |  6 ++---
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 6e98e95..ca1e6f3 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -859,6 +859,32 @@ config HABV4_IMG_CRT_PEM
 
 endif
 
+if HABV4
+choice
+	prompt "Select type for signing area"
+	help
+	  select the signing area, which is checked from the HAB modul
+	  of the i.mx controller
+
+config HABV4_BLOCKS_TYPE_FULL
+	bool "complete barebox with mbr and partition table"
+
+config HABV4_BLOCKS_TYPE_FROM_DCDOFS
+	bool "signing area begins from dcdofs address"
+
+config HABV4_BLOCKS_TYPE_SKIP_MBR
+	bool "signing area begins after MBR"
+
+endchoice
+
+endif
+
+config HABV4_BLOCKS_TYPE
+	string
+	default skip-mbr if HABV4_BLOCKS_TYPE_SKIP_MBR
+	default from-dcdofs if HABV4_BLOCKS_TYPE_FROM_DCDOFS
+	default full
+
 config HABV3
 	tristate "HABv3 support"
 	select HAB
diff --git a/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h b/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h
index 5818879..60d3baf 100644
--- a/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h
+++ b/arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h
@@ -42,7 +42,7 @@ hab [Authenticate Data]
 /* verification key index in key store (2...4) */
 hab Verification index = 2
 
-hab_blocks
+hab_blocks CONFIG_HABV4_BLOCKS_TYPE
 
 hab_encrypt [Install Secret Key]
 hab_encrypt Verification index = 0
diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c
index b3e8d62..4a96d8d 100644
--- a/scripts/imx/imx.c
+++ b/scripts/imx/imx.c
@@ -365,17 +365,17 @@ static int do_hab_blocks(struct config_data *data, int argc, char *argv[])
 			offset += PLUGIN_HDMI_SIZE;
 	}
 
-	if (!strcmp(type, "full")) {
+	if (strstr(type, "full")) {
 		ret = asprintf(&str, "Blocks = 0x%08x 0x%08x 0x%08x \"%s\"\n",
 			       data->image_load_addr, offset, signed_size,
 			       data->outfile);
-	} else if (!strcmp(type, "from-dcdofs")) {
+	} else if (strstr(type, "from-dcdofs")) {
 		ret = asprintf(&str, "Blocks = 0x%08x 0x%x %d \"%s\"\n",
 			       data->image_load_addr + data->image_dcd_offset,
 			       data->image_dcd_offset,
 			       signed_size - data->image_dcd_offset,
 			       data->outfile);
-	} else if (!strcmp(type, "skip-mbr")) {
+	} else if (strstr(type, "skip-mbr")) {
 		ret = asprintf(&str,
 			       "Blocks = 0x%08x 0 440 \"%s\", \\\n"
 			       "         0x%08x 512 %d \"%s\"\n",
-- 
2.7.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2019-12-10 15:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 15:06 Maik Otto [this message]
2019-12-10 15:21 ` Sascha Hauer
2019-12-11  7:57   ` Maik Otto
2019-12-11  8:15     ` Sascha Hauer
2019-12-11  9:10       ` Maik Otto
2019-12-13  8:25         ` Sascha Hauer

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=1575990387-9905-1-git-send-email-m.otto@phytec.de \
    --to=m.otto@phytec.de \
    --cc=barebox@lists.infradead.org \
    /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