From b5f72fd0e3142b3a3b437cfebe1cc2cc4a116144 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Thu, 15 May 2025 22:44:31 +0800 Subject: [PATCH 1/2] ota/verify: Assert if calculating MD failed e.g. Selected LIB_AVB_SHA256_CRYPTODEV but hardware/driver is not ready. Signed-off-by: wangjianyu3 --- verify/zip_verify.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/verify/zip_verify.c b/verify/zip_verify.c index abe51a8..2c7805f 100644 --- a/verify/zip_verify.c +++ b/verify/zip_verify.c @@ -243,6 +243,7 @@ static int verify_signature(data_block_t* pubkey, data_block_t* raw_data, data_b avb_sha256_update( &sha256_ctx, raw_data->data, raw_data->length); computed_hash = avb_sha256_final(&sha256_ctx); + assert_res(computed_hash != NULL, "Calculating MD failed!"); res = !avb_rsa_verify(pubkey->data, pubkey->length, signature->data, signature->length, @@ -414,7 +415,7 @@ static int verify_app(const char* app_path, const char* cert_path, size_t commen res = verify_signature(&avbkey, &signature_info.signed_data, &signature_info.signatures_content); free(avbkey.data); - assert_res(res == 0); + assert_res(res == 0, "Verify signature failed!"); // Compare whether the app summary is consistent with the signature block summary res = verify_digest(app_path, app_block, &signature_info.one_digest); From bcf5c3b1bea301c5bff9f76977ca778430ecef4f Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Tue, 20 May 2025 18:22:08 +0800 Subject: [PATCH 2/2] ota/tools: Summarize verify spent time Signed-off-by: wangjianyu3 --- tools/gen_ota_zip.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/gen_ota_zip.py b/tools/gen_ota_zip.py index 144cc46..4fbffe0 100755 --- a/tools/gen_ota_zip.py +++ b/tools/gen_ota_zip.py @@ -337,7 +337,8 @@ def gen_full_sh(path_list, bin_list, args, tmp_folder): for i in range(len(verify_list)): str = \ ''' -avb_verify -U /ota/%s %s /etc/key.avb +echo "verify %s"%s +time "avb_verify -U /ota/%s %s /etc/key.avb" if [ $? -ne 0 ] then echo "Check %s version failed!"%s @@ -345,7 +346,7 @@ def gen_full_sh(path_list, bin_list, args, tmp_folder): reboot fi setprop ota.progress.current %d -''' % (verify_list[i], verify_path[i], verify_list[i], args.otalog, verify_progress_list[i]) +''' % (verify_list[i], args.otalog, verify_list[i], verify_path[i], verify_list[i], args.otalog, verify_progress_list[i]) str += 'setprop ota.progress.next %d\n' % ( verify_progress_list[i + 1] if i + 1 < len(verify_list) else ota_progress_list[0]) fd.write(str)