| .. | .. |
|---|
| 22 | 22 | * SOFTWARE. |
|---|
| 23 | 23 | */ |
|---|
| 24 | 24 | #include <common.h> |
|---|
| 25 | | -#include <sysmem.h> |
|---|
| 25 | +#include <android_image.h> |
|---|
| 26 | 26 | #include <android_avb/avb_slot_verify.h> |
|---|
| 27 | 27 | #include <android_avb/avb_chain_partition_descriptor.h> |
|---|
| 28 | 28 | #include <android_avb/avb_cmdline.h> |
|---|
| .. | .. |
|---|
| 30 | 30 | #include <android_avb/avb_hash_descriptor.h> |
|---|
| 31 | 31 | #include <android_avb/avb_hashtree_descriptor.h> |
|---|
| 32 | 32 | #include <android_avb/avb_kernel_cmdline_descriptor.h> |
|---|
| 33 | +#include <android_avb/avb_ops_user.h> |
|---|
| 33 | 34 | #include <android_avb/avb_sha.h> |
|---|
| 34 | 35 | #include <android_avb/avb_util.h> |
|---|
| 35 | 36 | #include <android_avb/avb_vbmeta_image.h> |
|---|
| .. | .. |
|---|
| 118 | 119 | |
|---|
| 119 | 120 | /* Allocate and copy the partition. */ |
|---|
| 120 | 121 | if (!*out_image_preloaded) { |
|---|
| 121 | | - *out_image_buf = sysmem_alloc(MEM_AVB_ANDROID, image_size); |
|---|
| 122 | + *out_image_buf = avb_malloc(image_size); |
|---|
| 122 | 123 | if (*out_image_buf == NULL) { |
|---|
| 123 | 124 | return AVB_SLOT_VERIFY_RESULT_ERROR_OOM; |
|---|
| 124 | 125 | } |
|---|
| .. | .. |
|---|
| 296 | 297 | bool image_preloaded = false; |
|---|
| 297 | 298 | uint8_t* digest; |
|---|
| 298 | 299 | size_t digest_len; |
|---|
| 299 | | - const char* found; |
|---|
| 300 | + const char* found = NULL; |
|---|
| 300 | 301 | uint64_t image_size; |
|---|
| 301 | 302 | size_t expected_digest_len = 0; |
|---|
| 302 | 303 | uint8_t expected_digest_buf[AVB_SHA512_DIGEST_SIZE]; |
|---|
| .. | .. |
|---|
| 388 | 389 | allow_verification_error); |
|---|
| 389 | 390 | if (ret != AVB_SLOT_VERIFY_RESULT_OK) { |
|---|
| 390 | 391 | goto out; |
|---|
| 391 | | - } else if (image_preloaded) { |
|---|
| 392 | + } else if (allow_verification_error) { |
|---|
| 392 | 393 | goto out; |
|---|
| 393 | 394 | } |
|---|
| 394 | 395 | |
|---|
| .. | .. |
|---|
| 482 | 483 | |
|---|
| 483 | 484 | fail: |
|---|
| 484 | 485 | if (image_buf != NULL && !image_preloaded) { |
|---|
| 485 | | - sysmem_free((phys_addr_t)image_buf); |
|---|
| 486 | + avb_free(image_buf); |
|---|
| 486 | 487 | } |
|---|
| 487 | 488 | return ret; |
|---|
| 488 | 489 | } |
|---|
| .. | .. |
|---|
| 556 | 557 | out: |
|---|
| 557 | 558 | /* Free the current buffer if any. */ |
|---|
| 558 | 559 | if (image_buf != NULL && !image_preloaded) { |
|---|
| 559 | | - sysmem_free((phys_addr_t)image_buf); |
|---|
| 560 | + avb_free(image_buf); |
|---|
| 560 | 561 | } |
|---|
| 561 | 562 | /* Buffers that are already saved in slot_data will be handled by the caller |
|---|
| 562 | 563 | * even on failure. */ |
|---|
| .. | .. |
|---|
| 1662 | 1663 | avb_free(loaded_partition->partition_name); |
|---|
| 1663 | 1664 | } |
|---|
| 1664 | 1665 | if (loaded_partition->data != NULL && !loaded_partition->preloaded) { |
|---|
| 1665 | | - sysmem_free((phys_addr_t)loaded_partition->data); |
|---|
| 1666 | + avb_free(loaded_partition->data); |
|---|
| 1666 | 1667 | } |
|---|
| 1667 | 1668 | } |
|---|
| 1668 | 1669 | avb_free(data->loaded_partitions); |
|---|