Skip to contentSkip to conversation

SECURE BOOT: Add command for validation of images

PATCH New Gaurav Rana 2 participants 2 messages Feb 27, 2015 – Mar 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v3 3/4 SECURE BOOT: Add command for validation of images

1. esbc_validate command is meant for validating header and signature of images (Boot Script and ESBC uboot client). SHA-256 and RSA operations are performed using SEC block in HW. This command works on both PBL based and Non PBL based Freescale platforms.
Command usage:
esbc_validate img_hdr_addr [pub_key_hash]
2. ESBC uboot client can be linux. Additionally, rootfs and device tree blob can also be signed.
3. In the event of header or signature failure in validation, ITS and ITF bits determine further course of action.
4. In case of soft failure, appropriate error is dumped on console.
5. In case of hard failure, SoC is issued RESET REQUEST after dumping error on the console.
6. KEY REVOCATION Feature:
QorIQ platforms like B4/T4 have support of srk key table and key revocation in ISBC code in Silicon.
The srk key table allows the user to have a key table with multiple keys and revoke any key in case of particular key gets compromised. In case the ISBC code uses the key revocation and srk key table to verify the u-boot code, the subsequent chain of trust should also use the same.
6. ISBC KEY EXTENSION Feature:
This feature allows large number of keys to be used for esbc validation of images. A set of public keys is being signed and validated by ISBC which can be further used for esbc validation of images.

---
Changes in v3:
No change. Change in other patches of the patch set.

Changes in v2:
Copyright is changed in all the files in the patch.

 board/freescale/common/cmd_esbc_validate.c |  34 ++
 board/freescale/common/fsl_validate.c      | 840 +++++++++++++++++++++++++++++
 doc/README.esbc_validate                   |  41 ++
 include/fsl_secboot_err.h                  | 128 +++++
 include/fsl_validate.h                     | 199 +++++++
 5 files changed, 1242 insertions(+)
 create mode 100644 board/freescale/common/cmd_esbc_validate.c
 create mode 100644 board/freescale/common/fsl_validate.c
 create mode 100644 doc/README.esbc_validate
 create mode 100644 include/fsl_secboot_err.h
 create mode 100644 include/fsl_validate.h
board/freescale/common/cmd_esbc_validate.c new file +34 -0
new file mode 100644
index 0000000..8500ba5
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <command.h>
+#include <fsl_validate.h>
+
+static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc,
+				char * const argv[])
+{
+	if (argc < 2)
+		return cmd_usage(cmdtp);
+
+	return fsl_secboot_validate(cmdtp, flag, argc, argv);
+}
+
+/***************************************************/
+static char esbc_validate_help_text[] =
+	"esbc_validate hdr_addr <hash_val> - Validates signature using\n"
+	"                          RSA verification\n"
+	"                          $hdr_addr Address of header of the image\n"
+	"                          to be validated.\n"
+	"                          $hash_val -Optional\n"
+	"                          It provides Hash of public/srk key to be\n"
+	"                          used to verify signature.\n";
+
+U_BOOT_CMD(
+	esbc_validate,	3,	0,	do_esbc_validate,
+	"Validates signature on a given image using RSA verification",
+	esbc_validate_help_text
+);
board/freescale/common/fsl_validate.c new file +840 -0

840 lines not on this page · raw message

doc/README.esbc_validate new file +41 -0

41 lines not on this page · raw message

include/fsl_secboot_err.h new file +128 -0

128 lines not on this page · raw message

include/fsl_validate.h new file +199 -0

199 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#1 lore raw

PATCH v3 3/4 SECURE BOOT: Add command for validation of images

Quoted 27 lines · Gaurav Rana

1. esbc_validate command is meant for validating header and signature of images (Boot Script and ESBC uboot client). SHA-256 and RSA operations are performed using SEC block in HW. This command works on both PBL based and Non PBL based Freescale platforms.
Command usage:
esbc_validate img_hdr_addr [pub_key_hash]
2. ESBC uboot client can be linux. Additionally, rootfs and device tree blob can also be signed.
3. In the event of header or signature failure in validation, ITS and ITF bits determine further course of action.
4. In case of soft failure, appropriate error is dumped on console.
5. In case of hard failure, SoC is issued RESET REQUEST after dumping error on the console.
6. KEY REVOCATION Feature:
QorIQ platforms like B4/T4 have support of srk key table and key revocation in ISBC code in Silicon.
The srk key table allows the user to have a key table with multiple keys and revoke any key in case of particular key gets compromised. In case the ISBC code uses the key revocation and srk key table to verify the u-boot code, the subsequent chain of trust should also use the same.
6. ISBC KEY EXTENSION Feature:
This feature allows large number of keys to be used for esbc validation of images. A set of public keys is being signed and validated by ISBC which can be further used for esbc validation of images.

Quoted 8 lines

---
Changes in v3:
No change. Change in other patches of the patch set.

Changes in v2:
Copyright is changed in all the files in the patch.

Applied to u-boot-mpc85xx master after fixing commit message indentation, awaiting for upstream.

York