summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-08-13 13:02:45 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-14 09:49:51 +0000
commit243c5efbde0f3bf3c9219bd8deb24bdf0ed952e2 (patch)
tree34a42d6c80b644491d5fc372d04ab539b56ff94c
parentf2415141ef2c798c0f21c85a0ea89c703d7c7a21 (diff)
downloadvboot-243c5efbde0f3bf3c9219bd8deb24bdf0ed952e2.tar.gz
vboot/secdata: rename identifier in RollbackFwmpRead for clarity
A union is used with a buffer and a pointer to the RollbackSpaceFwmp object in question. Rename `bf` to `fwmp` to reduce confusion between the two identifiers which are presumably both abbreviations for "buffer". BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I0cdd8fed77087ff36cc4ca74ec847e65398f8a6b Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1751062 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
-rw-r--r--firmware/lib/rollback_index.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/firmware/lib/rollback_index.c b/firmware/lib/rollback_index.c
index 3201c8e8..07c7deec 100644
--- a/firmware/lib/rollback_index.c
+++ b/firmware/lib/rollback_index.c
@@ -263,12 +263,12 @@ uint32_t RollbackFwmpRead(struct RollbackSpaceFwmp *fwmp)
{
union {
/*
- * Use a union for buf and bf, rather than making bf a pointer
- * to a bare uint8_t[] buffer. This ensures bf will be aligned
- * if necesssary for the target platform.
+ * Use a union for buf and fwmp, rather than making fwmp a
+ * pointer to a bare uint8_t[] buffer. This ensures fwmp will
+ * be aligned if necesssary for the target platform.
*/
uint8_t buf[FWMP_NV_MAX_SIZE];
- struct RollbackSpaceFwmp bf;
+ struct RollbackSpaceFwmp fwmp;
} u;
uint32_t r;
@@ -276,7 +276,7 @@ uint32_t RollbackFwmpRead(struct RollbackSpaceFwmp *fwmp)
memset(fwmp, 0, sizeof(*fwmp));
/* Try to read entire 1.0 struct */
- r = TlclRead(FWMP_NV_INDEX, u.buf, sizeof(u.bf));
+ r = TlclRead(FWMP_NV_INDEX, u.buf, sizeof(u.fwmp));
if (TPM_E_BADINDEX == r) {
/* Missing space is not an error; use defaults */
VB2_DEBUG("TPM: no FWMP space\n");
@@ -290,28 +290,28 @@ uint32_t RollbackFwmpRead(struct RollbackSpaceFwmp *fwmp)
* Struct must be at least big enough for 1.0, but not bigger
* than our buffer size.
*/
- if (u.bf.struct_size < sizeof(u.bf) ||
- u.bf.struct_size > sizeof(u.buf))
+ if (u.fwmp.struct_size < sizeof(u.fwmp) ||
+ u.fwmp.struct_size > sizeof(u.buf))
return TPM_E_STRUCT_SIZE;
/*
* If space is bigger than we expect, re-read so we properly
* compute the CRC.
*/
- if (u.bf.struct_size > sizeof(u.bf)) {
- r = TlclRead(FWMP_NV_INDEX, u.buf, u.bf.struct_size);
+ if (u.fwmp.struct_size > sizeof(u.fwmp)) {
+ r = TlclRead(FWMP_NV_INDEX, u.buf, u.fwmp.struct_size);
if (TPM_SUCCESS != r)
return r;
}
/* Verify CRC */
- if (u.bf.crc != vb2_crc8(u.buf + 2, u.bf.struct_size - 2)) {
+ if (u.fwmp.crc != vb2_crc8(u.buf + 2, u.fwmp.struct_size - 2)) {
VB2_DEBUG("TPM: bad CRC\n");
return TPM_E_CORRUPTED_STATE;
}
/* Verify major version is compatible */
- if ((u.bf.struct_version >> 4) !=
+ if ((u.fwmp.struct_version >> 4) !=
(ROLLBACK_SPACE_FWMP_VERSION >> 4))
return TPM_E_STRUCT_VERSION;
@@ -324,7 +324,7 @@ uint32_t RollbackFwmpRead(struct RollbackSpaceFwmp *fwmp)
* we would need to take care of initializing the extra fields
* added in 1.1+. But that's not an issue yet.
*/
- memcpy(fwmp, &u.bf, sizeof(*fwmp));
+ memcpy(fwmp, &u.fwmp, sizeof(*fwmp));
return TPM_SUCCESS;
}