Skip to contentSkip to conversation

habv4: imx change signing area from full to the executed image

PATCH Applied Maik Otto 2 participants 2 messages Jan 7, 2020 – Jan 8, 2020 Arm i.MX and Layerscape

lore
Share & tools
lore

Maik Otto

author
#0 lore raw

PATCH v3 1/1 habv4: imx change signing area from full to the executed image

the whole barebox with mbr and partition table were be signed by default. change the signing to the executed image without signing the mbr, partition table and header_gap by imx8mq
additional delete option full, from-dcdofs and skip-mbr

---
Changes in v3:
- change hardcoded 0x400 to data->image_dcd_offset
- delete offset_load_address
- delete offset_size
Changes in v2:
- change subject from habv4: add the possibility to changing the signing area from Kconfig to
- delete KConfig entries
- delete changes habv4-imx6-gencsf.h
- delete full, from-dcdofs and skip-mbr options

---
 scripts/imx/imx.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)
scripts/imx/imx.c +7 -24
index b3e8d62..acea5dd 100644
@@ -338,16 +338,11 @@ static int do_hab_blocks(struct config_data *data, int argc, char *argv[])
 	char *str;
 	int ret;
 	uint32_t signed_size = data->load_size;
-	uint32_t offset = 0;
+	uint32_t offset = data->image_dcd_offset;
 
 	if (!data->csf)
 		return -EINVAL;
 
-	if (argc < 2)
-		type = "full";
-	else
-		type = argv[1];
-
 	/*
 	 * In case of encrypted image we reduce signed area to beginning
 	 * of encrypted area.
@@ -359,31 +354,19 @@ static int do_hab_blocks(struct config_data *data, int argc, char *argv[])
 	 * Ensure we only sign the PBL for i.MX8MQ
 	 */
 	if (data->pbl_code_size && data->cpu_type == IMX_CPU_IMX8MQ) {
-		offset = data->header_gap;
+		offset += data->header_gap;
 		signed_size = roundup(data->pbl_code_size + HEADER_LEN, 0x1000);
 		if (data->signed_hdmi_firmware_file)
 			offset += PLUGIN_HDMI_SIZE;
 	}
 
-	if (!strcmp(type, "full")) {
+	if (signed_size > 0) {
 		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")) {
-		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")) {
-		ret = asprintf(&str,
-			       "Blocks = 0x%08x 0 440 \"%s\", \\\n"
-			       "         0x%08x 512 %d \"%s\"\n",
-			       data->image_load_addr, data->outfile,
-			       data->image_load_addr + 512,
-			       signed_size - 512, data->outfile);
+			data->image_load_addr + data->image_dcd_offset, offset,
+			signed_size - data->image_dcd_offset, data->outfile);
 	} else {
-		fprintf(stderr, "Invalid hab_blocks option: %s\n", type);
+		fprintf(stderr, "Invalid signed size area 0x%08x\n",
+			signed_size);
 		return -EINVAL;
 	}
 
Signature · 7 lines
2.7.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer Applied
#1 lore raw
Quoted 17 lines · Maik Otto

the whole barebox with mbr and partition table were be signed by default. change the signing to the executed image without signing the mbr, partition table and header_gap by imx8mq
additional delete option full, from-dcdofs and skip-mbr

---
Changes in v3:
- change hardcoded 0x400 to data->image_dcd_offset
- delete offset_load_address
- delete offset_size
Changes in v2:
- change subject from habv4: add the possibility to changing the signing area from Kconfig to
- delete KConfig entries
- delete changes habv4-imx6-gencsf.h
- delete full, from-dcdofs and skip-mbr options

Quoted 3 lines
---
 scripts/imx/imx.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox