summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-11-04 16:45:37 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-06 02:28:16 +0000
commita063a43ad776c9831051e62565c0136ce36d0b09 (patch)
tree9bef87d76bd7c5730d353cec1626cf613b0ff8c7 /tests
parentad105edeb2ff0f2fbafd15655d351e8bb7522a21 (diff)
downloadvboot-a063a43ad776c9831051e62565c0136ce36d0b09.tar.gz
vboot2: pass const work buffers, and clarify min_offset output
When a work buffer is passed to a function, and duplicated inside that function, allocations made against the duplicate are automatically freed when the duplicate goes out of scope. Make that explicit in the comments. And pass in const struct workbuf * instead of struct workbuf *, to make it clear that the passed-in work buffer pointer is not being altered by the function. Also, comment that the value of min_offset becomes undefined if vb2_verify_common_member() or vb2_verify_common_subobject() fails. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: Icc6010e6ef786f78cd2176a59d4d0e6e14905a11 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227524 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/vb2_api_tests.c2
-rw-r--r--tests/vb2_misc2_tests.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/vb2_api_tests.c b/tests/vb2_api_tests.c
index cf706d46..5d667663 100644
--- a/tests/vb2_api_tests.c
+++ b/tests/vb2_api_tests.c
@@ -182,7 +182,7 @@ uint32_t vb2_rsa_sig_size(enum vb2_signature_algorithm sig_alg)
int vb2_rsa_verify_digest(const struct vb2_public_key *key,
uint8_t *sig,
const uint8_t *digest,
- struct vb2_workbuf *wb)
+ const struct vb2_workbuf *wb)
{
return retval_vb2_verify_digest;
}
diff --git a/tests/vb2_misc2_tests.c b/tests/vb2_misc2_tests.c
index 2025fb41..796d8e6a 100644
--- a/tests/vb2_misc2_tests.c
+++ b/tests/vb2_misc2_tests.c
@@ -154,7 +154,7 @@ int vb2_unpack_key(struct vb2_public_key *key,
int vb2_verify_keyblock(struct vb2_keyblock *block,
uint32_t size,
const struct vb2_public_key *key,
- struct vb2_workbuf *wb)
+ const struct vb2_workbuf *wb)
{
return mock_verify_keyblock_retval;
}
@@ -162,7 +162,7 @@ int vb2_verify_keyblock(struct vb2_keyblock *block,
int vb2_verify_fw_preamble(struct vb2_fw_preamble *preamble,
uint32_t size,
const struct vb2_public_key *key,
- struct vb2_workbuf *wb)
+ const struct vb2_workbuf *wb)
{
return mock_verify_preamble_retval;
}