hc
2023-11-06 9df731a176aab8e03b984b681b1bea01ccff6644
u-boot/lib/avb/libavb/avb_slot_verify.c
....@@ -22,7 +22,7 @@
2222 * SOFTWARE.
2323 */
2424 #include <common.h>
25
-#include <sysmem.h>
25
+#include <android_image.h>
2626 #include <android_avb/avb_slot_verify.h>
2727 #include <android_avb/avb_chain_partition_descriptor.h>
2828 #include <android_avb/avb_cmdline.h>
....@@ -30,6 +30,7 @@
3030 #include <android_avb/avb_hash_descriptor.h>
3131 #include <android_avb/avb_hashtree_descriptor.h>
3232 #include <android_avb/avb_kernel_cmdline_descriptor.h>
33
+#include <android_avb/avb_ops_user.h>
3334 #include <android_avb/avb_sha.h>
3435 #include <android_avb/avb_util.h>
3536 #include <android_avb/avb_vbmeta_image.h>
....@@ -118,7 +119,7 @@
118119
119120 /* Allocate and copy the partition. */
120121 if (!*out_image_preloaded) {
121
- *out_image_buf = sysmem_alloc(MEM_AVB_ANDROID, image_size);
122
+ *out_image_buf = avb_malloc(image_size);
122123 if (*out_image_buf == NULL) {
123124 return AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
124125 }
....@@ -296,7 +297,7 @@
296297 bool image_preloaded = false;
297298 uint8_t* digest;
298299 size_t digest_len;
299
- const char* found;
300
+ const char* found = NULL;
300301 uint64_t image_size;
301302 size_t expected_digest_len = 0;
302303 uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE];
....@@ -388,7 +389,7 @@
388389 allow_verification_error);
389390 if (ret != AVB_SLOT_VERIFY_RESULT_OK) {
390391 goto out;
391
- } else if (image_preloaded) {
392
+ } else if (allow_verification_error) {
392393 goto out;
393394 }
394395
....@@ -482,7 +483,7 @@
482483
483484 fail:
484485 if (image_buf != NULL && !image_preloaded) {
485
- sysmem_free((phys_addr_t)image_buf);
486
+ avb_free(image_buf);
486487 }
487488 return ret;
488489 }
....@@ -556,7 +557,7 @@
556557 out:
557558 /* Free the current buffer if any. */
558559 if (image_buf != NULL && !image_preloaded) {
559
- sysmem_free((phys_addr_t)image_buf);
560
+ avb_free(image_buf);
560561 }
561562 /* Buffers that are already saved in slot_data will be handled by the caller
562563 * even on failure. */
....@@ -1662,7 +1663,7 @@
16621663 avb_free(loaded_partition->partition_name);
16631664 }
16641665 if (loaded_partition->data != NULL && !loaded_partition->preloaded) {
1665
- sysmem_free((phys_addr_t)loaded_partition->data);
1666
+ avb_free(loaded_partition->data);
16661667 }
16671668 }
16681669 avb_free(data->loaded_partitions);