1 // SPDX-License-Identifier: GPL-2.0+
4 * DENX Software Engineering
5 * Heiko Schocher <hs@denx.de>
8 * (C) Copyright 2008 Semihalf
10 * (C) Copyright 2000-2004
11 * DENX Software Engineering
12 * Wolfgang Denk, wd@denx.de
14 * Updated-by: Prafulla Wadaskar <prafulla@marvell.com>
15 * FIT image specific code abstracted from mkimage.c
16 * some functions added to address abstraction
18 * All rights reserved.
22 #include "fit_common.h"
24 #include <u-boot/crc.h>
26 void usage(char *cmdname)
28 fprintf(stderr, "Usage: %s -f fit file -k key file\n"
29 " -f ==> set fit file which should be checked'\n"
30 " -k ==> set key file which contains the key'\n",
35 int main(int argc, char **argv)
44 char *config_name = NULL;
50 strncpy(cmdname, *argv, sizeof(cmdname) - 1);
51 cmdname[sizeof(cmdname) - 1] = '\0';
52 while ((c = getopt(argc, argv, "f:k:c:")) != -1)
69 fprintf(stderr, "%s: Missing fdt file\n", *argv);
73 fprintf(stderr, "%s: Missing key file\n", *argv);
77 ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false, true);
80 kfd = mmap_fdt(cmdname, keyfile, 0, &key_blob, &ksbuf, false, true);
84 image_set_host_blob(key_blob);
85 ret = fit_check_sign(fit_blob, key_blob, config_name);
88 fprintf(stderr, "Signature check OK\n");
91 fprintf(stderr, "Signature check Bad (error %d)\n", ret);
94 (void) munmap((void *)fit_blob, fsbuf.st_size);
95 (void) munmap((void *)key_blob, ksbuf.st_size);