All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] stm32mp: cmd_stm32key: updates
@ 2021-06-28 12:55 Patrick Delaunay
  2021-06-28 12:55 ` [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards Patrick Delaunay
                   ` (6 more replies)
  0 siblings, 7 replies; 23+ messages in thread
From: Patrick Delaunay @ 2021-06-28 12:55 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32


Several improvements and protection on the command stm32key.

This command is used to experiment the secure boot on STM32MP15x;
the expected sequence to manually activate it with this U-Boot command is:
- Key generation with STM32 KeyGen tool
- Key registration: update and lock PKH in OTP (stm32key fuse)
- Perform image authentication of an image signed with
  STM32 Signing tool and check that the ROM code accepted them
- Close the device, only signed binary will be accepted (stm32key close)

Warning: Make sure that a device with Secure boot enabled is used,
         check the security field of the chip part number.

Otherwise the chip will be bricked and could not be used anymore.

This command is activated by default on STMicroelectronics evaluation
boards but these OTP can also be updated directly by customer
application or with Secure Secret Provisioning (SSP).



Patrick Delaunay (7):
  stm32mp: configs: activate the command stm32key only for ST boards
  stm32mp: cmd_stm32key: use sub command
  stm32mp: cmd_stm32key: handle error in fuse_hash_value
  stm32mp: cmd_stm32key: lock of PKH OTP after fuse
  stm32mp: cmd_stm32key: add get_misc_dev function
  stm32mp: cmd_stm32key: add read OTP subcommand
  stm32mp: cmd_stm32key: add subcommand close

 arch/arm/mach-stm32mp/Kconfig        |   4 +-
 arch/arm/mach-stm32mp/cmd_stm32key.c | 239 +++++++++++++++++++++++----
 configs/stm32mp15_basic_defconfig    |   1 +
 configs/stm32mp15_trusted_defconfig  |   1 +
 4 files changed, 208 insertions(+), 37 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards
  2021-06-28 12:55 [PATCH 0/7] stm32mp: cmd_stm32key: updates Patrick Delaunay
@ 2021-06-28 12:55 ` Patrick Delaunay
  2021-07-01  7:35   ` Patrice CHOTARD
  2021-07-16  8:27   ` Patrick DELAUNAY
  2021-06-28 12:55 ` [PATCH 2/7] stm32mp: cmd_stm32key: use sub command Patrick Delaunay
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 23+ messages in thread
From: Patrick Delaunay @ 2021-06-28 12:55 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32

This command is used to evaluate the secure boot on stm32mp SOC,
it is deactivated by default in real products.

We activate this command only in STMicroelectronics defconfig
used with the evaluation boards.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/Kconfig       | 4 +++-
 configs/stm32mp15_basic_defconfig   | 1 +
 configs/stm32mp15_trusted_defconfig | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 7c25266f33..0e59931679 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -174,10 +174,12 @@ config STM32_ETZPC
 
 config CMD_STM32KEY
 	bool "command stm32key to fuse public key hash"
-	default y
+	default n
 	help
 		fuse public key hash in corresponding fuse used to authenticate
 		binary.
+		This command is used to evaluate the secure boot on stm32mp SOC,
+		it is deactivated by default in real products.
 
 config PRE_CON_BUF_ADDR
 	default 0xC02FF000
diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
index 3ff46f7048..4e66472825 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -10,6 +10,7 @@ CONFIG_SPL_DM_SPI=y
 CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL=y
+CONFIG_CMD_STM32KEY=y
 CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_CMD_STM32PROG=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig
index afbf721299..d68bdf9eea 100644
--- a/configs/stm32mp15_trusted_defconfig
+++ b/configs/stm32mp15_trusted_defconfig
@@ -6,6 +6,7 @@ CONFIG_SYS_MEMTEST_START=0xc0000000
 CONFIG_SYS_MEMTEST_END=0xc4000000
 CONFIG_ENV_OFFSET=0x280000
 CONFIG_ENV_SECT_SIZE=0x40000
