diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/fiptool/Makefile | 3 | ||||
-rw-r--r-- | tools/fiptool/fiptool.c | 22 |
2 files changed, 21 insertions, 4 deletions
diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile index 3bc372a28..df76a75e6 100644 --- a/tools/fiptool/Makefile +++ b/tools/fiptool/Makefile @@ -44,6 +44,7 @@ ifeq (${DEBUG},1) else CFLAGS += -O2 endif +LDLIBS := -lcrypto ifeq (${V},0) Q := @ @@ -62,7 +63,7 @@ all: ${PROJECT} fip_create ${PROJECT}: ${OBJECTS} Makefile @echo " LD $@" - ${Q}${CC} ${OBJECTS} -o $@ + ${Q}${CC} ${OBJECTS} -o $@ ${LDLIBS} @${ECHO_BLANK_LINE} @echo "Built $@ successfully" @${ECHO_BLANK_LINE} diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c index 9ae4678a5..b3f02f6ce 100644 --- a/tools/fiptool/fiptool.c +++ b/tools/fiptool/fiptool.c @@ -42,6 +42,8 @@ #include <string.h> #include <unistd.h> +#include <openssl/sha.h> + #include "fiptool.h" #include "firmware_image_package.h" #include "tbbr_config.h" @@ -354,6 +356,14 @@ static void add_opt(struct option *opts, int idx, char *name, opts[idx].val = val; } +static void md_print(unsigned char *md, size_t len) +{ + size_t i; + + for (i = 0; i < len; i++) + printf("%02x", md[i]); +} + static int info_cmd(int argc, char *argv[]) { image_t *image; @@ -391,10 +401,16 @@ static int info_cmd(int argc, char *argv[]) (unsigned long long)image_offset, (unsigned long long)image_size); if (image->toc_entry != NULL) - printf(", cmdline=\"--%s\"\n", + printf(", cmdline=\"--%s\"", image->toc_entry->cmdline_name); - else - putchar('\n'); + if (verbose) { + unsigned char md[SHA256_DIGEST_LENGTH]; + + SHA256(image->buffer, image_size, md); + printf(", sha256="); + md_print(md, sizeof(md)); + } + putchar('\n'); image_offset += image_size; } |