From 1d1556a5b1f5a4206bb24430562227e8727b9d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20H=C3=B6glund?= <jonas.hoglund@embeddednation.com> Date: Tue, 6 Apr 2021 15:05:11 +0200 Subject: [PATCH] Print hash algo. --- fdtextract.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fdtextract.c b/fdtextract.c index 4308645..d134e90 100644 --- a/fdtextract.c +++ b/fdtextract.c @@ -149,7 +149,8 @@ static int get_hash(char *buf, char *name) { char path[MAX_PATH_LEN]; int noffset, i; - uint8_t *val; + uint8_t *val = NULL; + const char *algo; snprintf(path, MAX_PATH_LEN, "/images/%s/hash-1", name); noffset = fdt_path_offset(buf, path); @@ -158,15 +159,17 @@ static int get_hash(char *buf, char *name) return -1; } - val = (uint8_t *)fdt_getprop(buf, noffset, "algo", NULL); - if (strcmp((const char *)val, "sha256")) { + algo = fdt_getprop(buf, noffset, "algo", NULL); + if (strcmp(algo, "sha256")) { printf("Error: unknown hash algorithm %s\n", val); return -1; } val = (uint8_t *)fdt_getprop(buf, noffset, "value", NULL); + printf("%s ", algo); for (i=0; i<SHA_256_LEN; i++) printf("%x", val[i]); + printf("\n"); return 0; } -- GitLab