]> git.baikalelectronics.ru Git - uboot.git/commitdiff
arm: socfpga: cmd: Support 'vab' command
authorSiew Chin Lim <elly.siew.chin.lim@intel.com>
Mon, 1 Mar 2021 12:04:12 +0000 (20:04 +0800)
committerLey Foon Tan <ley.foon.tan@intel.com>
Mon, 8 Mar 2021 02:59:10 +0000 (10:59 +0800)
Support 'vab' command to perform vendor authentication.

Command format: vab addr len
Authorize 'len' bytes starting at 'addr' via vendor public key

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
arch/arm/mach-socfpga/Makefile
arch/arm/mach-socfpga/vab.c [new file with mode: 0644]

index 1f1e21766d1db399b9176bafa457a43318bb2957..9e63296b385fbf3c2dce3fd488823042d2ee6070 100644 (file)
@@ -51,6 +51,7 @@ obj-y += reset_manager_s10.o
 obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH)  += secure_vab.o
 obj-y  += system_manager_s10.o
 obj-y  += timer_s10.o
+obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH)  += vab.o
 obj-y  += wrap_pinmux_config_s10.o
 obj-y  += wrap_pll_config_s10.o
 endif
diff --git a/arch/arm/mach-socfpga/vab.c b/arch/arm/mach-socfpga/vab.c
new file mode 100644 (file)
index 0000000..85b3f30
--- /dev/null
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <asm/arch/secure_vab.h>
+#include <command.h>
+#include <common.h>
+#include <linux/ctype.h>
+
+static int do_vab(struct cmd_tbl *cmdtp, int flag, int argc,
+                 char *const argv[])
+{
+       unsigned long addr, len;
+
+       if (argc < 3)
+               return CMD_RET_USAGE;
+
+       addr = simple_strtoul(argv[1], NULL, 16);
+       len = simple_strtoul(argv[2], NULL, 16);
+
+       if (socfpga_vendor_authentication((void *)&addr, (size_t *)&len) != 0)
+               return CMD_RET_FAILURE;
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       vab,    3,      2,      do_vab,
+       "perform vendor authorization",
+       "addr len   - authorize 'len' bytes starting at\n"
+       "                 'addr' via vendor public key"
+);