Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avb_verify: Add rollback_index and location info for option "-I" #6

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions verify/avb_verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ int avb_hash_desc(const char* full_partition_name, struct avb_hash_desc_t* desc)
avb_vbmeta_image_header_to_host_byte_order((AvbVBMetaImageHeader*)vbmeta_buf,
&vbmeta_header);

desc->rollback_index_location = vbmeta_header.rollback_index_location;
desc->rollback_index = vbmeta_header.rollback_index;

descriptors = avb_descriptor_get_all(vbmeta_buf, vbmeta_num_read, &num_descriptors);
if (!avb_descriptor_validate_and_byteswap(descriptors[0], &avb_desc)) {
avb_error(full_partition_name, ": Descriptor is invalid.\n");
Expand Down Expand Up @@ -457,4 +460,6 @@ void avb_hash_desc_dump(const struct avb_hash_desc_t* desc)
avb_printf("%02" PRIx8 "", desc->digest[i]);
}
avb_printf("\n");
avb_printf("%-16s : %" PRIu32 "\n", "Rollback Loc", desc->rollback_index_location);
avb_printf("%-16s : %" PRIu64 "\n", "Rollback Index", desc->rollback_index);
}
2 changes: 2 additions & 0 deletions verify/avb_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ struct avb_hash_desc_t {
uint8_t hash_algorithm[32]; /* Ref: struct AvbHashDescriptor */
uint32_t digest_len;
uint8_t digest[64]; /* Max: sha512 */
uint32_t rollback_index_location;
uint64_t rollback_index;
};

extern uint64_t g_rollback_index;
Expand Down
Loading