libavb: Make it possible to load other partitions than 'boot'.
Boot loaders may need to load other partitions than just 'boot'. For
example in a setup where both the Secure OS and Android is managed and
updated under the same A/B regime, the boot loader needs to load and
verify both of these and start both of them.
Concretely, make avb_slot_verify() and avb_ab_flow() take a list of
partition name to load and extend AvbSlotVerifyData to contain an array
of the partitions that were loaded.
Bug: None
Test: New unit tests and unit tests pass.
Test: Tested in UEFI-based bootloader and qemu.
Change-Id: I5c369faebf707f87df41418223ce94506d86058e
diff --git a/libavb/avb_ab_flow.c b/libavb/avb_ab_flow.c
index 7e11e27..7423f8f 100644
--- a/libavb/avb_ab_flow.c
+++ b/libavb/avb_ab_flow.c
@@ -194,7 +194,9 @@
return AVB_IO_RESULT_OK;
}
-AvbABFlowResult avb_ab_flow(AvbOps* ops, AvbSlotVerifyData** out_data) {
+AvbABFlowResult avb_ab_flow(AvbOps* ops,
+ const char* const* requested_partitions,
+ AvbSlotVerifyData** out_data) {
AvbSlotVerifyData* slot_data[2] = {NULL, NULL};
AvbSlotVerifyData* data = NULL;
AvbABFlowResult ret;
@@ -215,7 +217,8 @@
for (n = 0; n < 2; n++) {
if (slot_is_bootable(&ab_data.slots[n])) {
AvbSlotVerifyResult verify_result;
- verify_result = avb_slot_verify(ops, slot_suffixes[n], &slot_data[n]);
+ verify_result = avb_slot_verify(ops, requested_partitions,
+ slot_suffixes[n], &slot_data[n]);
if (verify_result != AVB_SLOT_VERIFY_RESULT_OK) {
if (verify_result == AVB_SLOT_VERIFY_RESULT_ERROR_OOM) {
ret = AVB_AB_FLOW_RESULT_ERROR_OOM;