From 651b0d0dfc227963b3463eb0da4a9ce5a30e28a9 Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Fri, 30 Oct 2020 14:59:31 +0800 Subject: [PATCH] common: android: move crypto_sha_init() after load IMG_RK_DTB We call crypto to verify dtb alone, so move the crypto_sha_init() after load IMG_RK_DTB when begin another hash verification. Signed-off-by: Jason Zhu Change-Id: I12f36172a5d03fa8baa0236503be5627fa18adf0 --- common/image-android.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/image-android.c b/common/image-android.c index 6933abddfd..e5ba457f49 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -523,11 +523,11 @@ static int android_image_separate(struct andr_img_hdr *hdr, if (hdr->header_version > 1) ctx.length += hdr->dtb_size + sizeof(hdr->dtb_size); - crypto_sha_init(dev, &ctx); - /* load, never change order ! */ if (image_load(IMG_RK_DTB, hdr, bstart, ram_base, NULL)) return -1; + + crypto_sha_init(dev, &ctx); if (image_load(IMG_KERNEL, hdr, bstart, ram_base, dev)) return -1; if (image_load(IMG_RAMDISK, hdr, bstart, ram_base, dev))