summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/image-fit.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/common/image-fit.c b/common/image-fit.c
index c1a34a440..38a372ff5 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -371,7 +371,6 @@ static int fit_verify_hash(struct fit_handle *handle, struct device_node *image,
struct digest *d;
const char *algo;
const char *value_read;
- char *value_calc;
int hash_len, ret;
struct device_node *hash;
@@ -418,13 +417,10 @@ static int fit_verify_hash(struct fit_handle *handle, struct device_node *image,
goto err_digest_free;
}
- value_calc = xmalloc(hash_len);
-
digest_init(d);
digest_update(d, data, data_len);
- digest_final(d, value_calc);
- if (memcmp(value_read, value_calc, hash_len)) {
+ if (digest_verify(d, value_read)) {
pr_info("%s: hash BAD\n", hash->full_name);
ret = -EBADMSG;
} else {
@@ -432,8 +428,6 @@ static int fit_verify_hash(struct fit_handle *handle, struct device_node *image,
ret = 0;
}
- free(value_calc);
-
err_digest_free:
digest_free(d);