diff options
Diffstat (limited to 'firmware/lib21/include/vb21_common.h')
-rw-r--r-- | firmware/lib21/include/vb21_common.h | 61 |
1 files changed, 28 insertions, 33 deletions
diff --git a/firmware/lib21/include/vb21_common.h b/firmware/lib21/include/vb21_common.h index e89eb6cc..7ca5b4f5 100644 --- a/firmware/lib21/include/vb21_common.h +++ b/firmware/lib21/include/vb21_common.h @@ -37,7 +37,7 @@ const char *vb21_common_desc(const void *buf); * @param parent_size Parent size in bytes * @return VB2_SUCCESS, or non-zero if error. */ -int vb21_verify_common_header(const void *parent, uint32_t parent_size); +vb2_error_t vb21_verify_common_header(const void *parent, uint32_t parent_size); /** * Verify a member is within the data for a parent object @@ -52,10 +52,9 @@ int vb21_verify_common_header(const void *parent, uint32_t parent_size); * @param member_size Size of member data, in bytes * @return VB2_SUCCESS, or non-zero if error. */ -int vb21_verify_common_member(const void *parent, - uint32_t *min_offset, - uint32_t member_offset, - uint32_t member_size); +vb2_error_t vb21_verify_common_member(const void *parent, uint32_t *min_offset, + uint32_t member_offset, + uint32_t member_size); /** * Verify a member which starts with a common header is within the parent @@ -75,9 +74,9 @@ int vb21_verify_common_member(const void *parent, * member. * @return VB2_SUCCESS, or non-zero if error. */ -int vb21_verify_common_subobject(const void *parent, - uint32_t *min_offset, - uint32_t member_offset); +vb2_error_t vb21_verify_common_subobject(const void *parent, + uint32_t *min_offset, + uint32_t member_offset); /** * Unpack a key for use in verification @@ -90,9 +89,8 @@ int vb21_verify_common_subobject(const void *parent, * @param size Size of buffer in bytes * @return VB2_SUCCESS, or non-zero error code if error. */ -int vb21_unpack_key(struct vb2_public_key *key, - const uint8_t *buf, - uint32_t size); +vb2_error_t vb21_unpack_key(struct vb2_public_key *key, const uint8_t *buf, + uint32_t size); /** * Unpack the RSA data fields for a public key @@ -104,9 +102,8 @@ int vb21_unpack_key(struct vb2_public_key *key, * @param key_data Packed key data (from inside a packed key buffer) * @param key_size Size of packed key data in bytes */ -int vb2_unpack_key_data(struct vb2_public_key *key, - const uint8_t *key_data, - uint32_t key_size); +vb2_error_t vb2_unpack_key_data(struct vb2_public_key *key, + const uint8_t *key_data, uint32_t key_size); /** * Verify the integrity of a signature struct @@ -114,8 +111,8 @@ int vb2_unpack_key_data(struct vb2_public_key *key, * @param size Size of buffer containing signature struct * @return VB2_SUCCESS, or non-zero if error. */ -int vb21_verify_signature(const struct vb21_signature *sig, - uint32_t size); +vb2_error_t vb21_verify_signature(const struct vb21_signature *sig, + uint32_t size); /** * Verify a signature against an expected hash digest. @@ -126,10 +123,10 @@ int vb21_verify_signature(const struct vb21_signature *sig, * @param wb Work buffer * @return VB2_SUCCESS, or non-zero if error. */ -int vb21_verify_digest(const struct vb2_public_key *key, - struct vb21_signature *sig, - const uint8_t *digest, - const struct vb2_workbuf *wb); +vb2_error_t vb21_verify_digest(const struct vb2_public_key *key, + struct vb21_signature *sig, + const uint8_t *digest, + const struct vb2_workbuf *wb); /** * Verify data matches signature. @@ -142,11 +139,10 @@ int vb21_verify_digest(const struct vb2_public_key *key, * @param wb Work buffer * @return VB2_SUCCESS, or non-zero error code if error. */ -int vb21_verify_data(const void *data, - uint32_t size, - struct vb21_signature *sig, - const struct vb2_public_key *key, - const struct vb2_workbuf *wb); +vb2_error_t vb21_verify_data(const void *data, uint32_t size, + struct vb21_signature *sig, + const struct vb2_public_key *key, + const struct vb2_workbuf *wb); /** * Check the sanity of a key block using a public key. @@ -160,10 +156,9 @@ int vb21_verify_data(const void *data, * @param wb Work buffer * @return VB2_SUCCESS, or non-zero error code if error. */ -int vb21_verify_keyblock(struct vb21_keyblock *block, - uint32_t size, - const struct vb2_public_key *key, - const struct vb2_workbuf *wb); +vb2_error_t vb21_verify_keyblock(struct vb21_keyblock *block, uint32_t size, + const struct vb2_public_key *key, + const struct vb2_workbuf *wb); /** * Check the sanity of a firmware preamble using a public key. @@ -176,10 +171,10 @@ int vb21_verify_keyblock(struct vb21_keyblock *block, * @param wb Work buffer * @return VB2_SUCCESS, or non-zero error code if error. */ -int vb21_verify_fw_preamble(struct vb21_fw_preamble *preamble, - uint32_t size, - const struct vb2_public_key *key, - const struct vb2_workbuf *wb); +vb2_error_t vb21_verify_fw_preamble(struct vb21_fw_preamble *preamble, + uint32_t size, + const struct vb2_public_key *key, + const struct vb2_workbuf *wb); #ifdef __cplusplus } |