3 * DENX Software Engineering
4 * Heiko Schocher <hs@denx.de>
7 * (C) Copyright 2008 Semihalf
9 * (C) Copyright 2000-2004
10 * DENX Software Engineering
11 * Wolfgang Denk, wd@denx.de
13 * Updated-by: Prafulla Wadaskar <prafulla@marvell.com>
14 * FIT image specific code abstracted from mkimage.c
15 * some functions added to address abstraction
17 * All rights reserved.
19 * SPDX-License-Identifier: GPL-2.0+
23 #include "fit_common.h"
25 #include <u-boot/crc.h>
27 void usage(char *cmdname)
29 fprintf(stderr, "Usage: %s -f fit file -k key file\n"
30 " -f ==> set fit file which should be checked'\n"
31 " -k ==> set key file which contains the key'\n",
36 int main(int argc, char **argv)
50 strncpy(cmdname, *argv, sizeof(cmdname) - 1);
51 cmdname[sizeof(cmdname) - 1] = '\0';
52 while ((c = getopt(argc, argv, "f:k:")) != -1)
66 fprintf(stderr, "%s: Missing fdt file\n", *argv);
70 fprintf(stderr, "%s: Missing key file\n", *argv);
74 ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false);
77 kfd = mmap_fdt(cmdname, keyfile, 0, &key_blob, &ksbuf, false);
81 image_set_host_blob(key_blob);
82 ret = fit_check_sign(fit_blob, key_blob);
85 fprintf(stderr, "Signature check OK\n");
88 fprintf(stderr, "Signature check Bad (error %d)\n", ret);
91 (void) munmap((void *)fit_blob, fsbuf.st_size);
92 (void) munmap((void *)key_blob, ksbuf.st_size);