diff options
Diffstat (limited to 'firmware/2lib/include/2return_codes.h')
-rw-r--r-- | firmware/2lib/include/2return_codes.h | 128 |
1 files changed, 99 insertions, 29 deletions
diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h index e0c4cbcb..7c61a49c 100644 --- a/firmware/2lib/include/2return_codes.h +++ b/firmware/2lib/include/2return_codes.h @@ -9,8 +9,8 @@ /* * Return codes from verified boot functions. * - * TODO: Go through code and replace VB2_ERROR_UNKNOWN with more specific - * error codes, and make the existing codes more consistent and useful. + * Note that other values may be passed through from vb2ex_*() calls; see + * the comment for VB2_ERROR_EX below. */ enum vb2_return_code { /* Success - no error */ @@ -233,46 +233,117 @@ enum vb2_return_code { /* Work buffer unaligned in vb2_init_context() */ VB2_ERROR_INITCTX_WORKBUF_ALIGN, + /* Work buffer too small in vb2_fw_parse_gbb() */ + VB2_ERROR_GBB_WORKBUF, + + /* Bad magic number in vb2_read_gbb_header() */ + VB2_ERROR_GBB_MAGIC, + + /* Incompatible version in vb2_read_gbb_header() */ + VB2_ERROR_GBB_VERSION, + + /* Old version in vb2_read_gbb_header() */ + VB2_ERROR_GBB_TOO_OLD, + + /* Header size too small in vb2_read_gbb_header() */ + VB2_ERROR_GBB_HEADER_SIZE, + + /* Work buffer too small for root key in vb2_verify_fw_keyblock() */ + VB2_ERROR_FW_KEYBLOCK_WORKBUF_ROOT_KEY, + + /* Work buffer too small for header in vb2_verify_fw_keyblock() */ + VB2_ERROR_FW_KEYBLOCK_WORKBUF_HEADER, + + /* Work buffer too small for keyblock in vb2_verify_fw_keyblock() */ + VB2_ERROR_FW_KEYBLOCK_WORKBUF, + + /* Keyblock version out of range in vb2_verify_fw_keyblock() */ + VB2_ERROR_FW_KEYBLOCK_VERSION_RANGE, + + /* Keyblock version rollback in vb2_verify_fw_keyblock() */ + VB2_ERROR_FW_KEYBLOCK_VERSION_ROLLBACK, + + /* Missing firmware data key in vb2_verify_fw_preamble2() */ + VB2_ERROR_FW_PREAMBLE2_DATA_KEY, + + /* Work buffer too small for header in vb2_verify_fw_preamble2() */ + VB2_ERROR_FW_PREAMBLE2_WORKBUF_HEADER, + + /* Work buffer too small for preamble in vb2_verify_fw_preamble2() */ + VB2_ERROR_FW_PREAMBLE2_WORKBUF, + + /* Firmware version out of range in vb2_verify_fw_preamble2() */ + VB2_ERROR_FW_PREAMBLE2_VERSION_RANGE, + + /* Firmware version rollback in vb2_verify_fw_preamble2() */ + VB2_ERROR_FW_PREAMBLE2_VERSION_ROLLBACK, + /********************************************************************** - * TODO: errors which must still be made specific + * API-level errors */ - VB2_ERROR_TODO = VB2_ERROR_BASE + 0xff0000, + VB2_ERROR_API = VB2_ERROR_BASE + 0x090000, + + /* Bag tag in vb2api_init_hash() */ + VB2_ERROR_API_INIT_HASH_TAG, + + /* Preamble not present in vb2api_init_hash() */ + VB2_ERROR_API_INIT_HASH_PREAMBLE, + + /* Work buffer too small in vb2api_init_hash() */ + VB2_ERROR_API_INIT_HASH_WORKBUF, + + /* Missing firmware data key in vb2api_init_hash() */ + VB2_ERROR_API_INIT_HASH_DATA_KEY, - /* Work buffer too small */ - VB2_ERROR_WORKBUF_TOO_SMALL, + /* Uninitialized work area in vb2api_extend_hash() */ + VB2_ERROR_API_EXTEND_HASH_WORKBUF, - /* Buffer too small (other than the work buffer) */ - VB2_ERROR_BUFFER_TOO_SMALL, + /* Too much data hashed in vb2api_extend_hash() */ + VB2_ERROR_API_EXTEND_HASH_SIZE, - /* Buffer unaligned */ - VB2_ERROR_BUFFER_UNALIGNED, + /* Preamble not present in vb2api_check_hash() */ + VB2_ERROR_API_CHECK_HASH_PREAMBLE, - /* Bad GBB header */ - VB2_ERROR_BAD_GBB_HEADER, + /* Uninitialized work area in vb2api_check_hash() */ + VB2_ERROR_API_CHECK_HASH_WORKBUF, - /* Bad algorithm - unknown, or unsupported */ - VB2_ERROR_BAD_ALGORITHM, + /* Wrong amount of data hashed in vb2api_extend_hash() */ + VB2_ERROR_API_CHECK_HASH_SIZE, - /* Signature check failed */ - VB2_ERROR_BAD_SIGNATURE, + /* Bag tag in vb2api_check_hash() */ + VB2_ERROR_API_CHECK_HASH_TAG, - /* Bad key */ - VB2_ERROR_BAD_KEY, + /* Missing firmware data key in vb2api_check_hash() */ + VB2_ERROR_API_CHECK_HASH_DATA_KEY, - /* Bad keyblock */ - VB2_ERROR_BAD_KEYBLOCK, + /* Siganature size mismatch in vb2api_check_hash() */ + VB2_ERROR_API_CHECK_HASH_SIG_SIZE, - /* Bad preamble */ - VB2_ERROR_BAD_PREAMBLE, + /* Preamble not present in vb2api_get_kernel_subkey() */ + VB2_ERROR_API_KERNEL_SUBKEY_PREAMBLE, - /* Bad firmware keyblock version (out of range, or rollback) */ - VB2_ERROR_FW_KEYBLOCK_VERSION, + /* Destination buffer too small in vb2api_get_kernel_subkey() */ + VB2_ERROR_API_KERNEL_SUBKEY_DEST_SIZE, - /* Bad firmware version (out of range, or rollback) */ - VB2_ERROR_FW_VERSION, + /* Phase one needs recovery mode */ + VB2_ERROR_API_PHASE1_RECOVERY, - /* Bad hash tag */ - VB2_ERROR_BAD_TAG, + /********************************************************************** + * Errors which may be generated by implementations of vb2ex functions. + * Implementation may also return its own specific errors, which should + * NOT be in the range VB2_ERROR_BASE...VB2_ERROR_MAX to avoid + * conflicting with future vboot2 error codes. + */ + VB2_ERROR_EX = VB2_ERROR_BASE + 0x0a0000, + + /* Resource index not found */ + VB2_ERROR_EX_READ_RESOURCE_INDEX, + + /* Size of resource not big enough for requested offset and/or size */ + VB2_ERROR_EX_READ_RESOURCE_SIZE, + + /* TPM clear owner failed */ + VB2_ERROR_EX_TPM_CLEAR_OWNER, /********************************************************************** * Highest non-zero error generated inside vboot library. Note that @@ -280,7 +351,6 @@ enum vb2_return_code { * still be outside this range. */ VB2_ERROR_MAX = VB2_ERROR_BASE + 0xffffff, - }; #endif /* VBOOT_2_RETURN_CODES_H_ */ |