mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-29 02:21:31 +00:00
The prototype and defination of function fsl_secboot_validate has been changed to support calling this function from another function within u-boot. Only two aruments needed: 1) header address - Mandatory 2) SHA256 string - optional Signed-off-by: Saksham Jain <saksham@freescale.com> Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com> Acked-by: Ruchika Gupta <ruchika.gupta@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
/*
|
|
* 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_halt(cmd_tbl_t *cmdtp, int flag, int argc,
|
|
char * const argv[])
|
|
{
|
|
printf("Core is entering spin loop.\n");
|
|
loop:
|
|
goto loop;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc,
|
|
char * const argv[])
|
|
{
|
|
char *hash_str = NULL;
|
|
ulong haddr;
|
|
int ret;
|
|
|
|
if (argc < 2)
|
|
return cmd_usage(cmdtp);
|
|
else if (argc > 2)
|
|
/* Second arg - Optional - Hash Str*/
|
|
hash_str = argv[2];
|
|
|
|
/* First argument - header address -32/64bit */
|
|
haddr = simple_strtoul(argv[1], NULL, 16);
|
|
|
|
ret = fsl_secboot_validate(haddr, hash_str);
|
|
if (ret)
|
|
return 1;
|
|
|
|
printf("esbc_validate command successful\n");
|
|
return 0;
|
|
}
|
|
|
|
/***************************************************/
|
|
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
|
|
);
|
|
|
|
U_BOOT_CMD(
|
|
esbc_halt, 1, 0, do_esbc_halt,
|
|
"Put the core in spin loop ",
|
|
""
|
|
);
|