[PATCH] tools: imagetool: Remove unnecessary check from toc0_verify_cert_item()

Seung-Woo Kim sw0312.kim at samsung.com
Thu Aug 1 03:01:00 CEST 2024


Remove unnecessary null check from toc0_verify_cert_item()
because the array digest is always not null.

Signed-off-by: Seung-Woo Kim <sw0312.kim at samsung.com>
---
 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 292649fe90f1..76693647a095 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.19.2



More information about the U-Boot mailing list