From b9be53640efdee92b1b42e60adda274563236301 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Thu, 5 Jun 2014 13:32:11 -0700 Subject: vboot2: Use more specific error codes Error codes reported by the crypto and storage APIs are now very specific, and tests verify the proper errors are reported. More specific error codes coming to other files next, but I don't want this CL to get too long. This also changes test_common.c so TEST_EQ() reports mismatched values in both decimal and hex, and adds TEST_SUCC() to test for a successful return value. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 COV=1 make Change-Id: I255c8e5769284fbc286b9d94631b19677a71cdd0 Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/202778 Reviewed-by: Bill Richardson --- firmware/2lib/2sha_utility.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'firmware/2lib/2sha_utility.c') diff --git a/firmware/2lib/2sha_utility.c b/firmware/2lib/2sha_utility.c index 66e8b692..0f9adfa3 100644 --- a/firmware/2lib/2sha_utility.c +++ b/firmware/2lib/2sha_utility.c @@ -72,7 +72,7 @@ int vb2_digest_init(struct vb2_digest_context *dc, uint32_t algorithm) return VB2_SUCCESS; #endif default: - return VB2_ERROR_BAD_ALGORITHM; + return VB2_ERROR_SHA_INIT_ALGORITHM; } } @@ -97,7 +97,7 @@ int vb2_digest_extend(struct vb2_digest_context *dc, return VB2_SUCCESS; #endif default: - return VB2_ERROR_BAD_ALGORITHM; + return VB2_ERROR_SHA_EXTEND_ALGORITHM; } } @@ -106,7 +106,7 @@ int vb2_digest_finalize(struct vb2_digest_context *dc, uint32_t digest_size) { if (digest_size < vb2_digest_size(dc->algorithm)) - return VB2_ERROR_BUFFER_TOO_SMALL; + return VB2_ERROR_SHA_FINALIZE_DIGEST_SIZE; switch (vb2_hash_alg(dc->algorithm)) { #if VB2_SUPPORT_SHA1 @@ -125,6 +125,6 @@ int vb2_digest_finalize(struct vb2_digest_context *dc, return VB2_SUCCESS; #endif default: - return VB2_ERROR_BAD_ALGORITHM; + return VB2_ERROR_SHA_FINALIZE_ALGORITHM; } } -- cgit v1.2.1