diff options
author | Joel Kitching <kitching@google.com> | 2019-07-31 14:12:30 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-13 04:36:52 +0000 |
commit | e6700f4c70fe72850ae4f3f5df19c9281ebcefc8 (patch) | |
tree | 0f2abff7be99bc140e288058fb2eeab6f8bb8b64 /futility | |
parent | a5afd01feb0b4b45adbcd8ab38ab8a2ef2a2ef67 (diff) | |
download | vboot-e6700f4c70fe72850ae4f3f5df19c9281ebcefc8.tar.gz |
vboot: update vboot2 functions to use new vb2_error_t
To make explicit when vboot2 error codes should be returned,
use the new vb2_error_t type on all functions which return
VB2_ERROR_* constants.
BUG=b:124141368, chromium:988410
TEST=make clean && make runtests
BRANCH=none
Change-Id: Idd3ee8afe8c78347783ce5fa829cb78f1e5719e2
Signed-off-by: Joel Kitching <kitching@google.com>
Cq-Depend: chromium:1728113, chromium:1728499
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1728292
Reviewed-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'futility')
-rw-r--r-- | futility/file_type_usbpd1.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/futility/file_type_usbpd1.c b/futility/file_type_usbpd1.c index 197466b7..d5dbe953 100644 --- a/futility/file_type_usbpd1.c +++ b/futility/file_type_usbpd1.c @@ -304,12 +304,11 @@ static void vb2_pubkey_from_usbpd1(struct vb2_public_key *key, key->id = vb2_hash_id(hash_alg); } -static int vb21_sig_from_usbpd1(struct vb21_signature **sig, - enum vb2_signature_algorithm sig_alg, - enum vb2_hash_algorithm hash_alg, - const uint8_t *o_sig, - uint32_t o_sig_size, - uint32_t data_size) +static vb2_error_t vb21_sig_from_usbpd1(struct vb21_signature **sig, + enum vb2_signature_algorithm sig_alg, + enum vb2_hash_algorithm hash_alg, + const uint8_t *o_sig, + uint32_t o_sig_size, uint32_t data_size) { struct vb21_signature s = { .c.magic = VB21_MAGIC_SIGNATURE, @@ -367,11 +366,11 @@ static void show_usbpd1_stuff(const char *name, /* Returns VB2_SUCCESS or random error code */ -static int try_our_own(enum vb2_signature_algorithm sig_alg, - enum vb2_hash_algorithm hash_alg, - const uint8_t *o_pubkey, uint32_t o_pubkey_size, - const uint8_t *o_sig, uint32_t o_sig_size, - const uint8_t *data, uint32_t data_size) +static vb2_error_t try_our_own(enum vb2_signature_algorithm sig_alg, + enum vb2_hash_algorithm hash_alg, + const uint8_t *o_pubkey, uint32_t o_pubkey_size, + const uint8_t *o_sig, uint32_t o_sig_size, + const uint8_t *data, uint32_t data_size) { struct vb2_public_key pubkey; struct vb21_signature *sig; @@ -381,7 +380,7 @@ static int try_our_own(enum vb2_signature_algorithm sig_alg, .buf = buf, .size = sizeof(buf), }; - int rv = VB2_ERROR_UNKNOWN; + vb2_error_t rv = VB2_ERROR_UNKNOWN; vb2_pubkey_from_usbpd1(&pubkey, sig_alg, hash_alg, o_pubkey, o_pubkey_size); @@ -398,19 +397,19 @@ static int try_our_own(enum vb2_signature_algorithm sig_alg, } /* Returns VB2_SUCCESS if the image validates itself */ -static int check_self_consistency(const uint8_t *buf, - const char *name, - uint32_t ro_size, uint32_t rw_size, - uint32_t ro_offset, uint32_t rw_offset, - enum vb2_signature_algorithm sig_alg, - enum vb2_hash_algorithm hash_alg) +static vb2_error_t check_self_consistency(const uint8_t *buf, const char *name, + uint32_t ro_size, uint32_t rw_size, + uint32_t ro_offset, + uint32_t rw_offset, + enum vb2_signature_algorithm sig_alg, + enum vb2_hash_algorithm hash_alg) { /* Where are the important bits? */ uint32_t sig_size = vb2_rsa_sig_size(sig_alg); uint32_t sig_offset = rw_offset + rw_size - sig_size; uint32_t pubkey_size = usbpd1_packed_key_size(sig_alg); uint32_t pubkey_offset = ro_offset + ro_size - pubkey_size; - int rv; + vb2_error_t rv; /* Skip stuff that obviously doesn't work */ if (sig_size > rw_size || pubkey_size > ro_size) |