+CONFIG_CMD_STM32KEY=y
 CONFIG_TARGET_ST_STM32MP15x=y
 CONFIG_CMD_STM32PROG=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 2/7] stm32mp: cmd_stm32key: use sub command
  2021-06-28 12:55 [PATCH 0/7] stm32mp: cmd_stm32key: updates Patrick Delaunay
  2021-06-28 12:55 ` [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards Patrick Delaunay
@ 2021-06-28 12:55 ` Patrick Delaunay
  2021-07-01  7:35   ` Patrice CHOTARD
  2021-07-16  8:27   ` Patrick DELAUNAY
  2021-06-28 12:55 ` [PATCH 3/7] stm32mp: cmd_stm32key: handle error in fuse_hash_value Patrick Delaunay
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 23+ messages in thread
From: Patrick Delaunay @ 2021-06-28 12:55 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32key.c | 55 ++++++++++++++++++----------
 1 file changed, 36 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
index 42fdc11238..d2045a5983 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32key.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
@@ -67,36 +67,53 @@ static int confirm_prog(void)
 	return 0;
 }
 
-static int do_stm32key(struct cmd_tbl *cmdtp, int flag, int argc,
-		       char *const argv[])
+static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	u32 addr;
-	const char *op = argc >= 2 ? argv[1] : NULL;
-	int confirmed = argc > 3 && !strcmp(argv[2], "-y");
 
-	argc -= 2 + confirmed;
-	argv += 2 + confirmed;
-
-	if (argc < 1)
+	if (argc == 1)
 		return CMD_RET_USAGE;
 
-	addr = simple_strtoul(argv[0], NULL, 16);
+	addr = simple_strtoul(argv[1], NULL, 16);
 	if (!addr)
 		return CMD_RET_USAGE;
 
-	if (!strcmp(op, "read"))
-		read_hash_value(addr);
+	read_hash_value(addr);
+
+	return CMD_RET_SUCCESS;
+}
+
+static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+	u32 addr;
+	bool yes = false;
 
-	if (!strcmp(op, "fuse")) {
-		if (!confirmed && !confirm_prog())
-			return CMD_RET_FAILURE;
-		fuse_hash_value(addr, !confirmed);
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	if (argc == 3) {
+		if (strcmp(argv[1], "-y"))
+			return CMD_RET_USAGE;
+		yes = true;
 	}
 
+	addr = simple_strtoul(argv[argc - 1], NULL, 16);
+	if (!addr)
+		return CMD_RET_USAGE;
+
+	if (!yes && !confirm_prog())
+		return CMD_RET_FAILURE;
+
+	fuse_hash_value(addr, !yes);
+	printf("Hash key updated !\n");
+
 	return CMD_RET_SUCCESS;
 }
 
-U_BOOT_CMD(stm32key, 4, 1, do_stm32key,
-	   "Fuse ST Hash key",
-	   "read <addr>: Read the hash store at addr in memory\n"
-	   "stm32key fuse [-y] <addr> : Fuse hash store at addr in otp\n");
+static char stm32key_help_text[] =
+	"read <addr>: Read the hash stored at addr in memory\n"
+	"stm32key fuse [-y] <addr> : Fuse hash stored at addr in OTP\n";
+
+U_BOOT_CMD_WITH_SUBCMDS(stm32key, "Fuse ST Hash key", stm32key_help_text,
+	U_BOOT_SUBCMD_MKENT(read, 2, 0, do_stm32key_read),
+	U_BOOT_SUBCMD_MKENT(fuse, 3, 0, do_stm32key_fuse));
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 3/7] stm32mp: cmd_stm32key: handle error in fuse_hash_value
  2021-06-28 12:55 [PATCH 0/7] stm32mp: cmd_stm32key: updates Patrick Delaunay
  2021-06-28 12:55 ` [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards Patrick Delaunay
  2021-06-28 12:55 ` [PATCH 2/7] stm32mp: cmd_stm32key: use sub command Patrick Delaunay
@ 2021-06-28 12:55 ` Patrick Delaunay
  2021-07-01  7:35   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  2021-06-28 12:56 ` [PATCH 4/7] stm32mp: cmd_stm32key: lock of PKH OTP after fuse Patrick Delaunay
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 23+ messages in thread
From: Patrick Delaunay @ 2021-06-28 12:55 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32key.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
index d2045a5983..2529139ebc 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32key.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
@@ -25,7 +25,7 @@ static void read_hash_value(u32 addr)
 	}
 }
 
-static void fuse_hash_value(u32 addr, bool print)
+static int fuse_hash_value(u32 addr, bool print)
 {
 	struct udevice *dev;
 	u32 word, val;
@@ -36,21 +36,25 @@ static void fuse_hash_value(u32 addr, bool print)
 					  &dev);
 	if (ret) {
 		log_err("Can't find stm32mp_bsec driver\n");
-		return;
+		return ret;
 	}
 
 	for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
-		if (print)
-			printf("Fuse OTP %i : %x\n",
-			       STM32_OTP_HASH_KEY_START + i,
-			       __be32_to_cpu(*(u32 *)addr));
-
 		word = STM32_OTP_HASH_KEY_START + i;
 		val = __be32_to_cpu(*(u32 *)addr);
-		misc_write(dev, STM32_BSEC_OTP(word), &val, 4);
+		if (print)
+			printf("Fuse OTP %i : %x\n", word, val);
+
+		ret = misc_write(dev, STM32_BSEC_OTP(word), &val, 4);
+		if (ret != 4) {
+			log_err("Fuse OTP %i failed\n", word);
+			return ret;
+		}
 
 		addr += 4;
 	}
+
+	return 0;
 }
 
 static int confirm_prog(void)
@@ -104,7 +108,9 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
 	if (!yes && !confirm_prog())
 		return CMD_RET_FAILURE;
 
-	fuse_hash_value(addr, !yes);
+	if (fuse_hash_value(addr, !yes))
+		return CMD_RET_FAILURE;
+
 	printf("Hash key updated !\n");
 
 	return CMD_RET_SUCCESS;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 4/7] stm32mp: cmd_stm32key: lock of PKH OTP after fuse
  2021-06-28 12:55 [PATCH 0/7] stm32mp: cmd_stm32key: updates Patrick Delaunay
                   ` (2 preceding siblings ...)
  2021-06-28 12:55 ` [PATCH 3/7] stm32mp: cmd_stm32key: handle error in fuse_hash_value Patrick Delaunay
@ 2021-06-28 12:56 ` Patrick Delaunay
  2021-07-01  7:35   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  2021-06-28 12:56 ` [PATCH 5/7] stm32mp: cmd_stm32key: add get_misc_dev function Patrick Delaunay
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 23+ messages in thread
From: Patrick Delaunay @ 2021-06-28 12:56 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32key.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
index 2529139ebc..c4cb6342fa 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32key.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
@@ -39,8 +39,9 @@ static int fuse_hash_value(u32 addr, bool print)
 		return ret;
 	}
 
-	for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
-		word = STM32_OTP_HASH_KEY_START + i;
+	for (i = 0, word = STM32_OTP_HASH_KEY_START;
+	     i < STM32_OTP_HASH_KEY_SIZE;
+	     i++, word++, addr += 4) {
 		val = __be32_to_cpu(*(u32 *)addr);
 		if (print)
 			printf("Fuse OTP %i : %x\n", word, val);
@@ -50,8 +51,13 @@ static int fuse_hash_value(u32 addr, bool print)
 			log_err("Fuse OTP %i failed\n", word);
 			return ret;
 		}
-
-		addr += 4;
+		/* on success, lock the OTP for HASH key */
+		val = 1;
+		ret = misc_write(dev, STM32_BSEC_LOCK(word), &val, 4);
+		if (ret != 4) {
+			log_err("Lock OTP %i failed\n", word);
+			return ret;
+		}
 	}
 
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 5/7] stm32mp: cmd_stm32key: add get_misc_dev function
  2021-06-28 12:55 [PATCH 0/7] stm32mp: cmd_stm32key: updates Patrick Delaunay
                   ` (3 preceding siblings ...)
  2021-06-28 12:56 ` [PATCH 4/7] stm32mp: cmd_stm32key: lock of PKH OTP after fuse Patrick Delaunay
@ 2021-06-28 12:56 ` Patrick Delaunay
  2021-07-01  7:36   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  2021-06-28 12:56 ` [PATCH 6/7] stm32mp: cmd_stm32key: add read OTP subcommand Patrick Delaunay
  2021-06-28 12:56 ` [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close Patrick Delaunay
  6 siblings, 2 replies; 23+ messages in thread
From: Patrick Delaunay @ 2021-06-28 12:56 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32key.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
index c4cb6342fa..886c52794f 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32key.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
@@ -14,6 +14,17 @@
 #define STM32_OTP_HASH_KEY_START 24
 #define STM32_OTP_HASH_KEY_SIZE 8
 
+static int get_misc_dev(struct udevice **dev)
+{
+	int ret;
+
+	ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(stm32mp_bsec), dev);
+	if (ret)
+		log_err("Can't find stm32mp_bsec driver\n");
+
+	return ret;
+}
+
 static void read_hash_value(u32 addr)
 {
 	int i;
@@ -31,13 +42,9 @@ static int fuse_hash_value(u32 addr, bool print)
 	u32 word, val;
 	int i, ret;
 
-	ret = uclass_get_device_by_driver(UCLASS_MISC,
-					  DM_DRIVER_GET(stm32mp_bsec),
-					  &dev);
-	if (ret) {
-		log_err("Can't find stm32mp_bsec driver\n");
+	ret = get_misc_dev(&dev);
+	if (ret)
 		return ret;
-	}
 
 	for (i = 0, word = STM32_OTP_HASH_KEY_START;
 	     i < STM32_OTP_HASH_KEY_SIZE;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 6/7] stm32mp: cmd_stm32key: add read OTP subcommand
  2021-06-28 12:55 [PATCH 0/7] stm32mp: cmd_stm32key: updates Patrick Delaunay
                   ` (4 preceding siblings ...)
  2021-06-28 12:56 ` [PATCH 5/7] stm32mp: cmd_stm32key: add get_misc_dev function Patrick Delaunay
@ 2021-06-28 12:56 ` Patrick Delaunay
  2021-07-01  7:36   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  2021-06-28 12:56 ` [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close Patrick Delaunay
  6 siblings, 2 replies; 23+ messages in thread
From: Patrick Delaunay @ 2021-06-28 12:56 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32key.c | 93 ++++++++++++++++++++++++++--
 1 file changed, 87 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
index 886c52794f..8c8d476b65 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32key.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
@@ -11,8 +11,13 @@
 #include <dm/device.h>
 #include <dm/uclass.h>
 
-#define STM32_OTP_HASH_KEY_START 24
-#define STM32_OTP_HASH_KEY_SIZE 8
+/* Closed device : bit 6 of OPT0*/
+#define STM32_OTP_CLOSE_ID		0
+#define STM32_OTP_CLOSE_MASK		BIT(6)
+
+/* HASH of key: 8 OTPs, starting with OTP24) */
+#define STM32_OTP_HASH_KEY_START	24
+#define STM32_OTP_HASH_KEY_SIZE		8
 
 static int get_misc_dev(struct udevice **dev)
 {
@@ -29,6 +34,7 @@ static void read_hash_value(u32 addr)
 {
 	int i;
 
+	printf("Read KEY at 0x%x\n", addr);
 	for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
 		printf("OTP value %i: %x\n", STM32_OTP_HASH_KEY_START + i,
 		       __be32_to_cpu(*(u32 *)addr));
@@ -36,6 +42,69 @@ static void read_hash_value(u32 addr)
 	}
 }
 
+static int read_hash_otp(bool print, bool *locked, bool *closed)
+{
+	struct udevice *dev;
+	int i, word, ret;
+	int nb_invalid = 0, nb_zero = 0, nb_lock = 0;
+	u32 val, lock;
+	bool status;
+
+	ret = get_misc_dev(&dev);
+	if (ret)
+		return ret;
+
+	for (i = 0, word = STM32_OTP_HASH_KEY_START; i < STM32_OTP_HASH_KEY_SIZE; i++, word++) {
+		ret = misc_read(dev, STM32_BSEC_OTP(word), &val, 4);
+		if (ret != 4)
+			val = ~0x0;
+		ret = misc_read(dev, STM32_BSEC_LOCK(word), &lock, 4);
+		if (ret != 4)
+			lock = -1;
+		if (print)
+			printf("OTP HASH %i: %x lock : %d\n", word, val, lock);
+		if (val == ~0x0)
+			nb_invalid++;
+		else if (val == 0x0)
+			nb_zero++;
+		if (lock == 1)
+			nb_lock++;
+	}
+
+	word = STM32_OTP_CLOSE_ID;
+	ret = misc_read(dev, STM32_BSEC_OTP(word), &val, 4);
+	if (ret != 4)
+		val = 0x0;
+	ret = misc_read(dev, STM32_BSEC_LOCK(word), &lock, 4);
+	if (ret != 4)
+		lock = -1;
+
+	status = (val & STM32_OTP_CLOSE_MASK) == STM32_OTP_CLOSE_MASK;
+	if (closed)
+		*closed = status;
+	if (print)
+		printf("OTP %d: closed status: %d lock : %d\n", word, status, lock);
+
+	status = (nb_lock == STM32_OTP_HASH_KEY_SIZE);
+	if (locked)
+		*locked = status;
+	if (!status && print)
+		printf("Hash of key is not locked!\n");
+
+	if (nb_invalid == STM32_OTP_HASH_KEY_SIZE) {
+		if (print)
+			printf("Hash of key is invalid!\n");
+		return -EINVAL;
+	}
+	if (nb_zero == STM32_OTP_HASH_KEY_SIZE) {
+		if (print)
+			printf("Hash of key is free!\n");
+		return -ENOENT;
+	}
+
+	return 0;
+}
+
 static int fuse_hash_value(u32 addr, bool print)
 {
 	struct udevice *dev;
@@ -88,8 +157,10 @@ static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *con
 {
 	u32 addr;
 
-	if (argc == 1)
-		return CMD_RET_USAGE;
+	if (argc == 1) {
+		read_hash_otp(true, NULL, NULL);
+		return CMD_RET_SUCCESS;
+	}
 
 	addr = simple_strtoul(argv[1], NULL, 16);
 	if (!addr)
@@ -103,7 +174,7 @@ static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *con
 static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	u32 addr;
-	bool yes = false;
+	bool yes = false, lock, closed;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
@@ -118,6 +189,16 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
 	if (!addr)
 		return CMD_RET_USAGE;
 
+	if (read_hash_otp(!yes, &lock, &closed) != -ENOENT) {
+		printf("Error: can't fuse again the OTP\n");
+		return CMD_RET_FAILURE;
+	}
+
+	if (lock || closed) {
+		printf("Error: invalid OTP configuration (lock=%d, closed=%d)\n", lock, closed);
+		return CMD_RET_FAILURE;
+	}
+
 	if (!yes && !confirm_prog())
 		return CMD_RET_FAILURE;
 
@@ -130,7 +211,7 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
 }
 
 static char stm32key_help_text[] =
-	"read <addr>: Read the hash stored at addr in memory\n"
+	"read [<addr>]: Read the hash stored at addr in memory or in OTP\n"
 	"stm32key fuse [-y] <addr> : Fuse hash stored at addr in OTP\n";
 
 U_BOOT_CMD_WITH_SUBCMDS(stm32key, "Fuse ST Hash key", stm32key_help_text,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close
  2021-06-28 12:55 [PATCH 0/7] stm32mp: cmd_stm32key: updates Patrick Delaunay
                   ` (5 preceding siblings ...)
  2021-06-28 12:56 ` [PATCH 6/7] stm32mp: cmd_stm32key: add read OTP subcommand Patrick Delaunay
@ 2021-06-28 12:56 ` Patrick Delaunay
  2021-07-01  7:36   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  6 siblings, 2 replies; 23+ messages in thread
From: Patrick Delaunay @ 2021-06-28 12:56 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
   STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
         This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32key.c | 54 ++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
index 8c8d476b65..50840b0f38 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32key.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
@@ -210,10 +210,60 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
 	return CMD_RET_SUCCESS;
 }
 
+static int do_stm32key_close(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+	bool yes, lock, closed;
+	struct udevice *dev;
+	u32 val;
+	int ret;
+
+	yes = false;
+	if (argc == 2) {
+		if (strcmp(argv[1], "-y"))
+			return CMD_RET_USAGE;
+		yes = true;
+	}
+
+	ret = read_hash_otp(!yes, &lock, &closed);
+	if (ret) {
+		if (ret == -ENOENT)
+			printf("Error: OTP not programmed!\n");
+		return CMD_RET_FAILURE;
+	}
+
+	if (closed) {
+		printf("Error: already closed!\n");
+		return CMD_RET_FAILURE;
+	}
+
+	if (!lock)
+		printf("Warning: OTP not locked!\n");
+
+	if (!yes && !confirm_prog())
+		return CMD_RET_FAILURE;
+
+	ret = get_misc_dev(&dev);
+	if (ret)
+		return CMD_RET_FAILURE;
+
+	val = STM32_OTP_CLOSE_MASK;
+	ret = misc_write(dev, STM32_BSEC_OTP(STM32_OTP_CLOSE_ID), &val, 4);
+	if (ret != 4) {
+		printf("Error: can't update OTP\n");
+		return CMD_RET_FAILURE;
+	}
+
+	printf("Device is closed !\n");
+
+	return CMD_RET_SUCCESS;
+}
+
 static char stm32key_help_text[] =
 	"read [<addr>]: Read the hash stored at addr in memory or in OTP\n"
-	"stm32key fuse [-y] <addr> : Fuse hash stored at addr in OTP\n";
+	"stm32key fuse [-y] <addr> : Fuse hash stored at addr in OTP\n"
+	"stm32key close [-y] : Close the device, the hash stored in OTP\n";
 
 U_BOOT_CMD_WITH_SUBCMDS(stm32key, "Fuse ST Hash key", stm32key_help_text,
 	U_BOOT_SUBCMD_MKENT(read, 2, 0, do_stm32key_read),
-	U_BOOT_SUBCMD_MKENT(fuse, 3, 0, do_stm32key_fuse));
+	U_BOOT_SUBCMD_MKENT(fuse, 3, 0, do_stm32key_fuse),
+	U_BOOT_SUBCMD_MKENT(close, 2, 0, do_stm32key_close));
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards
  2021-06-28 12:55 ` [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards Patrick Delaunay
@ 2021-07-01  7:35   ` Patrice CHOTARD
  2021-07-16  8:27   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrice CHOTARD @ 2021-07-01  7:35 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32

Hi Patrick

On 6/28/21 2:55 PM, Patrick Delaunay wrote:
> This command is used to evaluate the secure boot on stm32mp SOC,
> it is deactivated by default in real products.
> 
> We activate this command only in STMicroelectronics defconfig
> used with the evaluation boards.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/Kconfig       | 4 +++-
>  configs/stm32mp15_basic_defconfig   | 1 +
>  configs/stm32mp15_trusted_defconfig | 1 +
>  3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
> index 7c25266f33..0e59931679 100644
> --- a/arch/arm/mach-stm32mp/Kconfig
> +++ b/arch/arm/mach-stm32mp/Kconfig
> @@ -174,10 +174,12 @@ config STM32_ETZPC
>  
>  config CMD_STM32KEY
>  	bool "command stm32key to fuse public key hash"
> -	default y
> +	default n
>  	help
>  		fuse public key hash in corresponding fuse used to authenticate
>  		binary.
> +		This command is used to evaluate the secure boot on stm32mp SOC,
> +		it is deactivated by default in real products.
>  
>  config PRE_CON_BUF_ADDR
>  	default 0xC02FF000
> diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
> index 3ff46f7048..4e66472825 100644
> --- a/configs/stm32mp15_basic_defconfig
> +++ b/configs/stm32mp15_basic_defconfig
> @@ -10,6 +10,7 @@ CONFIG_SPL_DM_SPI=y
>  CONFIG_SPL_TEXT_BASE=0x2FFC2500
>  CONFIG_SPL_MMC_SUPPORT=y
>  CONFIG_SPL=y
> +CONFIG_CMD_STM32KEY=y
>  CONFIG_TARGET_ST_STM32MP15x=y
>  CONFIG_CMD_STM32PROG=y
>  CONFIG_ENV_OFFSET_REDUND=0x2C0000
> diff --git a/configs/stm32mp15_trusted_defconfig b/configs/stm32mp15_trusted_defconfig
> index afbf721299..d68bdf9eea 100644
> --- a/configs/stm32mp15_trusted_defconfig
> +++ b/configs/stm32mp15_trusted_defconfig
> @@ -6,6 +6,7 @@ CONFIG_SYS_MEMTEST_START=0xc0000000
>  CONFIG_SYS_MEMTEST_END=0xc4000000
>  CONFIG_ENV_OFFSET=0x280000
>  CONFIG_ENV_SECT_SIZE=0x40000
> +CONFIG_CMD_STM32KEY=y
>  CONFIG_TARGET_ST_STM32MP15x=y
>  CONFIG_CMD_STM32PROG=y
>  CONFIG_ENV_OFFSET_REDUND=0x2C0000
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/7] stm32mp: cmd_stm32key: use sub command
  2021-06-28 12:55 ` [PATCH 2/7] stm32mp: cmd_stm32key: use sub command Patrick Delaunay
@ 2021-07-01  7:35   ` Patrice CHOTARD
  2021-07-16  8:27   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrice CHOTARD @ 2021-07-01  7:35 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32

Hi Patrick

On 6/28/21 2:55 PM, Patrick Delaunay wrote:
> Simplify parsing the command argument by using
> the macro U_BOOT_CMD_WITH_SUBCMDS.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32key.c | 55 ++++++++++++++++++----------
>  1 file changed, 36 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
> index 42fdc11238..d2045a5983 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32key.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
> @@ -67,36 +67,53 @@ static int confirm_prog(void)
>  	return 0;
>  }
>  
> -static int do_stm32key(struct cmd_tbl *cmdtp, int flag, int argc,
> -		       char *const argv[])
> +static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>  {
>  	u32 addr;
> -	const char *op = argc >= 2 ? argv[1] : NULL;
> -	int confirmed = argc > 3 && !strcmp(argv[2], "-y");
>  
> -	argc -= 2 + confirmed;
> -	argv += 2 + confirmed;
> -
> -	if (argc < 1)
> +	if (argc == 1)
>  		return CMD_RET_USAGE;
>  
> -	addr = simple_strtoul(argv[0], NULL, 16);
> +	addr = simple_strtoul(argv[1], NULL, 16);
>  	if (!addr)
>  		return CMD_RET_USAGE;
>  
> -	if (!strcmp(op, "read"))
> -		read_hash_value(addr);
> +	read_hash_value(addr);
> +
> +	return CMD_RET_SUCCESS;
> +}
> +
> +static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
> +{
> +	u32 addr;
> +	bool yes = false;
>  
> -	if (!strcmp(op, "fuse")) {
> -		if (!confirmed && !confirm_prog())
> -			return CMD_RET_FAILURE;
> -		fuse_hash_value(addr, !confirmed);
> +	if (argc < 2)
> +		return CMD_RET_USAGE;
> +
> +	if (argc == 3) {
> +		if (strcmp(argv[1], "-y"))
> +			return CMD_RET_USAGE;
> +		yes = true;
>  	}
>  
> +	addr = simple_strtoul(argv[argc - 1], NULL, 16);
> +	if (!addr)
> +		return CMD_RET_USAGE;
> +
> +	if (!yes && !confirm_prog())
> +		return CMD_RET_FAILURE;
> +
> +	fuse_hash_value(addr, !yes);
> +	printf("Hash key updated !\n");
> +
>  	return CMD_RET_SUCCESS;
>  }
>  
> -U_BOOT_CMD(stm32key, 4, 1, do_stm32key,
> -	   "Fuse ST Hash key",
> -	   "read <addr>: Read the hash store at addr in memory\n"
> -	   "stm32key fuse [-y] <addr> : Fuse hash store at addr in otp\n");
> +static char stm32key_help_text[] =
> +	"read <addr>: Read the hash stored at addr in memory\n"
> +	"stm32key fuse [-y] <addr> : Fuse hash stored at addr in OTP\n";
> +
> +U_BOOT_CMD_WITH_SUBCMDS(stm32key, "Fuse ST Hash key", stm32key_help_text,
> +	U_BOOT_SUBCMD_MKENT(read, 2, 0, do_stm32key_read),
> +	U_BOOT_SUBCMD_MKENT(fuse, 3, 0, do_stm32key_fuse));
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/7] stm32mp: cmd_stm32key: handle error in fuse_hash_value
  2021-06-28 12:55 ` [PATCH 3/7] stm32mp: cmd_stm32key: handle error in fuse_hash_value Patrick Delaunay
@ 2021-07-01  7:35   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrice CHOTARD @ 2021-07-01  7:35 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32

Hi Patrick

On 6/28/21 2:55 PM, Patrick Delaunay wrote:
> Handle errors in fuse_hash_value function.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32key.c | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
> index d2045a5983..2529139ebc 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32key.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
> @@ -25,7 +25,7 @@ static void read_hash_value(u32 addr)
>  	}
>  }
>  
> -static void fuse_hash_value(u32 addr, bool print)
> +static int fuse_hash_value(u32 addr, bool print)
>  {
>  	struct udevice *dev;
>  	u32 word, val;
> @@ -36,21 +36,25 @@ static void fuse_hash_value(u32 addr, bool print)
>  					  &dev);
>  	if (ret) {
>  		log_err("Can't find stm32mp_bsec driver\n");
> -		return;
> +		return ret;
>  	}
>  
>  	for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
> -		if (print)
> -			printf("Fuse OTP %i : %x\n",
> -			       STM32_OTP_HASH_KEY_START + i,
> -			       __be32_to_cpu(*(u32 *)addr));
> -
>  		word = STM32_OTP_HASH_KEY_START + i;
>  		val = __be32_to_cpu(*(u32 *)addr);
> -		misc_write(dev, STM32_BSEC_OTP(word), &val, 4);
> +		if (print)
> +			printf("Fuse OTP %i : %x\n", word, val);
> +
> +		ret = misc_write(dev, STM32_BSEC_OTP(word), &val, 4);
> +		if (ret != 4) {
> +			log_err("Fuse OTP %i failed\n", word);
> +			return ret;
> +		}
>  
>  		addr += 4;
>  	}
> +
> +	return 0;
>  }
>  
>  static int confirm_prog(void)
> @@ -104,7 +108,9 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
>  	if (!yes && !confirm_prog())
>  		return CMD_RET_FAILURE;
>  
> -	fuse_hash_value(addr, !yes);
> +	if (fuse_hash_value(addr, !yes))
> +		return CMD_RET_FAILURE;
> +
>  	printf("Hash key updated !\n");
>  
>  	return CMD_RET_SUCCESS;
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/7] stm32mp: cmd_stm32key: lock of PKH OTP after fuse
  2021-06-28 12:56 ` [PATCH 4/7] stm32mp: cmd_stm32key: lock of PKH OTP after fuse Patrick Delaunay
@ 2021-07-01  7:35   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrice CHOTARD @ 2021-07-01  7:35 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32

Hi Patrick

On 6/28/21 2:56 PM, Patrick Delaunay wrote:
> Lock the OTP value of key's hash after the command
> $> stm32key fuse <address>
> 
> This operation forbids a second update of these OTP as they are
> ECC protected in BSEC: any update of these OTP with a different value
> causes a BSEC disturb error and the closed chip will be bricked.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32key.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
> index 2529139ebc..c4cb6342fa 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32key.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
> @@ -39,8 +39,9 @@ static int fuse_hash_value(u32 addr, bool print)
>  		return ret;
>  	}
>  
> -	for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
> -		word = STM32_OTP_HASH_KEY_START + i;
> +	for (i = 0, word = STM32_OTP_HASH_KEY_START;
> +	     i < STM32_OTP_HASH_KEY_SIZE;
> +	     i++, word++, addr += 4) {
>  		val = __be32_to_cpu(*(u32 *)addr);
>  		if (print)
>  			printf("Fuse OTP %i : %x\n", word, val);
> @@ -50,8 +51,13 @@ static int fuse_hash_value(u32 addr, bool print)
>  			log_err("Fuse OTP %i failed\n", word);
>  			return ret;
>  		}
> -
> -		addr += 4;
> +		/* on success, lock the OTP for HASH key */
> +		val = 1;
> +		ret = misc_write(dev, STM32_BSEC_LOCK(word), &val, 4);
> +		if (ret != 4) {
> +			log_err("Lock OTP %i failed\n", word);
> +			return ret;
> +		}
>  	}
>  
>  	return 0;
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/7] stm32mp: cmd_stm32key: add get_misc_dev function
  2021-06-28 12:56 ` [PATCH 5/7] stm32mp: cmd_stm32key: add get_misc_dev function Patrick Delaunay
@ 2021-07-01  7:36   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrice CHOTARD @ 2021-07-01  7:36 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32

Hi Patrick

On 6/28/21 2:56 PM, Patrick Delaunay wrote:
> Add a helper function to access to BSEC misc driver.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32key.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
> index c4cb6342fa..886c52794f 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32key.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
> @@ -14,6 +14,17 @@
>  #define STM32_OTP_HASH_KEY_START 24
>  #define STM32_OTP_HASH_KEY_SIZE 8
>  
> +static int get_misc_dev(struct udevice **dev)
> +{
> +	int ret;
> +
> +	ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(stm32mp_bsec), dev);
> +	if (ret)
> +		log_err("Can't find stm32mp_bsec driver\n");
> +
> +	return ret;
> +}
> +
>  static void read_hash_value(u32 addr)
>  {
>  	int i;
> @@ -31,13 +42,9 @@ static int fuse_hash_value(u32 addr, bool print)
>  	u32 word, val;
>  	int i, ret;
>  
> -	ret = uclass_get_device_by_driver(UCLASS_MISC,
> -					  DM_DRIVER_GET(stm32mp_bsec),
> -					  &dev);
> -	if (ret) {
> -		log_err("Can't find stm32mp_bsec driver\n");
> +	ret = get_misc_dev(&dev);
> +	if (ret)
>  		return ret;
> -	}
>  
>  	for (i = 0, word = STM32_OTP_HASH_KEY_START;
>  	     i < STM32_OTP_HASH_KEY_SIZE;
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 6/7] stm32mp: cmd_stm32key: add read OTP subcommand
  2021-06-28 12:56 ` [PATCH 6/7] stm32mp: cmd_stm32key: add read OTP subcommand Patrick Delaunay
@ 2021-07-01  7:36   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrice CHOTARD @ 2021-07-01  7:36 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32

Hi Patrick

On 6/28/21 2:56 PM, Patrick Delaunay wrote:
> Allow to read the OTP value and lock status with the command
> $> stm32key read.
> 
> This patch also protects the stm32key fuse command.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32key.c | 93 ++++++++++++++++++++++++++--
>  1 file changed, 87 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
> index 886c52794f..8c8d476b65 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32key.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
> @@ -11,8 +11,13 @@
>  #include <dm/device.h>
>  #include <dm/uclass.h>
>  
> -#define STM32_OTP_HASH_KEY_START 24
> -#define STM32_OTP_HASH_KEY_SIZE 8
> +/* Closed device : bit 6 of OPT0*/
> +#define STM32_OTP_CLOSE_ID		0
> +#define STM32_OTP_CLOSE_MASK		BIT(6)
> +
> +/* HASH of key: 8 OTPs, starting with OTP24) */
> +#define STM32_OTP_HASH_KEY_START	24
> +#define STM32_OTP_HASH_KEY_SIZE		8
>  
>  static int get_misc_dev(struct udevice **dev)
>  {
> @@ -29,6 +34,7 @@ static void read_hash_value(u32 addr)
>  {
>  	int i;
>  
> +	printf("Read KEY at 0x%x\n", addr);
>  	for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
>  		printf("OTP value %i: %x\n", STM32_OTP_HASH_KEY_START + i,
>  		       __be32_to_cpu(*(u32 *)addr));
> @@ -36,6 +42,69 @@ static void read_hash_value(u32 addr)
>  	}
>  }
>  
> +static int read_hash_otp(bool print, bool *locked, bool *closed)
> +{
> +	struct udevice *dev;
> +	int i, word, ret;
> +	int nb_invalid = 0, nb_zero = 0, nb_lock = 0;
> +	u32 val, lock;
> +	bool status;
> +
> +	ret = get_misc_dev(&dev);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 0, word = STM32_OTP_HASH_KEY_START; i < STM32_OTP_HASH_KEY_SIZE; i++, word++) {
> +		ret = misc_read(dev, STM32_BSEC_OTP(word), &val, 4);
> +		if (ret != 4)
> +			val = ~0x0;
> +		ret = misc_read(dev, STM32_BSEC_LOCK(word), &lock, 4);
> +		if (ret != 4)
> +			lock = -1;
> +		if (print)
> +			printf("OTP HASH %i: %x lock : %d\n", word, val, lock);
> +		if (val == ~0x0)
> +			nb_invalid++;
> +		else if (val == 0x0)
> +			nb_zero++;
> +		if (lock == 1)
> +			nb_lock++;
> +	}
> +
> +	word = STM32_OTP_CLOSE_ID;
> +	ret = misc_read(dev, STM32_BSEC_OTP(word), &val, 4);
> +	if (ret != 4)
> +		val = 0x0;
> +	ret = misc_read(dev, STM32_BSEC_LOCK(word), &lock, 4);
> +	if (ret != 4)
> +		lock = -1;
> +
> +	status = (val & STM32_OTP_CLOSE_MASK) == STM32_OTP_CLOSE_MASK;
> +	if (closed)
> +		*closed = status;
> +	if (print)
> +		printf("OTP %d: closed status: %d lock : %d\n", word, status, lock);
> +
> +	status = (nb_lock == STM32_OTP_HASH_KEY_SIZE);
> +	if (locked)
> +		*locked = status;
> +	if (!status && print)
> +		printf("Hash of key is not locked!\n");
> +
> +	if (nb_invalid == STM32_OTP_HASH_KEY_SIZE) {
> +		if (print)
> +			printf("Hash of key is invalid!\n");
> +		return -EINVAL;
> +	}
> +	if (nb_zero == STM32_OTP_HASH_KEY_SIZE) {
> +		if (print)
> +			printf("Hash of key is free!\n");
> +		return -ENOENT;
> +	}
> +
> +	return 0;
> +}
> +
>  static int fuse_hash_value(u32 addr, bool print)
>  {
>  	struct udevice *dev;
> @@ -88,8 +157,10 @@ static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *con
>  {
>  	u32 addr;
>  
> -	if (argc == 1)
> -		return CMD_RET_USAGE;
> +	if (argc == 1) {
> +		read_hash_otp(true, NULL, NULL);
> +		return CMD_RET_SUCCESS;
> +	}
>  
>  	addr = simple_strtoul(argv[1], NULL, 16);
>  	if (!addr)
> @@ -103,7 +174,7 @@ static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *con
>  static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>  {
>  	u32 addr;
> -	bool yes = false;
> +	bool yes = false, lock, closed;
>  
>  	if (argc < 2)
>  		return CMD_RET_USAGE;
> @@ -118,6 +189,16 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
>  	if (!addr)
>  		return CMD_RET_USAGE;
>  
> +	if (read_hash_otp(!yes, &lock, &closed) != -ENOENT) {
> +		printf("Error: can't fuse again the OTP\n");
> +		return CMD_RET_FAILURE;
> +	}
> +
> +	if (lock || closed) {
> +		printf("Error: invalid OTP configuration (lock=%d, closed=%d)\n", lock, closed);
> +		return CMD_RET_FAILURE;
> +	}
> +
>  	if (!yes && !confirm_prog())
>  		return CMD_RET_FAILURE;
>  
> @@ -130,7 +211,7 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
>  }
>  
>  static char stm32key_help_text[] =
> -	"read <addr>: Read the hash stored at addr in memory\n"
> +	"read [<addr>]: Read the hash stored at addr in memory or in OTP\n"
>  	"stm32key fuse [-y] <addr> : Fuse hash stored at addr in OTP\n";
>  
>  U_BOOT_CMD_WITH_SUBCMDS(stm32key, "Fuse ST Hash key", stm32key_help_text,
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close
  2021-06-28 12:56 ` [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close Patrick Delaunay
@ 2021-07-01  7:36   ` Patrice CHOTARD
  2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrice CHOTARD @ 2021-07-01  7:36 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32

Hi Patrick

On 6/28/21 2:56 PM, Patrick Delaunay wrote:
> The expected sequence to close the device
> 
> 1/ Load key in DDR with any supported load command
> 2/ Update OTP with key: STM32MP> stm32key read <addr>
> 
> At this point the device is able to perform image authentication but
> non-authenticated images can still be used and executed.
> So it is the last moment to test boot with signed binary and
> check that the ROM code accepts them.
> 
> 3/ Close the device: only signed binary will be accepted !!
>    STM32MP> stm32key close
> 
> Warning: Programming these OTP is an irreversible operation!
>          This may brick your system if the HASH of key is invalid
> 
> This command should be deactivated by default in real product.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32key.c | 54 ++++++++++++++++++++++++++--
>  1 file changed, 52 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
> index 8c8d476b65..50840b0f38 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32key.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
> @@ -210,10 +210,60 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
>  	return CMD_RET_SUCCESS;
>  }
>  
> +static int do_stm32key_close(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
> +{
> +	bool yes, lock, closed;
> +	struct udevice *dev;
> +	u32 val;
> +	int ret;
> +
> +	yes = false;
> +	if (argc == 2) {
> +		if (strcmp(argv[1], "-y"))
> +			return CMD_RET_USAGE;
> +		yes = true;
> +	}
> +
> +	ret = read_hash_otp(!yes, &lock, &closed);
> +	if (ret) {
> +		if (ret == -ENOENT)
> +			printf("Error: OTP not programmed!\n");
> +		return CMD_RET_FAILURE;
> +	}
> +
> +	if (closed) {
> +		printf("Error: already closed!\n");
> +		return CMD_RET_FAILURE;
> +	}
> +
> +	if (!lock)
> +		printf("Warning: OTP not locked!\n");
> +
> +	if (!yes && !confirm_prog())
> +		return CMD_RET_FAILURE;
> +
> +	ret = get_misc_dev(&dev);
> +	if (ret)
> +		return CMD_RET_FAILURE;
> +
> +	val = STM32_OTP_CLOSE_MASK;
> +	ret = misc_write(dev, STM32_BSEC_OTP(STM32_OTP_CLOSE_ID), &val, 4);
> +	if (ret != 4) {
> +		printf("Error: can't update OTP\n");
> +		return CMD_RET_FAILURE;
> +	}
> +
> +	printf("Device is closed !\n");
> +
> +	return CMD_RET_SUCCESS;
> +}
> +
>  static char stm32key_help_text[] =
>  	"read [<addr>]: Read the hash stored at addr in memory or in OTP\n"
> -	"stm32key fuse [-y] <addr> : Fuse hash stored at addr in OTP\n";
> +	"stm32key fuse [-y] <addr> : Fuse hash stored at addr in OTP\n"
> +	"stm32key close [-y] : Close the device, the hash stored in OTP\n";
>  
>  U_BOOT_CMD_WITH_SUBCMDS(stm32key, "Fuse ST Hash key", stm32key_help_text,
>  	U_BOOT_SUBCMD_MKENT(read, 2, 0, do_stm32key_read),
> -	U_BOOT_SUBCMD_MKENT(fuse, 3, 0, do_stm32key_fuse));
> +	U_BOOT_SUBCMD_MKENT(fuse, 3, 0, do_stm32key_fuse),
> +	U_BOOT_SUBCMD_MKENT(close, 2, 0, do_stm32key_close));
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards
  2021-06-28 12:55 ` [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards Patrick Delaunay
  2021-07-01  7:35   ` Patrice CHOTARD
@ 2021-07-16  8:27   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrick DELAUNAY @ 2021-07-16  8:27 UTC (permalink / raw)
  To: u-boot; +Cc: Patrice Chotard, U-Boot STM32

Hi,

On 6/28/21 2:55 PM, Patrick Delaunay wrote:
> This command is used to evaluate the secure boot on stm32mp SOC,
> it is deactivated by default in real products.
>
> We activate this command only in STMicroelectronics defconfig
> used with the evaluation boards.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/Kconfig       | 4 +++-
>   configs/stm32mp15_basic_defconfig   | 1 +
>   configs/stm32mp15_trusted_defconfig | 1 +
>   3 files changed, 5 insertions(+), 1 deletion(-)
>

Applied to u-boot-stm/master, thanks!

Regards
Patrick


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 2/7] stm32mp: cmd_stm32key: use sub command
  2021-06-28 12:55 ` [PATCH 2/7] stm32mp: cmd_stm32key: use sub command Patrick Delaunay
  2021-07-01  7:35   ` Patrice CHOTARD
@ 2021-07-16  8:27   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrick DELAUNAY @ 2021-07-16  8:27 UTC (permalink / raw)
  To: u-boot; +Cc: Patrice Chotard, U-Boot STM32

Hi,

On 6/28/21 2:55 PM, Patrick Delaunay wrote:
> Simplify parsing the command argument by using
> the macro U_BOOT_CMD_WITH_SUBCMDS.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/cmd_stm32key.c | 55 ++++++++++++++++++----------
>   1 file changed, 36 insertions(+), 19 deletions(-)
>
Applied to u-boot-stm/master, thanks!

Regards
Patrick

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 3/7] stm32mp: cmd_stm32key: handle error in fuse_hash_value
  2021-06-28 12:55 ` [PATCH 3/7] stm32mp: cmd_stm32key: handle error in fuse_hash_value Patrick Delaunay
  2021-07-01  7:35   ` Patrice CHOTARD
@ 2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrick DELAUNAY @ 2021-07-16  8:28 UTC (permalink / raw)
  To: u-boot; +Cc: Patrice Chotard, U-Boot STM32

Hi,

On 6/28/21 2:55 PM, Patrick Delaunay wrote:
> Handle errors in fuse_hash_value function.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/cmd_stm32key.c | 24 +++++++++++++++---------
>   1 file changed, 15 insertions(+), 9 deletions(-)
>

Applied to u-boot-stm/master, thanks!

Regards
Patrick


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 4/7] stm32mp: cmd_stm32key: lock of PKH OTP after fuse
  2021-06-28 12:56 ` [PATCH 4/7] stm32mp: cmd_stm32key: lock of PKH OTP after fuse Patrick Delaunay
  2021-07-01  7:35   ` Patrice CHOTARD
@ 2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrick DELAUNAY @ 2021-07-16  8:28 UTC (permalink / raw)
  To: u-boot; +Cc: Patrice Chotard, U-Boot STM32

Hi,

On 6/28/21 2:56 PM, Patrick Delaunay wrote:
> Lock the OTP value of key's hash after the command
> $> stm32key fuse <address>
>
> This operation forbids a second update of these OTP as they are
> ECC protected in BSEC: any update of these OTP with a different value
> causes a BSEC disturb error and the closed chip will be bricked.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/cmd_stm32key.c | 14 ++++++++++----
>   1 file changed, 10 insertions(+), 4 deletions(-)
>

Applied to u-boot-stm/master, thanks!

Regards
Patrick


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 5/7] stm32mp: cmd_stm32key: add get_misc_dev function
  2021-06-28 12:56 ` [PATCH 5/7] stm32mp: cmd_stm32key: add get_misc_dev function Patrick Delaunay
  2021-07-01  7:36   ` Patrice CHOTARD
@ 2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrick DELAUNAY @ 2021-07-16  8:28 UTC (permalink / raw)
  To: u-boot; +Cc: Patrice Chotard, U-Boot STM32

Hi,

On 6/28/21 2:56 PM, Patrick Delaunay wrote:
> Add a helper function to access to BSEC misc driver.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/cmd_stm32key.c | 19 +++++++++++++------
>   1 file changed, 13 insertions(+), 6 deletions(-)
>

Applied to u-boot-stm/master, thanks!

Regards
Patrick


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 6/7] stm32mp: cmd_stm32key: add read OTP subcommand
  2021-06-28 12:56 ` [PATCH 6/7] stm32mp: cmd_stm32key: add read OTP subcommand Patrick Delaunay
  2021-07-01  7:36   ` Patrice CHOTARD
@ 2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrick DELAUNAY @ 2021-07-16  8:28 UTC (permalink / raw)
  To: u-boot; +Cc: Patrice Chotard, U-Boot STM32

Hi,

On 6/28/21 2:56 PM, Patrick Delaunay wrote:
> Allow to read the OTP value and lock status with the command
> $> stm32key read.
>
> This patch also protects the stm32key fuse command.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/cmd_stm32key.c | 93 ++++++++++++++++++++++++++--
>   1 file changed, 87 insertions(+), 6 deletions(-)
>

Applied to u-boot-stm/master, thanks!

Regards
Patrick


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close
  2021-06-28 12:56 ` [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close Patrick Delaunay
  2021-07-01  7:36   ` Patrice CHOTARD
@ 2021-07-16  8:28   ` Patrick DELAUNAY
  1 sibling, 0 replies; 23+ messages in thread
From: Patrick DELAUNAY @ 2021-07-16  8:28 UTC (permalink / raw)
  To: u-boot; +Cc: Patrice Chotard, U-Boot STM32

Hi,

On 6/28/21 2:56 PM, Patrick Delaunay wrote:
> The expected sequence to close the device
>
> 1/ Load key in DDR with any supported load command
> 2/ Update OTP with key: STM32MP> stm32key read <addr>
>
> At this point the device is able to perform image authentication but
> non-authenticated images can still be used and executed.
> So it is the last moment to test boot with signed binary and
> check that the ROM code accepts them.
>
> 3/ Close the device: only signed binary will be accepted !!
>     STM32MP> stm32key close
>
> Warning: Programming these OTP is an irreversible operation!
>           This may brick your system if the HASH of key is invalid
>
> This command should be deactivated by default in real product.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   arch/arm/mach-stm32mp/cmd_stm32key.c | 54 ++++++++++++++++++++++++++--
>   1 file changed, 52 insertions(+), 2 deletions(-)
>

Applied to u-boot-stm/master, thanks!

Regards
Patrick


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close
@ 2021-07-01 13:21 Hexagon Email Recovery
  0 siblings, 0 replies; 23+ messages in thread
From: Hexagon Email Recovery @ 2021-07-01 13:21 UTC (permalink / raw)
  To: u-boot; +Cc: patrick.delaunay, patrice.chotard, uboot-stm32

This message could not be delivered immediately due to an internal mail routing issue.
The mail routing error has been resolved in the meantime.
We apologize for the delay in delivery and any inconvenience this may have caused.
In case of any questions please contact us via it@hexagon.com.

Original sender: patrick.delaunay@foss.st.com
Original delivery time: 28-Jun-2021 01:04 PM (UTC)
-----------------------------------------------------------------------------------------------------------------------
This email is not from Hexagon’s Office 365 instance. Please be careful while clicking links, opening attachments, or replying to this email. The expected sequence to close the device 1/ Load key in DDR with any supported load command 2/ Update OTP with key: STM32MP> stm32key read At this point the device is able to perform image authentication but non-authenticated images can still be used and executed. So it is the last moment to test boot with signed binary and check that the ROM code accepts them. 3/ Close the device: only signed binary will be accepted !! STM32MP> stm32key close Warning: Programming these OTP is an irreversible operation! This may brick your system if the HASH of key is invalid This command should be deactivated by default in real product. Signed-off-by: Patrick Delaunay --- arch/arm/mach-stm32mp/cmd_stm32key.c | 54 ++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c index 8c8d476b65..50840b0f38 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32key.c +++ b/arch/arm/mach-stm32mp/cmd_stm32key.c @@ -210,10 +210,60 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con return CMD_RET_SUCCESS; } +static int do_stm32key_close(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + bool yes, lock, closed; + struct udevice *dev; + u32 val; + int ret; + + yes = false; + if (argc == 2) { + if (strcmp(argv[1], "-y")) + return CMD_RET_USAGE; + yes = true; + } + + ret = read_hash_otp(!yes, &lock, &closed); + if (ret) { + if (ret == -ENOENT) + printf("Error: OTP not programmed!\n"); + return CMD_RET_FAILURE; + } + + if (closed) { + printf("Error: already closed!\n"); + return CMD_RET_FAILURE; + } + + if (!lock) + printf("Warning: OTP not locked!\n"); + + if (!yes && !confirm_prog()) + return CMD_RET_FAILURE; + + ret = get_misc_dev(&dev); + if (ret) + return CMD_RET_FAILURE; + + val = STM32_OTP_CLOSE_MASK; + ret = misc_write(dev, STM32_BSEC_OTP(STM32_OTP_CLOSE_ID), &val, 4); + if (ret != 4) { + printf("Error: can't update OTP\n"); + return CMD_RET_FAILURE; + } + + printf("Device is closed !\n"); + + return CMD_RET_SUCCESS; +} + static char stm32key_help_text[] = "read []: Read the hash stored at addr in memory or in OTP\n" - "stm32key fuse [-y] : Fuse hash stored at addr in OTP\n"; + "stm32key fuse [-y] : Fuse hash stored at addr in OTP\n" + "stm32key close [-y] : Close the device, the hash stored in OTP\n"; U_BOOT_CMD_WITH_SUBCMDS(stm32key, "Fuse ST Hash key", stm32key_help_text, U_BOOT_SUBCMD_MKENT(read, 2, 0, do_stm32key_read), - U_BOOT_SUBCMD_MKENT(fuse, 3, 0, do_stm32key_fuse)); + U_BOOT_SUBCMD_MKENT(fuse, 3, 0, do_stm32key_fuse), + U_BOOT_SUBCMD_MKENT(close, 2, 0, do_stm32key_close)); -- 2.25.1

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2021-07-16  8:29 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 12:55 [PATCH 0/7] stm32mp: cmd_stm32key: updates Patrick Delaunay
2021-06-28 12:55 ` [PATCH 1/7] stm32mp: configs: activate the command stm32key only for ST boards Patrick Delaunay
2021-07-01  7:35   ` Patrice CHOTARD
2021-07-16  8:27   ` Patrick DELAUNAY
2021-06-28 12:55 ` [PATCH 2/7] stm32mp: cmd_stm32key: use sub command Patrick Delaunay
2021-07-01  7:35   ` Patrice CHOTARD
2021-07-16  8:27   ` Patrick DELAUNAY
2021-06-28 12:55 ` [PATCH 3/7] stm32mp: cmd_stm32key: handle error in fuse_hash_value Patrick Delaunay
2021-07-01  7:35   ` Patrice CHOTARD
2021-07-16  8:28   ` Patrick DELAUNAY
2021-06-28 12:56 ` [PATCH 4/7] stm32mp: cmd_stm32key: lock of PKH OTP after fuse Patrick Delaunay
2021-07-01  7:35   ` Patrice CHOTARD
2021-07-16  8:28   ` Patrick DELAUNAY
2021-06-28 12:56 ` [PATCH 5/7] stm32mp: cmd_stm32key: add get_misc_dev function Patrick Delaunay
2021-07-01  7:36   ` Patrice CHOTARD
2021-07-16  8:28   ` Patrick DELAUNAY
2021-06-28 12:56 ` [PATCH 6/7] stm32mp: cmd_stm32key: add read OTP subcommand Patrick Delaunay
2021-07-01  7:36   ` Patrice CHOTARD
2021-07-16  8:28   ` Patrick DELAUNAY
2021-06-28 12:56 ` [PATCH 7/7] stm32mp: cmd_stm32key: add subcommand close Patrick Delaunay
2021-07-01  7:36   ` Patrice CHOTARD
2021-07-16  8:28   ` Patrick DELAUNAY
2021-07-01 13:21 Hexagon Email Recovery

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.