[avb] Set rollback index to 0 to make rollback index check pass
Prior to this cl, the VBMeta rollback index is compared to
uninitialized `out_rollback_index`.
Test: m pvmfw_img && atest libpvmfw_avb.integration_test
Bug: 256148034
Change-Id: I40f6b548adc7d0311fea3191c3e90e6e337fcdf2
diff --git a/pvmfw/avb/src/ops.rs b/pvmfw/avb/src/ops.rs
index 903fecb..03c05af 100644
--- a/pvmfw/avb/src/ops.rs
+++ b/pvmfw/avb/src/ops.rs
@@ -229,15 +229,13 @@
extern "C" fn read_rollback_index(
_ops: *mut AvbOps,
_rollback_index_location: usize,
- _out_rollback_index: *mut u64,
+ out_rollback_index: *mut u64,
) -> AvbIOResult {
- // TODO(b/256148034): Write -1 to out_rollback_index
- // so that we won't compare the current rollback index with uninitialized number
- // in avb_slot_verify.
-
- // Rollback protection is not yet implemented, but
- // this method is required by `avb_slot_verify()`.
- AvbIOResult::AVB_IO_RESULT_OK
+ // Rollback protection is not yet implemented, but this method is required by
+ // `avb_slot_verify()`.
+ // We set `out_rollback_index` to 0 to ensure that the default rollback index (0)
+ // is never smaller than it, thus the rollback index check will pass.
+ to_avb_io_result(write(out_rollback_index, 0))
}
extern "C" fn get_unique_guid_for_partition(