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 /firmware/lib/include | |
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 'firmware/lib/include')
-rw-r--r-- | firmware/lib/include/rollback_index.h | 3 | ||||
-rw-r--r-- | firmware/lib/include/vboot_common.h | 28 | ||||
-rw-r--r-- | firmware/lib/include/vboot_kernel.h | 2 |
3 files changed, 17 insertions, 16 deletions
diff --git a/firmware/lib/include/rollback_index.h b/firmware/lib/include/rollback_index.h index ff369114..c5b119e2 100644 --- a/firmware/lib/include/rollback_index.h +++ b/firmware/lib/include/rollback_index.h @@ -9,6 +9,7 @@ #ifndef VBOOT_REFERENCE_ROLLBACK_INDEX_H_ #define VBOOT_REFERENCE_ROLLBACK_INDEX_H_ +#include "2return_codes.h" #include "sysincludes.h" #include "tss_constants.h" @@ -164,6 +165,6 @@ uint32_t SafeWrite(uint32_t index, const void *data, uint32_t length); /** * Utility function to turn the virtual dev-mode flag on or off. 0=off, 1=on. */ -uint32_t SetVirtualDevMode(int val); +vb2_error_t SetVirtualDevMode(int val); #endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */ diff --git a/firmware/lib/include/vboot_common.h b/firmware/lib/include/vboot_common.h index 95916488..ac020cc3 100644 --- a/firmware/lib/include/vboot_common.h +++ b/firmware/lib/include/vboot_common.h @@ -55,14 +55,14 @@ const uint8_t *GetSignatureDataC(const VbSignature *sig); /* * Helper functions to verify the data pointed to by a subfield is inside the - * parent data. Returns 0 if inside, 1 if error. + * parent data. */ -int VerifyPublicKeyInside(const void *parent, uint64_t parent_size, - const struct vb2_packed_key *key); +vb2_error_t VerifyPublicKeyInside(const void *parent, uint64_t parent_size, + const struct vb2_packed_key *key); -int VerifySignatureInside(const void *parent, uint64_t parent_size, - const VbSignature *sig); +vb2_error_t VerifySignatureInside(const void *parent, uint64_t parent_size, + const VbSignature *sig); /** * Initialize a public key to refer to [key_data]. @@ -86,9 +86,9 @@ int PublicKeyCopy(struct vb2_packed_key *dest, * * Returns VBOOT_SUCCESS if successful. */ -int VbGetKernelVmlinuzHeader(const VbKernelPreambleHeader *preamble, - uint64_t *vmlinuz_header_address, - uint64_t *vmlinuz_header_size); +vb2_error_t VbGetKernelVmlinuzHeader(const VbKernelPreambleHeader *preamble, + uint64_t *vmlinuz_header_address, + uint64_t *vmlinuz_header_size); /** * Checks if the kernel preamble has flags field. This is available only if the @@ -97,21 +97,21 @@ int VbGetKernelVmlinuzHeader(const VbKernelPreambleHeader *preamble, * * Returns VBOOT_SUCCESS if version is >=2.2. */ -int VbKernelHasFlags(const VbKernelPreambleHeader *preamble); +vb2_error_t VbKernelHasFlags(const VbKernelPreambleHeader *preamble); /** * Verify that the Vmlinuz Header is contained inside of the kernel blob. * * Returns VBOOT_SUCCESS or VBOOT_PREAMBLE_INVALID on error */ -int VerifyVmlinuzInsideKBlob(uint64_t kblob, uint64_t kblob_size, - uint64_t header, uint64_t header_size); +vb2_error_t VerifyVmlinuzInsideKBlob(uint64_t kblob, uint64_t kblob_size, + uint64_t header, uint64_t header_size); /** * Initialize a verified boot shared data structure. * * Returns 0 if success, non-zero if error. */ -int VbSharedDataInit(VbSharedDataHeader *header, uint64_t size); +vb2_error_t VbSharedDataInit(VbSharedDataHeader *header, uint64_t size); /** * Reserve [size] bytes of the shared data area. Returns the offset of the @@ -124,8 +124,8 @@ uint64_t VbSharedDataReserve(VbSharedDataHeader *header, uint64_t size); * * Returns 0 if success, non-zero if error. */ -int VbSharedDataSetKernelKey(VbSharedDataHeader *header, - const struct vb2_packed_key *src); +vb2_error_t VbSharedDataSetKernelKey(VbSharedDataHeader *header, + const struct vb2_packed_key *src); /** * Check whether recovery is allowed or not. diff --git a/firmware/lib/include/vboot_kernel.h b/firmware/lib/include/vboot_kernel.h index 61ce2c93..7044ba10 100644 --- a/firmware/lib/include/vboot_kernel.h +++ b/firmware/lib/include/vboot_kernel.h @@ -27,7 +27,7 @@ struct vb2_context; * @return VBERROR_SUCCESS, VBERROR_NO_DISK_FOUND if no disks of the specified * type were found, or other non-zero VBERROR_ codes for other failures. */ -uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags); +vb2_error_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags); /* Flags for VbUserConfirms() */ #define VB_CONFIRM_MUST_TRUST_KEYBOARD (1 << 0) |