Rename "rollback index slot" to "rollback index location".
This is because the word slot is already used in the context of
A/B. Less confusing this way.
Bug: 33100927
Test: New unit tests and all unit tests pass.
Test: Manually tested on UEFI based bootloader.
Change-Id: Ic611b02dc18e7dd9f14c2c87b247be3cd8f4aaf2
diff --git a/README b/README
index 7bea96c..1d5a994 100644
--- a/README
+++ b/README
@@ -186,7 +186,7 @@
[--public_key_metadata /path/to/pkmd.bin] [--rollback_index NUMBER] \
[--include_descriptors_from_footer /path/to/image.bin] \
[--generate_dm_verity_cmdline_from_footer /path/to/image.bin] \
- [--chain_partition part_name:rollback_index_slot:/path/to/key1.bin]
+ [--chain_partition part_name:rollback_index_location:/path/to/key1.bin]
An integrity footer containing the hash for an entire partition can be
added to an existing image as follows:
diff --git a/avbtool b/avbtool
index 16d557b..3a04de6 100755
--- a/avbtool
+++ b/avbtool
@@ -1289,7 +1289,7 @@
See the |AvbChainPartitionDescriptor| C struct for more information.
Attributes:
- rollback_index_slot: The rollback index slot to use.
+ rollback_index_location: The rollback index location to use.
partition_name: Partition name.
public_key: Bytes for the public key.
"""
@@ -1298,7 +1298,7 @@
RESERVED = 64
SIZE = 28 + RESERVED
FORMAT_STRING = ('!QQ' # tag, num_bytes_following (descriptor header)
- 'L' # rollback_index_slot
+ 'L' # rollback_index_location
'L' # partition_name_size (bytes)
'L' + # public_key_size (bytes)
str(RESERVED) + 's') # reserved
@@ -1316,7 +1316,8 @@
assert struct.calcsize(self.FORMAT_STRING) == self.SIZE
if data:
- (tag, num_bytes_following, self.rollback_index_slot, partition_name_len,
+ (tag, num_bytes_following, self.rollback_index_location,
+ partition_name_len,
public_key_len, _) = struct.unpack(self.FORMAT_STRING, data[0:self.SIZE])
expected_size = round_to_multiple(
self.SIZE - 16 + partition_name_len + public_key_len, 8)
@@ -1332,7 +1333,7 @@
self.public_key = data[(self.SIZE + o):(self.SIZE + o + public_key_len)]
else:
- self.rollback_index_slot = 0
+ self.rollback_index_location = 0
self.partition_name = ''
self.public_key = bytearray()
@@ -1343,12 +1344,12 @@
o: The object to write the output to.
"""
o.write(' Chain Partition descriptor:\n')
- o.write(' Partition Name: {}\n'.format(self.partition_name))
- o.write(' Rollback Index Slot: {}\n'.format(
- self.rollback_index_slot))
+ o.write(' Partition Name: {}\n'.format(self.partition_name))
+ o.write(' Rollback Index Location: {}\n'.format(
+ self.rollback_index_location))
# Just show the SHA1 of the key, for size reasons.
hexdig = hashlib.sha1(self.public_key).hexdigest()
- o.write(' Public key (sha1): {}\n'.format(hexdig))
+ o.write(' Public key (sha1): {}\n'.format(hexdig))
def encode(self):
"""Serializes the descriptor.
@@ -1362,7 +1363,7 @@
nbf_with_padding = round_to_multiple(num_bytes_following, 8)
padding_size = nbf_with_padding - num_bytes_following
desc = struct.pack(self.FORMAT_STRING, self.TAG, nbf_with_padding,
- self.rollback_index_slot, len(encoded_name),
+ self.rollback_index_location, len(encoded_name),
len(self.public_key), self.RESERVED*'\0')
padding = struct.pack(str(padding_size) + 'x')
ret = desc + encoded_name + self.public_key + padding
@@ -1843,9 +1844,9 @@
raise AvbError('Malformed chained partition "{}".'.format(cp))
desc = AvbChainPartitionDescriptor()
desc.partition_name = cp_tokens[0]
- desc.rollback_index_slot = int(cp_tokens[1])
- if desc.rollback_index_slot < 1:
- raise AvbError('Rollback index slot must be 1 or larger.')
+ desc.rollback_index_location = int(cp_tokens[1])
+ if desc.rollback_index_location < 1:
+ raise AvbError('Rollback index location must be 1 or larger.')
file_path = cp_tokens[2]
desc.public_key = open(file_path, 'rb').read()
descriptors.append(desc)
diff --git a/libavb/avb_chain_partition_descriptor.c b/libavb/avb_chain_partition_descriptor.c
index 40e8bb5..3f14232 100644
--- a/libavb/avb_chain_partition_descriptor.c
+++ b/libavb/avb_chain_partition_descriptor.c
@@ -40,12 +40,12 @@
return false;
}
- dest->rollback_index_slot = avb_be32toh(dest->rollback_index_slot);
+ dest->rollback_index_location = avb_be32toh(dest->rollback_index_location);
dest->partition_name_len = avb_be32toh(dest->partition_name_len);
dest->public_key_len = avb_be32toh(dest->public_key_len);
- if (dest->rollback_index_slot < 1) {
- avb_error("Invalid rollback index slot value.\n");
+ if (dest->rollback_index_location < 1) {
+ avb_error("Invalid rollback index location value.\n");
return false;
}
diff --git a/libavb/avb_chain_partition_descriptor.h b/libavb/avb_chain_partition_descriptor.h
index 817f74f..f2c9250 100644
--- a/libavb/avb_chain_partition_descriptor.h
+++ b/libavb/avb_chain_partition_descriptor.h
@@ -38,7 +38,7 @@
/* A descriptor containing a pointer to signed integrity data stored
* on another partition. The descriptor contains the partition name in
* question (without the A/B suffix), the public key used to sign the
- * integrity data, and rollback index slot to use for rollback
+ * integrity data, and rollback index location to use for rollback
* protection.
*
* Following this struct are |partition_name_len| bytes of the
@@ -50,7 +50,7 @@
*/
typedef struct AvbChainPartitionDescriptor {
AvbDescriptor parent_descriptor;
- uint32_t rollback_index_slot;
+ uint32_t rollback_index_location;
uint32_t partition_name_len;
uint32_t public_key_len;
uint8_t reserved[64];
diff --git a/libavb/avb_ops.h b/libavb/avb_ops.h
index cdc04af..e3f8c7c 100644
--- a/libavb/avb_ops.h
+++ b/libavb/avb_ops.h
@@ -133,28 +133,30 @@
size_t public_key_metadata_length,
bool* out_is_trusted);
- /* Gets the rollback index corresponding to the slot given by
- * |rollback_index_slot|. The value is returned in
+ /* Gets the rollback index corresponding to the location given by
+ * |rollback_index_location|. The value is returned in
* |out_rollback_index|. Returns AVB_IO_RESULT_OK if the rollback
* index was retrieved, otherwise an error code.
*
- * A device may have a limited amount of rollback index slots (say,
- * one or four) so may error out if |rollback_index_slot| exceeds
+ * A device may have a limited amount of rollback index locations (say,
+ * one or four) so may error out if |rollback_index_location| exceeds
* this number.
*/
- AvbIOResult (*read_rollback_index)(AvbOps* ops, size_t rollback_index_slot,
+ AvbIOResult (*read_rollback_index)(AvbOps* ops,
+ size_t rollback_index_location,
uint64_t* out_rollback_index);
- /* Sets the rollback index corresponding to the slot given by
- * |rollback_index_slot| to |rollback_index|. Returns
+ /* Sets the rollback index corresponding to the location given by
+ * |rollback_index_location| to |rollback_index|. Returns
* AVB_IO_RESULT_OK if the rollback index was set, otherwise an
* error code.
*
- * A device may have a limited amount of rollback index slots (say,
- * one or four) so may error out if |rollback_index_slot| exceeds
+ * A device may have a limited amount of rollback index locations (say,
+ * one or four) so may error out if |rollback_index_location| exceeds
* this number.
*/
- AvbIOResult (*write_rollback_index)(AvbOps* ops, size_t rollback_index_slot,
+ AvbIOResult (*write_rollback_index)(AvbOps* ops,
+ size_t rollback_index_location,
uint64_t rollback_index);
/* Gets whether the device is unlocked. The value is returned in
diff --git a/libavb/avb_slot_verify.c b/libavb/avb_slot_verify.c
index 3449b0e..4541881 100644
--- a/libavb/avb_slot_verify.c
+++ b/libavb/avb_slot_verify.c
@@ -198,7 +198,7 @@
static AvbSlotVerifyResult load_and_verify_vbmeta(
AvbOps* ops, const char* const* requested_partitions, const char* ab_suffix,
bool allow_verification_error, AvbVBMetaImageFlags toplevel_vbmeta_flags,
- int rollback_index_slot, const char* partition_name,
+ int rollback_index_location, const char* partition_name,
size_t partition_name_len, const uint8_t* expected_public_key,
size_t expected_public_key_length, AvbSlotVerifyData* slot_data,
AvbAlgorithmType* out_algorithm_type) {
@@ -404,14 +404,14 @@
}
/* Check rollback index. */
- io_ret = ops->read_rollback_index(ops, rollback_index_slot,
+ io_ret = ops->read_rollback_index(ops, rollback_index_location,
&stored_rollback_index);
if (io_ret == AVB_IO_RESULT_ERROR_OOM) {
ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
goto out;
} else if (io_ret != AVB_IO_RESULT_OK) {
avb_errorv(full_partition_name,
- ": Error getting rollback index for slot.\n", NULL);
+ ": Error getting rollback index for location.\n", NULL);
ret = AVB_SLOT_VERIFY_RESULT_ERROR_IO;
goto out;
}
@@ -517,7 +517,7 @@
sub_ret = load_and_verify_vbmeta(
ops, requested_partitions, ab_suffix, allow_verification_error,
- toplevel_vbmeta_flags, chain_desc.rollback_index_slot,
+ toplevel_vbmeta_flags, chain_desc.rollback_index_location,
(const char*)chain_partition_name, chain_desc.partition_name_len,
chain_public_key, chain_desc.public_key_len, slot_data,
NULL /* out_algorithm_type */);
@@ -610,13 +610,14 @@
}
}
- if (rollback_index_slot >= AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_SLOTS) {
- avb_errorv(full_partition_name, ": Invalid rollback_index_slot.\n", NULL);
+ if (rollback_index_location >= AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS) {
+ avb_errorv(full_partition_name, ": Invalid rollback_index_location.\n",
+ NULL);
ret = AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA;
goto out;
}
- slot_data->rollback_indexes[rollback_index_slot] =
+ slot_data->rollback_indexes[rollback_index_location] =
vbmeta_header.rollback_index;
if (out_algorithm_type != NULL) {
@@ -809,7 +810,7 @@
ret = load_and_verify_vbmeta(
ops, requested_partitions, ab_suffix, allow_verification_error,
0, /* toplevel_vbmeta_flags */
- 0 /* rollback_index_slot */, "vbmeta", avb_strlen("vbmeta"),
+ 0 /* rollback_index_location */, "vbmeta", avb_strlen("vbmeta"),
NULL /* expected_public_key */, 0 /* expected_public_key_length */,
slot_data, &algorithm_type);
if (!allow_verification_error && ret != AVB_SLOT_VERIFY_RESULT_OK) {
diff --git a/libavb/avb_slot_verify.h b/libavb/avb_slot_verify.h
index 8be383a..fe53460 100644
--- a/libavb/avb_slot_verify.h
+++ b/libavb/avb_slot_verify.h
@@ -56,7 +56,7 @@
const char* avb_slot_verify_result_to_string(AvbSlotVerifyResult result);
/* Maximum number of rollback index locations supported. */
-#define AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_SLOTS 32
+#define AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS 32
/* AvbPartitionData contains data loaded from partitions when using
* avb_slot_verify(). The |partition_name| field contains the name of
@@ -154,7 +154,7 @@
AvbPartitionData* loaded_partitions;
size_t num_loaded_partitions;
char* cmdline;
- uint64_t rollback_indexes[AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_SLOTS];
+ uint64_t rollback_indexes[AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS];
} AvbSlotVerifyData;
/* Frees a |AvbSlotVerifyData| including all data it points to. */
diff --git a/libavb_ab/avb_ab_flow.c b/libavb_ab/avb_ab_flow.c
index 6b67c6a..37f0216 100644
--- a/libavb_ab/avb_ab_flow.c
+++ b/libavb_ab/avb_ab_flow.c
@@ -291,9 +291,9 @@
/* Update stored rollback index such that the stored rollback index
* is the largest value supporting all currently bootable slots. Do
- * this for every rollback index slot.
+ * this for every rollback index location.
*/
- for (n = 0; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_SLOTS; n++) {
+ for (n = 0; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) {
uint64_t rollback_index_value = 0;
if (slot_data[0] != NULL && slot_data[1] != NULL) {
diff --git a/libavb_ab/avb_ab_flow.h b/libavb_ab/avb_ab_flow.h
index dc05a4d..9d1b356 100644
--- a/libavb_ab/avb_ab_flow.h
+++ b/libavb_ab/avb_ab_flow.h
@@ -163,9 +163,9 @@
* AVB_AB_FLOW_RESULT_ERROR_NO_BOOTABLE_SLOTS is returned.
*
* 4. For each bootable slot, the Stored Rollback Indexes are updated
- * such that for each rollback index slot, the Stored Rollback Index
- * is the largest number smaller than or equal to the Rollback Index
- * of each slot.
+ * such that for each rollback index location, the Stored Rollback
+ * Index is the largest number smaller than or equal to the Rollback
+ * Index of each slot.
*
* 5. The bootable slot with the highest priority is selected and
* returned in |out_data|. If this slot is already marked as
diff --git a/test/avb_slot_verify_unittest.cc b/test/avb_slot_verify_unittest.cc
index a9a2c91..c74d0d8 100644
--- a/test/avb_slot_verify_unittest.cc
+++ b/test/avb_slot_verify_unittest.cc
@@ -182,10 +182,11 @@
// data is at the end and this data is signed, this will change the
// value of the computed hash.
uint8_t corrupt_data[4] = {0xff, 0xff, 0xff, 0xff};
- EXPECT_EQ(AVB_IO_RESULT_OK, ops_.avb_ops()->write_to_partition(
- ops_.avb_ops(), "vbmeta_a",
- -sizeof corrupt_data, // offset from end
- sizeof corrupt_data, corrupt_data));
+ EXPECT_EQ(AVB_IO_RESULT_OK,
+ ops_.avb_ops()->write_to_partition(
+ ops_.avb_ops(), "vbmeta_a",
+ -sizeof corrupt_data, // offset from end
+ sizeof corrupt_data, corrupt_data));
AvbSlotVerifyData* slot_data = NULL;
const char* requested_partitions[] = {"boot", NULL};
@@ -210,10 +211,11 @@
// even if the device is unlocked. Specifically no AvbSlotVerifyData
// is returned.
uint8_t corrupt_data[4] = {0xff, 0xff, 0xff, 0xff};
- EXPECT_EQ(AVB_IO_RESULT_OK, ops_.avb_ops()->write_to_partition(
- ops_.avb_ops(), "vbmeta_a",
- 0, // offset: beginning
- sizeof corrupt_data, corrupt_data));
+ EXPECT_EQ(
+ AVB_IO_RESULT_OK,
+ ops_.avb_ops()->write_to_partition(ops_.avb_ops(), "vbmeta_a",
+ 0, // offset: beginning
+ sizeof corrupt_data, corrupt_data));
AvbSlotVerifyData* slot_data = NULL;
const char* requested_partitions[] = {"boot", NULL};
@@ -357,7 +359,7 @@
"aca82b8c227721a389e89643c7e8ced39b3c587337bc9c10539c09a50026121f",
std::string(slot_data->cmdline));
EXPECT_EQ(4UL, slot_data->rollback_indexes[0]);
- for (size_t n = 1; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_SLOTS; n++) {
+ for (size_t n = 1; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) {
EXPECT_EQ(0UL, slot_data->rollback_indexes[n]);
}
avb_slot_verify_data_free(slot_data);
@@ -400,10 +402,11 @@
// Now corrupt boot_a.img and expect verification error.
uint8_t corrupt_data[4] = {0xff, 0xff, 0xff, 0xff};
- EXPECT_EQ(AVB_IO_RESULT_OK, ops_.avb_ops()->write_to_partition(
- ops_.avb_ops(), "boot_a",
- 1024 * 1024, // offset: 1 MiB
- sizeof corrupt_data, corrupt_data));
+ EXPECT_EQ(
+ AVB_IO_RESULT_OK,
+ ops_.avb_ops()->write_to_partition(ops_.avb_ops(), "boot_a",
+ 1024 * 1024, // offset: 1 MiB
+ sizeof corrupt_data, corrupt_data));
EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
@@ -458,9 +461,10 @@
"Flags: 0\n"
"Descriptors:\n"
" Chain Partition descriptor:\n"
- " Partition Name: boot\n"
- " Rollback Index Slot: 1\n"
- " Public key (sha1): 2597c218aae470a130f61162feaae70afd97f011\n"
+ " Partition Name: boot\n"
+ " Rollback Index Location: 1\n"
+ " Public key (sha1): "
+ "2597c218aae470a130f61162feaae70afd97f011\n"
" Kernel Cmdline descriptor:\n"
" Flags: 0\n"
" Kernel Cmdline: 'cmdline2 in vbmeta'\n",
@@ -563,7 +567,7 @@
std::string(slot_data->cmdline));
EXPECT_EQ(11UL, slot_data->rollback_indexes[0]);
EXPECT_EQ(12UL, slot_data->rollback_indexes[1]);
- for (size_t n = 2; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_SLOTS; n++) {
+ for (size_t n = 2; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) {
EXPECT_EQ(0UL, slot_data->rollback_indexes[n]);
}
avb_slot_verify_data_free(slot_data);
@@ -609,10 +613,11 @@
// Now corrupt boot_a.img and expect verification error.
uint8_t corrupt_data[4] = {0xff, 0xff, 0xff, 0xff};
- EXPECT_EQ(AVB_IO_RESULT_OK, ops_.avb_ops()->write_to_partition(
- ops_.avb_ops(), "boot_a",
- 1024 * 1024, // offset: 1 MiB
- sizeof corrupt_data, corrupt_data));
+ EXPECT_EQ(
+ AVB_IO_RESULT_OK,
+ ops_.avb_ops()->write_to_partition(ops_.avb_ops(), "boot_a",
+ 1024 * 1024, // offset: 1 MiB
+ sizeof corrupt_data, corrupt_data));
EXPECT_EQ(AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION,
avb_slot_verify(ops_.avb_ops(), requested_partitions, "_a",
@@ -781,9 +786,10 @@
"Flags: 0\n"
"Descriptors:\n"
" Chain Partition descriptor:\n"
- " Partition Name: boot\n"
- " Rollback Index Slot: 1\n"
- " Public key (sha1): 2597c218aae470a130f61162feaae70afd97f011\n"
+ " Partition Name: boot\n"
+ " Rollback Index Location: 1\n"
+ " Public key (sha1): "
+ "2597c218aae470a130f61162feaae70afd97f011\n"
" Kernel Cmdline descriptor:\n"
" Flags: 0\n"
" Kernel Cmdline: 'cmdline2 in vbmeta'\n",
@@ -831,7 +837,7 @@
std::string(slot_data->cmdline));
EXPECT_EQ(11UL, slot_data->rollback_indexes[0]);
EXPECT_EQ(12UL, slot_data->rollback_indexes[1]);
- for (size_t n = 2; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_SLOTS; n++) {
+ for (size_t n = 2; n < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; n++) {
EXPECT_EQ(0UL, slot_data->rollback_indexes[n]);
}
avb_slot_verify_data_free(slot_data);
diff --git a/test/avb_util_unittest.cc b/test/avb_util_unittest.cc
index d0d6b87..dc0116f 100644
--- a/test/avb_util_unittest.cc
+++ b/test/avb_util_unittest.cc
@@ -282,7 +282,7 @@
nbf = 36 + sizeof(AvbChainPartitionDescriptor) - sizeof(AvbDescriptor);
h.parent_descriptor.num_bytes_following = htobe64(nbf);
h.parent_descriptor.tag = htobe64(AVB_DESCRIPTOR_TAG_CHAIN_PARTITION);
- h.rollback_index_slot = htobe32(42);
+ h.rollback_index_location = htobe32(42);
h.partition_name_len = htobe32(16);
h.public_key_len = htobe32(17);
@@ -290,7 +290,7 @@
EXPECT_EQ(AVB_DESCRIPTOR_TAG_CHAIN_PARTITION, s.parent_descriptor.tag);
EXPECT_EQ(nbf, s.parent_descriptor.num_bytes_following);
- EXPECT_EQ(42UL, s.rollback_index_slot);
+ EXPECT_EQ(42UL, s.rollback_index_location);
EXPECT_EQ(16UL, s.partition_name_len);
EXPECT_EQ(17UL, s.public_key_len);
@@ -301,7 +301,7 @@
// Check for bad rollback index slot (must be at least 1).
bad = h;
- bad.rollback_index_slot = htobe32(0);
+ bad.rollback_index_location = htobe32(0);
EXPECT_EQ(0, avb_chain_partition_descriptor_validate_and_byteswap(&bad, &s));
// Doesn't fit in 40 bytes (24 + 17 = 41).
diff --git a/test/avbtool_unittest.cc b/test/avbtool_unittest.cc
index dad36f8..e2405ea 100644
--- a/test/avbtool_unittest.cc
+++ b/test/avbtool_unittest.cc
@@ -1063,9 +1063,10 @@
"Flags: 0\n"
"Descriptors:\n"
" Chain Partition descriptor:\n"
- " Partition Name: system\n"
- " Rollback Index Slot: 1\n"
- " Public key (sha1): cdbb77177f731920bbe0a0f94f84d9038ae0617d\n",
+ " Partition Name: system\n"
+ " Rollback Index Location: 1\n"
+ " Public key (sha1): "
+ "cdbb77177f731920bbe0a0f94f84d9038ae0617d\n",
InfoImage(vbmeta_path));
// Now check the VBMeta image.
diff --git a/test/fake_avb_ops.cc b/test/fake_avb_ops.cc
index 4a63641..adaa551 100644
--- a/test/fake_avb_ops.cc
+++ b/test/fake_avb_ops.cc
@@ -145,26 +145,26 @@
}
AvbIOResult FakeAvbOps::read_rollback_index(AvbOps* ops,
- size_t rollback_index_slot,
+ size_t rollback_index_location,
uint64_t* out_rollback_index) {
- if (rollback_index_slot >= stored_rollback_indexes_.size()) {
- fprintf(stderr, "No rollback index for slot %zd (has %zd slots).\n",
- rollback_index_slot, stored_rollback_indexes_.size());
+ if (rollback_index_location >= stored_rollback_indexes_.size()) {
+ fprintf(stderr, "No rollback index for location %zd (has %zd locations).\n",
+ rollback_index_location, stored_rollback_indexes_.size());
return AVB_IO_RESULT_ERROR_IO;
}
- *out_rollback_index = stored_rollback_indexes_[rollback_index_slot];
+ *out_rollback_index = stored_rollback_indexes_[rollback_index_location];
return AVB_IO_RESULT_OK;
}
AvbIOResult FakeAvbOps::write_rollback_index(AvbOps* ops,
- size_t rollback_index_slot,
+ size_t rollback_index_location,
uint64_t rollback_index) {
- if (rollback_index_slot >= stored_rollback_indexes_.size()) {
- fprintf(stderr, "No rollback index for slot %zd (has %zd slots).\n",
- rollback_index_slot, stored_rollback_indexes_.size());
+ if (rollback_index_location >= stored_rollback_indexes_.size()) {
+ fprintf(stderr, "No rollback index for location %zd (has %zd locations).\n",
+ rollback_index_location, stored_rollback_indexes_.size());
return AVB_IO_RESULT_ERROR_IO;
}
- stored_rollback_indexes_[rollback_index_slot] = rollback_index;
+ stored_rollback_indexes_[rollback_index_location] = rollback_index;
return AVB_IO_RESULT_OK;
}
@@ -218,18 +218,19 @@
}
static AvbIOResult my_ops_read_rollback_index(AvbOps* ops,
- size_t rollback_index_slot,
+ size_t rollback_index_location,
uint64_t* out_rollback_index) {
return ((FakeAvbOpsC*)ops)
- ->my_ops->read_rollback_index(ops, rollback_index_slot,
+ ->my_ops->read_rollback_index(ops, rollback_index_location,
out_rollback_index);
}
static AvbIOResult my_ops_write_rollback_index(AvbOps* ops,
- size_t rollback_index_slot,
+ size_t rollback_index_location,
uint64_t rollback_index) {
return ((FakeAvbOpsC*)ops)
- ->my_ops->write_rollback_index(ops, rollback_index_slot, rollback_index);
+ ->my_ops->write_rollback_index(ops, rollback_index_location,
+ rollback_index);
}
static AvbIOResult my_ops_read_is_device_unlocked(
diff --git a/test/fake_avb_ops.h b/test/fake_avb_ops.h
index 76d452d..6aa8be4 100644
--- a/test/fake_avb_ops.h
+++ b/test/fake_avb_ops.h
@@ -83,10 +83,10 @@
size_t public_key_metadata_length,
bool* out_key_is_trusted);
- AvbIOResult read_rollback_index(AvbOps* ops, size_t rollback_index_slot,
+ AvbIOResult read_rollback_index(AvbOps* ops, size_t rollback_index_location,
uint64_t* out_rollback_index);
- AvbIOResult write_rollback_index(AvbOps* ops, size_t rollback_index_slot,
+ AvbIOResult write_rollback_index(AvbOps* ops, size_t rollback_index_location,
uint64_t rollback_index);
AvbIOResult read_is_device_unlocked(AvbOps* ops,