1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2015 Freescale Semiconductor, Inc.
9 #include <fsl_validate.h>
11 int do_esbc_halt(struct cmd_tbl *cmdtp, int flag, int argc,
14 if (fsl_check_boot_mode_secure() == 0) {
15 printf("Boot Mode is Non-Secure. Not entering spin loop.\n");
19 printf("Core is entering spin loop.\n");
26 #ifndef CONFIG_SPL_BUILD
27 static int do_esbc_validate(struct cmd_tbl *cmdtp, int flag, int argc,
30 char *hash_str = NULL;
33 uintptr_t img_addr = 0;
37 return cmd_usage(cmdtp);
39 /* Second arg - Optional - Hash Str*/
42 /* First argument - header address -32/64bit */
43 haddr = (uintptr_t)simple_strtoul(argv[1], NULL, 16);
45 /* With esbc_validate command, Image address must be
46 * part of header. So, the function is called
47 * by passing this argument as 0.
49 ret = fsl_secboot_validate(haddr, hash_str, &img_addr);
51 /* Need to set "img_addr" even if validation failure.
52 * Required when SB_EN in RCW set and non-fatal error
55 sprintf(buf, "%lx", img_addr);
56 env_set("img_addr", buf);
61 printf("esbc_validate command successful\n");
65 /***************************************************/
66 static char esbc_validate_help_text[] =
67 "esbc_validate hdr_addr <hash_val> - Validates signature using\n"
69 " $hdr_addr Address of header of the image\n"
71 " $hash_val -Optional\n"
72 " It provides Hash of public/srk key to be\n"
73 " used to verify signature.\n";
76 esbc_validate, 3, 0, do_esbc_validate,
77 "Validates signature on a given image using RSA verification",
78 esbc_validate_help_text
82 esbc_halt, 1, 0, do_esbc_halt,
83 "Put the core in spin loop (Secure Boot Only)",