common: android: crypto v2 hash need length in crypto_sha_init
if not set ctx.length, you will get zero length hash value. Change-Id: I9e653c845a36b4caea986c328c48ea8b2835da75 Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
This commit is contained in:
parent
c48f1acf4a
commit
1817f8c289
|
|
@ -513,8 +513,7 @@ static int android_image_separate(struct andr_img_hdr *hdr,
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ROCKCHIP_CRYPTO_V1
|
||||
/* v1: requires total length before sha init */
|
||||
/* v1 & v2: requires total length before sha init */
|
||||
ctx.length += hdr->kernel_size + sizeof(hdr->kernel_size) +
|
||||
hdr->ramdisk_size + sizeof(hdr->ramdisk_size) +
|
||||
hdr->second_size + sizeof(hdr->second_size);
|
||||
|
|
@ -523,7 +522,7 @@ static int android_image_separate(struct andr_img_hdr *hdr,
|
|||
sizeof(hdr->recovery_dtbo_size);
|
||||
if (hdr->header_version > 1)
|
||||
ctx.length += hdr->dtb_size + sizeof(hdr->dtb_size);
|
||||
#endif
|
||||
|
||||
crypto_sha_init(dev, &ctx);
|
||||
|
||||
/* load, never change order ! */
|
||||
|
|
|
|||
Loading…
Reference in New Issue