summaryrefslogtreecommitdiff
path: root/tests/vb20_verify_fw.c
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-05-17 12:24:55 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-05-17 18:36:50 -0700
commit2bca3d876c9ebaf8e682b377b0b66366d97a6807 (patch)
tree29e0f1fd3beca93c3a8284e79eebf48095093148 /tests/vb20_verify_fw.c
parent6c06245fb820807ec8c91014ca537df9a86d58d5 (diff)
downloadvboot-2bca3d876c9ebaf8e682b377b0b66366d97a6807.tar.gz
vboot: standardize on vb2_context identifiers in tests
Use `ctx` for global vb2_context variable, and `c` for argument to functions. This avoids shadowing the `ctx` identifier, which was recently disallowed by enabling -Wshadow in CL:1598721. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I9db97fd4945694e6f54abc5b0c04ed5533789300 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1616872 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Youcheng Syu <youcheng@chromium.org>
Diffstat (limited to 'tests/vb20_verify_fw.c')
-rw-r--r--tests/vb20_verify_fw.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/vb20_verify_fw.c b/tests/vb20_verify_fw.c
index 5025859c..2e098f38 100644
--- a/tests/vb20_verify_fw.c
+++ b/tests/vb20_verify_fw.c
@@ -20,7 +20,7 @@ const char *body_fname;
* Local implementation which reads resources from individual files. Could be
* more elegant and read from bios.bin, if we understood the fmap.
*/
-int vb2ex_read_resource(struct vb2_context *ctx,
+int vb2ex_read_resource(struct vb2_context *c,
enum vb2_resource_index index,
uint32_t offset,
void *buf,
@@ -60,7 +60,7 @@ int vb2ex_read_resource(struct vb2_context *ctx,
return got_size == size ? VB2_SUCCESS : VB2_ERROR_UNKNOWN;
}
-int vb2ex_tpm_clear_owner(struct vb2_context *ctx)
+int vb2ex_tpm_clear_owner(struct vb2_context *c)
{
// TODO: implement
return VB2_SUCCESS;
@@ -69,24 +69,24 @@ int vb2ex_tpm_clear_owner(struct vb2_context *ctx)
/**
* Save non-volatile and/or secure data if needed.
*/
-static void save_if_needed(struct vb2_context *ctx)
+static void save_if_needed(struct vb2_context *c)
{
- if (ctx->flags & VB2_CONTEXT_NVDATA_CHANGED) {
+ if (c->flags & VB2_CONTEXT_NVDATA_CHANGED) {
// TODO: implement
- ctx->flags &= ~VB2_CONTEXT_NVDATA_CHANGED;
+ c->flags &= ~VB2_CONTEXT_NVDATA_CHANGED;
}
- if (ctx->flags & VB2_CONTEXT_SECDATA_CHANGED) {
+ if (c->flags & VB2_CONTEXT_SECDATA_CHANGED) {
// TODO: implement
- ctx->flags &= ~VB2_CONTEXT_SECDATA_CHANGED;
+ c->flags &= ~VB2_CONTEXT_SECDATA_CHANGED;
}
}
/**
* Verify firmware body
*/
-static int hash_body(struct vb2_context *ctx)
+static int hash_body(struct vb2_context *c)
{
uint32_t expect_size;
uint8_t block[8192];
@@ -100,7 +100,7 @@ static int hash_body(struct vb2_context *ctx)
return VB2_ERROR_TEST_INPUT_FILE;
/* Start the body hash */
- rv = vb2api_init_hash(ctx, VB2_HASH_TAG_FW_BODY, &expect_size);
+ rv = vb2api_init_hash(c, VB2_HASH_TAG_FW_BODY, &expect_size);
if (rv) {
fclose(f);
return rv;
@@ -120,7 +120,7 @@ static int hash_body(struct vb2_context *ctx)
break;
/* Hash it */
- rv = vb2api_extend_hash(ctx, block, size);
+ rv = vb2api_extend_hash(c, block, size);
if (rv) {
fclose(f);
return rv;
@@ -132,7 +132,7 @@ static int hash_body(struct vb2_context *ctx)
fclose(f);
/* Check the result */
- rv = vb2api_check_hash(ctx);
+ rv = vb2api_check_hash(c);
if (rv)
return rv;