From c54502746919f758bfccedc97757604a40361199 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 1 Aug 2024 09:53:43 +0900 Subject: [PATCH] tools: imagetool: Remove unnecessary check from toc0_verify_cert_item() Remove unnecessary null check from toc0_verify_cert_item() because the array digest is always not null. Change-Id: I0d7f464a6528d89824b533a4224a62113d005291 Ref: https://patchwork.ozlabs.org/project/uboot/patch/20240801010100.21009-1-sw0312.kim@samsung.com/ Reviewed-by: Andre Przywara Signed-off-by: Seung-Woo Kim --- tools/sunxi_toc0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sunxi_toc0.c b/tools/sunxi_toc0.c index 292649fe90..76693647a0 100644 --- a/tools/sunxi_toc0.c +++ b/tools/sunxi_toc0.c @@ -444,7 +444,7 @@ static int toc0_verify_cert_item(const uint8_t *buf, uint32_t len, RSA *fw_key, /* If a digest was provided, compare it to the embedded digest. */ extension = &totalSequence->mainSequence.explicit3.extension; - if (digest && memcmp(&extension->digest, digest, SHA256_DIGEST_LENGTH)) { + if (memcmp(&extension->digest, digest, SHA256_DIGEST_LENGTH)) { pr_err("Wrong firmware digest in certificate\n"); goto err; } -- 2.34.1