diff options
| author | Daniel Golle <[email protected]> | 2025-03-29 23:24:31 +0000 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-04-10 20:55:53 -0600 |
| commit | 9c79c8fe70da7cd05fa4c242197f14122f245d81 (patch) | |
| tree | 7b994e4990c70c77c433357cb5be712d24d7a84f /tools | |
| parent | 40dcd5088b7f64ee2841c233c8ab82ce9c188d73 (diff) | |
tools/fit_check_sign: make key optional
Allow invoking fit_check_sig without the key parameter, allowing to
validate only checksums and hashes for unsigned images.
Signed-off-by: Daniel Golle <[email protected]>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/Makefile | 3 | ||||
| -rw-r--r-- | tools/fit_check_sign.c | 19 |
2 files changed, 10 insertions, 12 deletions
diff --git a/tools/Makefile b/tools/Makefile index d0e4d2d16c3..97ce1dbb17e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -63,8 +63,7 @@ HOSTCFLAGS_img2srec.o := -pedantic hostprogs-y += mkenvimage mkenvimage-objs := mkenvimage.o os_support.o generated/lib/crc32.o -hostprogs-y += dumpimage mkimage -hostprogs-$(CONFIG_TOOLS_LIBCRYPTO) += fit_info fit_check_sign +hostprogs-y += dumpimage mkimage fit_info fit_check_sign hostprogs-$(CONFIG_TOOLS_LIBCRYPTO) += fdt_add_pubkey hostprogs-$(CONFIG_TOOLS_LIBCRYPTO) += preload_check_sign diff --git a/tools/fit_check_sign.c b/tools/fit_check_sign.c index 3d1d33fdab1..32d0fdb8829 100644 --- a/tools/fit_check_sign.c +++ b/tools/fit_check_sign.c @@ -45,7 +45,7 @@ int main(int argc, char **argv) char *config_name = NULL; char cmdname[256]; int ret; - void *key_blob; + void *key_blob = NULL; int c; strncpy(cmdname, *argv, sizeof(cmdname) - 1); @@ -70,18 +70,15 @@ int main(int argc, char **argv) fprintf(stderr, "%s: Missing fdt file\n", *argv); usage(*argv); } - if (!keyfile) { - fprintf(stderr, "%s: Missing key file\n", *argv); - usage(*argv); - } ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false, true); if (ffd < 0) return EXIT_FAILURE; - kfd = mmap_fdt(cmdname, keyfile, 0, &key_blob, &ksbuf, false, true); - if (kfd < 0) - return EXIT_FAILURE; - + if (keyfile) { + kfd = mmap_fdt(cmdname, keyfile, 0, &key_blob, &ksbuf, false, true); + if (kfd < 0) + return EXIT_FAILURE; + } image_set_host_blob(key_blob); ret = fit_check_sign(fit_blob, key_blob, config_name); if (!ret) { @@ -93,7 +90,9 @@ int main(int argc, char **argv) } (void) munmap((void *)fit_blob, fsbuf.st_size); - (void) munmap((void *)key_blob, ksbuf.st_size); + + if (key_blob) + (void)munmap((void *)key_blob, ksbuf.st_size); close(ffd); close(kfd); |
