tools: imagetool: Remove unnecessary check from toc0_verify_cert_item() 26/315426/3 accepted/tizen/unified/20240806.010530 accepted/tizen/unified/dev/20240807.093111 accepted/tizen/unified/x/20240806.104704
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 1 Aug 2024 00:53:43 +0000 (09:53 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 5 Aug 2024 03:00:26 +0000 (03:00 +0000)
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 <andre.przywara@arm.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
tools/sunxi_toc0.c

index 292649fe90f1487929ffd74cafddf78332cdb70c..76693647a095f8bf6cb404ef0ff69f06e8910b44 100644 (file)
@@ -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;
        }