Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. |
| 2 | * Use of this source code is governed by a BSD-style license that can be |
| 3 | * found in the LICENSE file. |
| 4 | */ |
| 5 | |
| 6 | #ifndef VBOOT_2_RETURN_CODES_H_ |
| 7 | #define VBOOT_2_RETURN_CODES_H_ |
| 8 | |
| 9 | /* |
| 10 | * Return codes from verified boot functions. |
| 11 | * |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 12 | * Note that other values may be passed through from vb2ex_*() calls; see |
| 13 | * the comment for VB2_ERROR_EX below. |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 14 | */ |
| 15 | enum vb2_return_code { |
| 16 | /* Success - no error */ |
| 17 | VB2_SUCCESS = 0, |
| 18 | |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 19 | /* |
| 20 | * All vboot2 error codes start at a large offset from zero, to reduce |
| 21 | * the risk of overlap with other error codes (TPM, etc.). |
| 22 | */ |
Randall Spangler | 02e11b3 | 2014-11-19 12:48:36 -0800 | [diff] [blame] | 23 | VB2_ERROR_BASE = 0x10000000, |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 24 | |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 25 | /* Unknown / unspecified error */ |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 26 | VB2_ERROR_UNKNOWN = VB2_ERROR_BASE + 1, |
| 27 | |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 28 | /* Mock error for testing */ |
| 29 | VB2_ERROR_MOCK, |
| 30 | |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 31 | /********************************************************************** |
| 32 | * SHA errors |
| 33 | */ |
| 34 | VB2_ERROR_SHA = VB2_ERROR_BASE + 0x010000, |
| 35 | |
| 36 | /* Bad algorithm in vb2_digest_init() */ |
| 37 | VB2_ERROR_SHA_INIT_ALGORITHM, |
| 38 | |
| 39 | /* Bad algorithm in vb2_digest_extend() */ |
| 40 | VB2_ERROR_SHA_EXTEND_ALGORITHM, |
| 41 | |
| 42 | /* Bad algorithm in vb2_digest_finalize() */ |
| 43 | VB2_ERROR_SHA_FINALIZE_ALGORITHM, |
| 44 | |
| 45 | /* Digest size buffer too small in vb2_digest_finalize() */ |
| 46 | VB2_ERROR_SHA_FINALIZE_DIGEST_SIZE, |
| 47 | |
| 48 | /********************************************************************** |
| 49 | * RSA errors |
| 50 | */ |
| 51 | VB2_ERROR_RSA = VB2_ERROR_BASE + 0x020000, |
| 52 | |
| 53 | /* Padding mismatch in vb2_check_padding() */ |
| 54 | VB2_ERROR_RSA_PADDING, |
| 55 | |
| 56 | /* Bad algorithm in vb2_check_padding() */ |
| 57 | VB2_ERROR_RSA_PADDING_ALGORITHM, |
| 58 | |
| 59 | /* Null param passed to vb2_verify_digest() */ |
| 60 | VB2_ERROR_RSA_VERIFY_PARAM, |
| 61 | |
| 62 | /* Bad algorithm in vb2_verify_digest() */ |
| 63 | VB2_ERROR_RSA_VERIFY_ALGORITHM, |
| 64 | |
| 65 | /* Bad signature length in vb2_verify_digest() */ |
| 66 | VB2_ERROR_RSA_VERIFY_SIG_LEN, |
| 67 | |
| 68 | /* Work buffer too small in vb2_verify_digest() */ |
| 69 | VB2_ERROR_RSA_VERIFY_WORKBUF, |
| 70 | |
| 71 | /* Digest mismatch in vb2_verify_digest() */ |
| 72 | VB2_ERROR_RSA_VERIFY_DIGEST, |
| 73 | |
Randall Spangler | c8c2f02 | 2014-10-23 09:48:20 -0700 | [diff] [blame] | 74 | /* Bad size calculation in vb2_check_padding() */ |
| 75 | VB2_ERROR_RSA_PADDING_SIZE, |
| 76 | |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 77 | /********************************************************************** |
| 78 | * NV storage errors |
| 79 | */ |
| 80 | VB2_ERROR_NV = VB2_ERROR_BASE + 0x030000, |
| 81 | |
| 82 | /* Bad header in vb2_nv_check_crc() */ |
| 83 | VB2_ERROR_NV_HEADER, |
| 84 | |
| 85 | /* Bad CRC in vb2_nv_check_crc() */ |
| 86 | VB2_ERROR_NV_CRC, |
| 87 | |
| 88 | /********************************************************************** |
| 89 | * Secure data storage errors |
| 90 | */ |
| 91 | VB2_ERROR_SECDATA = VB2_ERROR_BASE + 0x040000, |
| 92 | |
| 93 | /* Bad CRC in vb2_secdata_check_crc() */ |
| 94 | VB2_ERROR_SECDATA_CRC, |
| 95 | |
Julius Werner | 7e21698 | 2015-05-29 16:56:20 -0700 | [diff] [blame] | 96 | /* Secdata is all zeroes (uninitialized) in vb2_secdata_check_crc() */ |
| 97 | VB2_ERROR_SECDATA_ZERO, |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 98 | |
| 99 | /* Invalid param in vb2_secdata_get() */ |
| 100 | VB2_ERROR_SECDATA_GET_PARAM, |
| 101 | |
| 102 | /* Invalid param in vb2_secdata_set() */ |
| 103 | VB2_ERROR_SECDATA_SET_PARAM, |
| 104 | |
| 105 | /* Invalid flags passed to vb2_secdata_set() */ |
| 106 | VB2_ERROR_SECDATA_SET_FLAGS, |
| 107 | |
Julius Werner | b550fb1 | 2015-01-30 14:27:54 -0800 | [diff] [blame] | 108 | /* Called vb2_secdata_get() with uninitialized secdata */ |
| 109 | VB2_ERROR_SECDATA_GET_UNINITIALIZED, |
| 110 | |
| 111 | /* Called vb2_secdata_set() with uninitialized secdata */ |
| 112 | VB2_ERROR_SECDATA_SET_UNINITIALIZED, |
| 113 | |
Randall Spangler | bf9c276 | 2015-05-12 13:44:30 -0700 | [diff] [blame] | 114 | /* Bad CRC in vb2_secdatak_check_crc() */ |
| 115 | VB2_ERROR_SECDATAK_CRC, |
| 116 | |
| 117 | /* Bad struct version in vb2_secdatak_init() */ |
| 118 | VB2_ERROR_SECDATAK_VERSION, |
| 119 | |
| 120 | /* Bad uid in vb2_secdatak_init() */ |
| 121 | VB2_ERROR_SECDATAK_UID, |
| 122 | |
| 123 | /* Invalid param in vb2_secdatak_get() */ |
| 124 | VB2_ERROR_SECDATAK_GET_PARAM, |
| 125 | |
| 126 | /* Invalid param in vb2_secdatak_set() */ |
| 127 | VB2_ERROR_SECDATAK_SET_PARAM, |
| 128 | |
| 129 | /* Invalid flags passed to vb2_secdatak_set() */ |
| 130 | VB2_ERROR_SECDATAK_SET_FLAGS, |
| 131 | |
| 132 | /* Called vb2_secdatak_get() with uninitialized secdatak */ |
| 133 | VB2_ERROR_SECDATAK_GET_UNINITIALIZED, |
| 134 | |
| 135 | /* Called vb2_secdatak_set() with uninitialized secdatak */ |
| 136 | VB2_ERROR_SECDATAK_SET_UNINITIALIZED, |
| 137 | |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 138 | /********************************************************************** |
Randall Spangler | 2145721 | 2014-06-06 09:30:14 -0700 | [diff] [blame] | 139 | * Common code errors |
| 140 | */ |
| 141 | VB2_ERROR_COMMON = VB2_ERROR_BASE + 0x050000, |
| 142 | |
| 143 | /* Buffer is smaller than alignment offset in vb2_align() */ |
| 144 | VB2_ERROR_ALIGN_BIGGER_THAN_SIZE, |
| 145 | |
| 146 | /* Buffer is smaller than request in vb2_align() */ |
| 147 | VB2_ERROR_ALIGN_SIZE, |
| 148 | |
| 149 | /* Parent wraps around in vb2_verify_member_inside() */ |
| 150 | VB2_ERROR_INSIDE_PARENT_WRAPS, |
| 151 | |
| 152 | /* Member wraps around in vb2_verify_member_inside() */ |
| 153 | VB2_ERROR_INSIDE_MEMBER_WRAPS, |
| 154 | |
| 155 | /* Member outside parent in vb2_verify_member_inside() */ |
| 156 | VB2_ERROR_INSIDE_MEMBER_OUTSIDE, |
| 157 | |
| 158 | /* Member data wraps around in vb2_verify_member_inside() */ |
| 159 | VB2_ERROR_INSIDE_DATA_WRAPS, |
| 160 | |
| 161 | /* Member data outside parent in vb2_verify_member_inside() */ |
| 162 | VB2_ERROR_INSIDE_DATA_OUTSIDE, |
| 163 | |
Randall Spangler | c8c2f02 | 2014-10-23 09:48:20 -0700 | [diff] [blame] | 164 | /* Unsupported signature algorithm in vb2_unpack_key() */ |
Randall Spangler | 6b5b8f6 | 2014-10-31 15:18:48 -0700 | [diff] [blame] | 165 | VB2_ERROR_UNPACK_KEY_SIG_ALGORITHM, /* 0x150008 */ |
Randall Spangler | 224f5ac | 2014-06-06 09:42:30 -0700 | [diff] [blame] | 166 | |
| 167 | /* Bad key size in vb2_unpack_key() */ |
| 168 | VB2_ERROR_UNPACK_KEY_SIZE, |
| 169 | |
| 170 | /* Bad key alignment in vb2_unpack_key() */ |
| 171 | VB2_ERROR_UNPACK_KEY_ALIGN, |
| 172 | |
| 173 | /* Bad key array size in vb2_unpack_key() */ |
| 174 | VB2_ERROR_UNPACK_KEY_ARRAY_SIZE, |
| 175 | |
| 176 | /* Bad algorithm in vb2_verify_data() */ |
| 177 | VB2_ERROR_VDATA_ALGORITHM, |
| 178 | |
| 179 | /* Incorrect signature size for algorithm in vb2_verify_data() */ |
| 180 | VB2_ERROR_VDATA_SIG_SIZE, |
| 181 | |
| 182 | /* Data smaller than length of signed data in vb2_verify_data() */ |
| 183 | VB2_ERROR_VDATA_NOT_ENOUGH_DATA, |
| 184 | |
| 185 | /* Not enough work buffer for digest in vb2_verify_data() */ |
| 186 | VB2_ERROR_VDATA_WORKBUF_DIGEST, |
| 187 | |
| 188 | /* Not enough work buffer for hash temp data in vb2_verify_data() */ |
Randall Spangler | 6b5b8f6 | 2014-10-31 15:18:48 -0700 | [diff] [blame] | 189 | VB2_ERROR_VDATA_WORKBUF_HASHING, /* 0x150010 */ |
Randall Spangler | 224f5ac | 2014-06-06 09:42:30 -0700 | [diff] [blame] | 190 | |
Randall Spangler | 9504754 | 2014-10-17 16:41:46 -0700 | [diff] [blame] | 191 | /* |
| 192 | * Bad digest size in vb2_verify_data() - probably because algorithm |
| 193 | * is bad. |
| 194 | */ |
| 195 | VB2_ERROR_VDATA_DIGEST_SIZE, |
| 196 | |
Randall Spangler | 4eef812 | 2014-10-23 10:07:54 -0700 | [diff] [blame] | 197 | /* Unsupported hash algorithm in vb2_unpack_key() */ |
| 198 | VB2_ERROR_UNPACK_KEY_HASH_ALGORITHM, |
| 199 | |
Randall Spangler | f6cfb97 | 2014-10-23 17:04:03 -0700 | [diff] [blame] | 200 | /* Member data overlaps member header */ |
| 201 | VB2_ERROR_INSIDE_DATA_OVERLAP, |
| 202 | |
Randall Spangler | d274a2e | 2014-10-23 17:38:18 -0700 | [diff] [blame] | 203 | /* Unsupported packed key struct version */ |
| 204 | VB2_ERROR_UNPACK_KEY_STRUCT_VERSION, |
| 205 | |
Randall Spangler | 6b5b8f6 | 2014-10-31 15:18:48 -0700 | [diff] [blame] | 206 | /* |
| 207 | * Buffer too small for total, fixed size, or description reported in |
| 208 | * common header, or member data checked via |
Randall Spangler | ca72512 | 2016-05-25 16:42:44 -0700 | [diff] [blame] | 209 | * vb21_verify_common_member(). |
Randall Spangler | 6b5b8f6 | 2014-10-31 15:18:48 -0700 | [diff] [blame] | 210 | */ |
| 211 | VB2_ERROR_COMMON_TOTAL_SIZE, |
| 212 | VB2_ERROR_COMMON_FIXED_SIZE, |
| 213 | VB2_ERROR_COMMON_DESC_SIZE, |
| 214 | VB2_ERROR_COMMON_MEMBER_SIZE, /* 0x150018 */ |
| 215 | |
| 216 | /* |
| 217 | * Total, fixed, description, or member offset/size not a multiple of |
| 218 | * 32 bits. |
| 219 | */ |
| 220 | VB2_ERROR_COMMON_TOTAL_UNALIGNED, |
| 221 | VB2_ERROR_COMMON_FIXED_UNALIGNED, |
| 222 | VB2_ERROR_COMMON_DESC_UNALIGNED, |
| 223 | VB2_ERROR_COMMON_MEMBER_UNALIGNED, |
| 224 | |
| 225 | /* Common struct description or member data wraps address space */ |
| 226 | VB2_ERROR_COMMON_DESC_WRAPS, |
| 227 | VB2_ERROR_COMMON_MEMBER_WRAPS, |
| 228 | |
| 229 | /* Common struct description is not null-terminated */ |
| 230 | VB2_ERROR_COMMON_DESC_TERMINATOR, |
| 231 | |
| 232 | /* Member data overlaps previous data */ |
| 233 | VB2_ERROR_COMMON_MEMBER_OVERLAP, /* 0x150020 */ |
| 234 | |
| 235 | /* Signature bad magic number */ |
| 236 | VB2_ERROR_SIG_MAGIC, |
| 237 | |
| 238 | /* Signature incompatible version */ |
| 239 | VB2_ERROR_SIG_VERSION, |
| 240 | |
| 241 | /* Signature header doesn't fit */ |
| 242 | VB2_ERROR_SIG_HEADER_SIZE, |
| 243 | |
Randall Spangler | c0ce70b | 2014-10-31 11:19:14 -0700 | [diff] [blame] | 244 | /* Signature unsupported algorithm */ |
| 245 | VB2_ERROR_SIG_ALGORITHM, |
| 246 | |
| 247 | /* Signature bad size for algorithm */ |
| 248 | VB2_ERROR_SIG_SIZE, |
| 249 | |
Randall Spangler | 6b5b8f6 | 2014-10-31 15:18:48 -0700 | [diff] [blame] | 250 | /* Wrong amount of data signed */ |
| 251 | VB2_ERROR_VDATA_SIZE, |
| 252 | |
| 253 | /* Digest mismatch */ |
| 254 | VB2_ERROR_VDATA_VERIFY_DIGEST, |
| 255 | |
| 256 | /* Key algorithm doesn't match signature algorithm */ |
| 257 | VB2_ERROR_VDATA_ALGORITHM_MISMATCH, |
| 258 | |
Randall Spangler | 308d254 | 2014-12-04 09:54:37 -0800 | [diff] [blame] | 259 | /* Bad magic number in vb2_unpack_key() */ |
ChromeOS Developer | 7aef90c | 2014-12-03 12:19:22 -0800 | [diff] [blame] | 260 | VB2_ERROR_UNPACK_KEY_MAGIC, |
| 261 | |
Randall Spangler | 224f5ac | 2014-06-06 09:42:30 -0700 | [diff] [blame] | 262 | /********************************************************************** |
| 263 | * Keyblock verification errors (all in vb2_verify_keyblock()) |
| 264 | */ |
| 265 | VB2_ERROR_KEYBLOCK = VB2_ERROR_BASE + 0x060000, |
| 266 | |
| 267 | /* Data buffer too small for header */ |
| 268 | VB2_ERROR_KEYBLOCK_TOO_SMALL_FOR_HEADER, |
| 269 | |
| 270 | /* Magic number not present */ |
| 271 | VB2_ERROR_KEYBLOCK_MAGIC, |
| 272 | |
| 273 | /* Header version incompatible */ |
| 274 | VB2_ERROR_KEYBLOCK_HEADER_VERSION, |
| 275 | |
| 276 | /* Data buffer too small for keyblock */ |
| 277 | VB2_ERROR_KEYBLOCK_SIZE, |
| 278 | |
| 279 | /* Signature data offset outside keyblock */ |
| 280 | VB2_ERROR_KEYBLOCK_SIG_OUTSIDE, |
| 281 | |
| 282 | /* Signature signed more data than size of keyblock */ |
| 283 | VB2_ERROR_KEYBLOCK_SIGNED_TOO_MUCH, |
| 284 | |
| 285 | /* Signature signed less data than size of keyblock header */ |
| 286 | VB2_ERROR_KEYBLOCK_SIGNED_TOO_LITTLE, |
| 287 | |
| 288 | /* Signature invalid */ |
| 289 | VB2_ERROR_KEYBLOCK_SIG_INVALID, |
| 290 | |
| 291 | /* Data key outside keyblock */ |
| 292 | VB2_ERROR_KEYBLOCK_DATA_KEY_OUTSIDE, |
| 293 | |
| 294 | /* Data key outside signed part of keyblock */ |
| 295 | VB2_ERROR_KEYBLOCK_DATA_KEY_UNSIGNED, |
| 296 | |
Randall Spangler | 6b5b8f6 | 2014-10-31 15:18:48 -0700 | [diff] [blame] | 297 | /* Signature signed wrong amount of data */ |
| 298 | VB2_ERROR_KEYBLOCK_SIGNED_SIZE, |
| 299 | |
Bill Richardson | 36bc591 | 2015-03-04 16:13:45 -0800 | [diff] [blame] | 300 | /* No signature matching key ID */ |
| 301 | VB2_ERROR_KEYBLOCK_SIG_ID, |
Randall Spangler | 6b5b8f6 | 2014-10-31 15:18:48 -0700 | [diff] [blame] | 302 | |
Randall Spangler | 224f5ac | 2014-06-06 09:42:30 -0700 | [diff] [blame] | 303 | /********************************************************************** |
| 304 | * Preamble verification errors (all in vb2_verify_preamble()) |
| 305 | */ |
| 306 | VB2_ERROR_PREAMBLE = VB2_ERROR_BASE + 0x070000, |
| 307 | |
| 308 | /* Preamble data too small to contain header */ |
| 309 | VB2_ERROR_PREAMBLE_TOO_SMALL_FOR_HEADER, |
| 310 | |
| 311 | /* Header version incompatible */ |
| 312 | VB2_ERROR_PREAMBLE_HEADER_VERSION, |
| 313 | |
| 314 | /* Header version too old */ |
| 315 | VB2_ERROR_PREAMBLE_HEADER_OLD, |
| 316 | |
| 317 | /* Data buffer too small for preamble */ |
| 318 | VB2_ERROR_PREAMBLE_SIZE, |
| 319 | |
| 320 | /* Signature data offset outside preamble */ |
| 321 | VB2_ERROR_PREAMBLE_SIG_OUTSIDE, |
| 322 | |
| 323 | /* Signature signed more data than size of preamble */ |
| 324 | VB2_ERROR_PREAMBLE_SIGNED_TOO_MUCH, |
| 325 | |
| 326 | /* Signature signed less data than size of preamble header */ |
| 327 | VB2_ERROR_PREAMBLE_SIGNED_TOO_LITTLE, |
| 328 | |
| 329 | /* Signature invalid */ |
| 330 | VB2_ERROR_PREAMBLE_SIG_INVALID, |
| 331 | |
| 332 | /* Body signature outside preamble */ |
| 333 | VB2_ERROR_PREAMBLE_BODY_SIG_OUTSIDE, |
| 334 | |
| 335 | /* Kernel subkey outside preamble */ |
| 336 | VB2_ERROR_PREAMBLE_KERNEL_SUBKEY_OUTSIDE, |
| 337 | |
Randall Spangler | 43e0a9e | 2014-11-04 17:50:32 -0800 | [diff] [blame] | 338 | /* Bad magic number */ |
| 339 | VB2_ERROR_PREAMBLE_MAGIC, |
| 340 | |
| 341 | /* Hash is signed */ |
| 342 | VB2_ERROR_PREAMBLE_HASH_SIGNED, |
| 343 | |
Randall Spangler | 2d25e83 | 2015-05-12 16:39:01 -0700 | [diff] [blame] | 344 | /* Bootloader outside signed portion of body */ |
| 345 | VB2_ERROR_PREAMBLE_BOOTLOADER_OUTSIDE, |
| 346 | |
| 347 | /* Vmlinuz header outside signed portion of body */ |
| 348 | VB2_ERROR_PREAMBLE_VMLINUZ_HEADER_OUTSIDE, |
| 349 | |
Randall Spangler | 224f5ac | 2014-06-06 09:42:30 -0700 | [diff] [blame] | 350 | /********************************************************************** |
| 351 | * Misc higher-level code errors |
| 352 | */ |
| 353 | VB2_ERROR_MISC = VB2_ERROR_BASE + 0x080000, |
| 354 | |
| 355 | /* Work buffer too small in vb2_init_context() */ |
| 356 | VB2_ERROR_INITCTX_WORKBUF_SMALL, |
| 357 | |
| 358 | /* Work buffer unaligned in vb2_init_context() */ |
| 359 | VB2_ERROR_INITCTX_WORKBUF_ALIGN, |
| 360 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 361 | /* Work buffer too small in vb2_fw_parse_gbb() */ |
| 362 | VB2_ERROR_GBB_WORKBUF, |
| 363 | |
| 364 | /* Bad magic number in vb2_read_gbb_header() */ |
| 365 | VB2_ERROR_GBB_MAGIC, |
| 366 | |
| 367 | /* Incompatible version in vb2_read_gbb_header() */ |
| 368 | VB2_ERROR_GBB_VERSION, |
| 369 | |
| 370 | /* Old version in vb2_read_gbb_header() */ |
| 371 | VB2_ERROR_GBB_TOO_OLD, |
| 372 | |
| 373 | /* Header size too small in vb2_read_gbb_header() */ |
| 374 | VB2_ERROR_GBB_HEADER_SIZE, |
| 375 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 376 | /* Work buffer too small for root key in vb2_load_fw_keyblock() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 377 | VB2_ERROR_FW_KEYBLOCK_WORKBUF_ROOT_KEY, |
| 378 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 379 | /* Work buffer too small for header in vb2_load_fw_keyblock() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 380 | VB2_ERROR_FW_KEYBLOCK_WORKBUF_HEADER, |
| 381 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 382 | /* Work buffer too small for keyblock in vb2_load_fw_keyblock() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 383 | VB2_ERROR_FW_KEYBLOCK_WORKBUF, |
| 384 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 385 | /* Keyblock version out of range in vb2_load_fw_keyblock() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 386 | VB2_ERROR_FW_KEYBLOCK_VERSION_RANGE, |
| 387 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 388 | /* Keyblock version rollback in vb2_load_fw_keyblock() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 389 | VB2_ERROR_FW_KEYBLOCK_VERSION_ROLLBACK, |
| 390 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 391 | /* Missing firmware data key in vb2_load_fw_preamble() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 392 | VB2_ERROR_FW_PREAMBLE2_DATA_KEY, |
| 393 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 394 | /* Work buffer too small for header in vb2_load_fw_preamble() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 395 | VB2_ERROR_FW_PREAMBLE2_WORKBUF_HEADER, |
| 396 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 397 | /* Work buffer too small for preamble in vb2_load_fw_preamble() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 398 | VB2_ERROR_FW_PREAMBLE2_WORKBUF, |
| 399 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 400 | /* Firmware version out of range in vb2_load_fw_preamble() */ |
Randall Spangler | 308d254 | 2014-12-04 09:54:37 -0800 | [diff] [blame] | 401 | VB2_ERROR_FW_PREAMBLE_VERSION_RANGE, |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 402 | |
Randall Spangler | f18038b | 2014-10-23 15:55:21 -0700 | [diff] [blame] | 403 | /* Firmware version rollback in vb2_load_fw_preamble() */ |
Randall Spangler | 308d254 | 2014-12-04 09:54:37 -0800 | [diff] [blame] | 404 | VB2_ERROR_FW_PREAMBLE_VERSION_ROLLBACK, |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 405 | |
Randall Spangler | 837b408 | 2014-11-10 13:40:52 -0800 | [diff] [blame] | 406 | /* Not enough space in work buffer for resource object */ |
| 407 | VB2_ERROR_READ_RESOURCE_OBJECT_BUF, |
| 408 | |
Randall Spangler | 3d5cd88 | 2015-05-20 17:22:17 -0700 | [diff] [blame] | 409 | /* Work buffer too small for header in vb2_load_kernel_keyblock() */ |
| 410 | VB2_ERROR_KERNEL_KEYBLOCK_WORKBUF_HEADER, |
| 411 | |
| 412 | /* Work buffer too small for keyblock in vb2_load_kernel_keyblock() */ |
| 413 | VB2_ERROR_KERNEL_KEYBLOCK_WORKBUF, |
| 414 | |
| 415 | /* Keyblock version out of range in vb2_load_kernel_keyblock() */ |
| 416 | VB2_ERROR_KERNEL_KEYBLOCK_VERSION_RANGE, |
| 417 | |
| 418 | /* Keyblock version rollback in vb2_load_kernel_keyblock() */ |
| 419 | VB2_ERROR_KERNEL_KEYBLOCK_VERSION_ROLLBACK, |
| 420 | |
| 421 | /* |
| 422 | * Keyblock flags don't match current mode in |
| 423 | * vb2_load_kernel_keyblock(). |
| 424 | */ |
| 425 | VB2_ERROR_KERNEL_KEYBLOCK_DEV_FLAG, |
| 426 | VB2_ERROR_KERNEL_KEYBLOCK_REC_FLAG, |
| 427 | |
Randall Spangler | 22da78c | 2015-05-29 10:53:11 -0700 | [diff] [blame] | 428 | /* Missing firmware data key in vb2_load_kernel_preamble() */ |
| 429 | VB2_ERROR_KERNEL_PREAMBLE2_DATA_KEY, |
Randall Spangler | 3d5cd88 | 2015-05-20 17:22:17 -0700 | [diff] [blame] | 430 | |
Randall Spangler | 22da78c | 2015-05-29 10:53:11 -0700 | [diff] [blame] | 431 | /* Work buffer too small for header in vb2_load_kernel_preamble() */ |
| 432 | VB2_ERROR_KERNEL_PREAMBLE2_WORKBUF_HEADER, |
| 433 | |
| 434 | /* Work buffer too small for preamble in vb2_load_kernel_preamble() */ |
| 435 | VB2_ERROR_KERNEL_PREAMBLE2_WORKBUF, |
| 436 | |
| 437 | /* Kernel version out of range in vb2_load_kernel_preamble() */ |
| 438 | VB2_ERROR_KERNEL_PREAMBLE_VERSION_RANGE, |
| 439 | |
| 440 | /* Kernel version rollback in vb2_load_kernel_preamble() */ |
| 441 | VB2_ERROR_KERNEL_PREAMBLE_VERSION_ROLLBACK, |
| 442 | |
| 443 | /* Kernel preamble not loaded before calling vb2api_get_kernel_size() */ |
| 444 | VB2_ERROR_API_GET_KERNEL_SIZE_PREAMBLE, |
Randall Spangler | 3d5cd88 | 2015-05-20 17:22:17 -0700 | [diff] [blame] | 445 | |
Randall Spangler | 2145721 | 2014-06-06 09:30:14 -0700 | [diff] [blame] | 446 | /********************************************************************** |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 447 | * API-level errors |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 448 | */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 449 | VB2_ERROR_API = VB2_ERROR_BASE + 0x090000, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 450 | |
Bill Richardson | 9c647ef | 2015-03-03 10:39:08 -0800 | [diff] [blame] | 451 | /* Bad tag in vb2api_init_hash() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 452 | VB2_ERROR_API_INIT_HASH_TAG, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 453 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 454 | /* Preamble not present in vb2api_init_hash() */ |
| 455 | VB2_ERROR_API_INIT_HASH_PREAMBLE, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 456 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 457 | /* Work buffer too small in vb2api_init_hash() */ |
| 458 | VB2_ERROR_API_INIT_HASH_WORKBUF, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 459 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 460 | /* Missing firmware data key in vb2api_init_hash() */ |
| 461 | VB2_ERROR_API_INIT_HASH_DATA_KEY, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 462 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 463 | /* Uninitialized work area in vb2api_extend_hash() */ |
| 464 | VB2_ERROR_API_EXTEND_HASH_WORKBUF, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 465 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 466 | /* Too much data hashed in vb2api_extend_hash() */ |
| 467 | VB2_ERROR_API_EXTEND_HASH_SIZE, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 468 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 469 | /* Preamble not present in vb2api_check_hash() */ |
| 470 | VB2_ERROR_API_CHECK_HASH_PREAMBLE, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 471 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 472 | /* Uninitialized work area in vb2api_check_hash() */ |
| 473 | VB2_ERROR_API_CHECK_HASH_WORKBUF, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 474 | |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 475 | /* Wrong amount of data hashed in vb2api_check_hash() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 476 | VB2_ERROR_API_CHECK_HASH_SIZE, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 477 | |
Randall Spangler | a7ab8b5 | 2014-06-10 17:05:08 -0700 | [diff] [blame] | 478 | /* Work buffer too small in vb2api_check_hash() */ |
| 479 | VB2_ERROR_API_CHECK_HASH_WORKBUF_DIGEST, |
| 480 | |
Bill Richardson | 9c647ef | 2015-03-03 10:39:08 -0800 | [diff] [blame] | 481 | /* Bad tag in vb2api_check_hash() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 482 | VB2_ERROR_API_CHECK_HASH_TAG, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 483 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 484 | /* Missing firmware data key in vb2api_check_hash() */ |
| 485 | VB2_ERROR_API_CHECK_HASH_DATA_KEY, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 486 | |
Bill Richardson | 9c647ef | 2015-03-03 10:39:08 -0800 | [diff] [blame] | 487 | /* Signature size mismatch in vb2api_check_hash() */ |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 488 | VB2_ERROR_API_CHECK_HASH_SIG_SIZE, |
| 489 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 490 | /* Phase one needs recovery mode */ |
| 491 | VB2_ERROR_API_PHASE1_RECOVERY, |
| 492 | |
Bill Richardson | 9c647ef | 2015-03-03 10:39:08 -0800 | [diff] [blame] | 493 | /* Bad tag in vb2api_check_hash() */ |
Bill Richardson | 36bc591 | 2015-03-04 16:13:45 -0800 | [diff] [blame] | 494 | VB2_ERROR_API_INIT_HASH_ID, |
Randall Spangler | efa37b8 | 2014-11-12 16:20:50 -0800 | [diff] [blame] | 495 | |
Bill Richardson | 9c647ef | 2015-03-03 10:39:08 -0800 | [diff] [blame] | 496 | /* Signature mismatch in vb2api_check_hash() */ |
Randall Spangler | efa37b8 | 2014-11-12 16:20:50 -0800 | [diff] [blame] | 497 | VB2_ERROR_API_CHECK_HASH_SIG, |
| 498 | |
Daisuke Nojiri | 62d482e | 2015-01-29 14:37:25 -0800 | [diff] [blame] | 499 | /* Invalid enum vb2_pcr_digest requested to vb2api_get_pcr_digest */ |
| 500 | VB2_ERROR_API_PCR_DIGEST, |
| 501 | |
| 502 | /* Buffer size for the digest is too small for vb2api_get_pcr_digest */ |
| 503 | VB2_ERROR_API_PCR_DIGEST_BUF, |
| 504 | |
Randall Spangler | d7f0f93 | 2015-05-19 13:41:09 -0700 | [diff] [blame] | 505 | /* Work buffer too small for recovery key in vb2api_kernel_phase1() */ |
| 506 | VB2_ERROR_API_KPHASE1_WORKBUF_REC_KEY, |
| 507 | |
| 508 | /* Firmware preamble not present for vb2api_kernel_phase1() */ |
| 509 | VB2_ERROR_API_KPHASE1_PREAMBLE, |
| 510 | |
| 511 | /* Wrong amount of kernel data in vb2api_verify_kernel_data() */ |
| 512 | VB2_ERROR_API_VERIFY_KDATA_SIZE, |
| 513 | |
| 514 | /* Kernel preamble not present for vb2api_verify_kernel_data() */ |
| 515 | VB2_ERROR_API_VERIFY_KDATA_PREAMBLE, |
| 516 | |
| 517 | /* Insufficient workbuf for hashing in vb2api_verify_kernel_data() */ |
| 518 | VB2_ERROR_API_VERIFY_KDATA_WORKBUF, |
| 519 | |
| 520 | /* Bad data key in vb2api_verify_kernel_data() */ |
| 521 | VB2_ERROR_API_VERIFY_KDATA_KEY, |
| 522 | |
Randall Spangler | c8e4854 | 2015-09-17 12:54:51 -0700 | [diff] [blame] | 523 | /* Phase one passing through secdata's request to reboot */ |
| 524 | VB2_ERROR_API_PHASE1_SECDATA_REBOOT, |
| 525 | |
Aaron Durbin | 7cbd1ce | 2016-01-22 15:06:05 -0600 | [diff] [blame] | 526 | /* Digest buffer passed into vb2api_check_hash incorrect. */ |
| 527 | VB2_ERROR_API_CHECK_DIGEST_SIZE, |
| 528 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 529 | /********************************************************************** |
| 530 | * Errors which may be generated by implementations of vb2ex functions. |
| 531 | * Implementation may also return its own specific errors, which should |
| 532 | * NOT be in the range VB2_ERROR_BASE...VB2_ERROR_MAX to avoid |
| 533 | * conflicting with future vboot2 error codes. |
| 534 | */ |
| 535 | VB2_ERROR_EX = VB2_ERROR_BASE + 0x0a0000, |
| 536 | |
Randall Spangler | 25c95d0 | 2014-06-20 13:57:12 -0700 | [diff] [blame] | 537 | /* Read resource not implemented */ |
| 538 | VB2_ERROR_EX_READ_RESOURCE_UNIMPLEMENTED, |
| 539 | |
Randall Spangler | da2b49c | 2014-06-10 17:03:40 -0700 | [diff] [blame] | 540 | /* Resource index not found */ |
| 541 | VB2_ERROR_EX_READ_RESOURCE_INDEX, |
| 542 | |
| 543 | /* Size of resource not big enough for requested offset and/or size */ |
| 544 | VB2_ERROR_EX_READ_RESOURCE_SIZE, |
| 545 | |
| 546 | /* TPM clear owner failed */ |
| 547 | VB2_ERROR_EX_TPM_CLEAR_OWNER, |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 548 | |
Randall Spangler | 25c95d0 | 2014-06-20 13:57:12 -0700 | [diff] [blame] | 549 | /* TPM clear owner not implemented */ |
| 550 | VB2_ERROR_EX_TPM_CLEAR_OWNER_UNIMPLEMENTED, |
| 551 | |
Julius Werner | f10e909 | 2014-12-16 19:24:54 -0800 | [diff] [blame] | 552 | /* Hardware crypto engine doesn't support this algorithm (non-fatal) */ |
| 553 | VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED, |
| 554 | |
Randall Spangler | 02e11b3 | 2014-11-19 12:48:36 -0800 | [diff] [blame] | 555 | |
| 556 | /********************************************************************** |
| 557 | * Errors generated by host library (non-firmware) start here. |
| 558 | */ |
| 559 | VB2_ERROR_HOST_BASE = 0x20000000, |
| 560 | |
| 561 | /********************************************************************** |
| 562 | * Errors generated by host library misc functions |
| 563 | */ |
| 564 | VB2_ERROR_HOST_MISC = VB2_ERROR_HOST_BASE + 0x010000, |
| 565 | |
| 566 | /* Unable to open file in read_file() */ |
| 567 | VB2_ERROR_READ_FILE_OPEN, |
| 568 | |
| 569 | /* Bad size in read_file() */ |
| 570 | VB2_ERROR_READ_FILE_SIZE, |
| 571 | |
| 572 | /* Unable to allocate buffer in read_file() */ |
| 573 | VB2_ERROR_READ_FILE_ALLOC, |
| 574 | |
| 575 | /* Unable to read data in read_file() */ |
| 576 | VB2_ERROR_READ_FILE_DATA, |
| 577 | |
| 578 | /* Unable to open file in write_file() */ |
| 579 | VB2_ERROR_WRITE_FILE_OPEN, |
| 580 | |
| 581 | /* Unable to write data in write_file() */ |
| 582 | VB2_ERROR_WRITE_FILE_DATA, |
| 583 | |
Bill Richardson | 36bc591 | 2015-03-04 16:13:45 -0800 | [diff] [blame] | 584 | /* Unable to convert string to struct vb_id */ |
| 585 | VB2_ERROR_STR_TO_ID, |
Bill Richardson | 4e4c196 | 2015-02-03 17:07:15 -0800 | [diff] [blame] | 586 | |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 587 | /********************************************************************** |
Randall Spangler | 59c2920 | 2014-11-17 14:24:59 -0800 | [diff] [blame] | 588 | * Errors generated by host library key functions |
| 589 | */ |
| 590 | VB2_ERROR_HOST_KEY = VB2_ERROR_HOST_BASE + 0x020000, |
| 591 | |
| 592 | /* Unable to allocate key in vb2_private_key_read_pem() */ |
| 593 | VB2_ERROR_READ_PEM_ALLOC, |
| 594 | |
| 595 | /* Unable to open .pem file in vb2_private_key_read_pem() */ |
| 596 | VB2_ERROR_READ_PEM_FILE_OPEN, |
| 597 | |
| 598 | /* Bad RSA data from .pem file in vb2_private_key_read_pem() */ |
| 599 | VB2_ERROR_READ_PEM_RSA, |
| 600 | |
| 601 | /* Unable to set private key description */ |
| 602 | VB2_ERROR_PRIVATE_KEY_SET_DESC, |
| 603 | |
| 604 | /* Bad magic number in vb2_private_key_unpack() */ |
| 605 | VB2_ERROR_UNPACK_PRIVATE_KEY_MAGIC, |
| 606 | |
| 607 | /* Bad common header in vb2_private_key_unpack() */ |
| 608 | VB2_ERROR_UNPACK_PRIVATE_KEY_HEADER, |
| 609 | |
| 610 | /* Bad key data in vb2_private_key_unpack() */ |
| 611 | VB2_ERROR_UNPACK_PRIVATE_KEY_DATA, |
| 612 | |
| 613 | /* Bad struct version in vb2_private_key_unpack() */ |
| 614 | VB2_ERROR_UNPACK_PRIVATE_KEY_STRUCT_VERSION, |
| 615 | |
| 616 | /* Unable to allocate buffer in vb2_private_key_unpack() */ |
| 617 | VB2_ERROR_UNPACK_PRIVATE_KEY_ALLOC, |
| 618 | |
| 619 | /* Unable to unpack RSA key in vb2_private_key_unpack() */ |
| 620 | VB2_ERROR_UNPACK_PRIVATE_KEY_RSA, |
| 621 | |
| 622 | /* Unable to set description in vb2_private_key_unpack() */ |
| 623 | VB2_ERROR_UNPACK_PRIVATE_KEY_DESC, |
| 624 | |
Randall Spangler | fb9a216 | 2014-11-20 11:27:38 -0800 | [diff] [blame] | 625 | /* Bad bare hash key in vb2_private_key_unpack() */ |
| 626 | VB2_ERROR_UNPACK_PRIVATE_KEY_HASH, |
| 627 | |
Randall Spangler | 59c2920 | 2014-11-17 14:24:59 -0800 | [diff] [blame] | 628 | /* Unable to create RSA data in vb2_private_key_write() */ |
| 629 | VB2_ERROR_PRIVATE_KEY_WRITE_RSA, |
| 630 | |
| 631 | /* Unable to allocate packed key buffer in vb2_private_key_write() */ |
| 632 | VB2_ERROR_PRIVATE_KEY_WRITE_ALLOC, |
| 633 | |
| 634 | /* Unable to write file in vb2_private_key_write() */ |
| 635 | VB2_ERROR_PRIVATE_KEY_WRITE_FILE, |
| 636 | |
Randall Spangler | fb9a216 | 2014-11-20 11:27:38 -0800 | [diff] [blame] | 637 | /* Bad algorithm in vb2_private_key_hash() */ |
| 638 | VB2_ERROR_PRIVATE_KEY_HASH, |
| 639 | |
Randall Spangler | 59c2920 | 2014-11-17 14:24:59 -0800 | [diff] [blame] | 640 | /* Unable to determine key size in vb2_public_key_alloc() */ |
| 641 | VB2_ERROR_PUBLIC_KEY_ALLOC_SIZE, |
| 642 | |
| 643 | /* Unable to allocate buffer in vb2_public_key_alloc() */ |
| 644 | VB2_ERROR_PUBLIC_KEY_ALLOC, |
| 645 | |
| 646 | /* Unable to set public key description */ |
| 647 | VB2_ERROR_PUBLIC_KEY_SET_DESC, |
| 648 | |
| 649 | /* Unable to read key data in vb2_public_key_read_keyb() */ |
| 650 | VB2_ERROR_READ_KEYB_DATA, |
| 651 | |
| 652 | /* Wrong amount of data read in vb2_public_key_read_keyb() */ |
| 653 | VB2_ERROR_READ_KEYB_SIZE, |
| 654 | |
| 655 | /* Unable to allocate key buffer in vb2_public_key_read_keyb() */ |
| 656 | VB2_ERROR_READ_KEYB_ALLOC, |
| 657 | |
| 658 | /* Error unpacking RSA arrays in vb2_public_key_read_keyb() */ |
| 659 | VB2_ERROR_READ_KEYB_UNPACK, |
| 660 | |
| 661 | /* Unable to read key data in vb2_packed_key_read() */ |
| 662 | VB2_ERROR_READ_PACKED_KEY_DATA, |
| 663 | |
| 664 | /* Bad key data in vb2_packed_key_read() */ |
| 665 | VB2_ERROR_READ_PACKED_KEY, |
| 666 | |
| 667 | /* Unable to determine key size in vb2_public_key_pack() */ |
| 668 | VB2_ERROR_PUBLIC_KEY_PACK_SIZE, |
| 669 | |
Bill Richardson | 4e4c196 | 2015-02-03 17:07:15 -0800 | [diff] [blame] | 670 | /* Bad hash algorithm in vb2_public_key_hash() */ |
Randall Spangler | fb9a216 | 2014-11-20 11:27:38 -0800 | [diff] [blame] | 671 | VB2_ERROR_PUBLIC_KEY_HASH, |
| 672 | |
Randall Spangler | 939cc3a | 2016-06-21 15:23:32 -0700 | [diff] [blame] | 673 | /* Bad key size in vb2_copy_packed_key() */ |
| 674 | VB2_ERROR_COPY_KEY_SIZE, |
| 675 | |
Randall Spangler | d46461c | 2016-06-22 16:46:23 -0700 | [diff] [blame] | 676 | /* Unable to convert back to vb1 crypto algorithm */ |
| 677 | VB2_ERROR_VB1_CRYPTO_ALGORITHM, |
| 678 | |
Randall Spangler | f7559e4 | 2016-06-23 13:45:59 -0700 | [diff] [blame] | 679 | /* Unable to allocate packed key */ |
| 680 | VB2_ERROR_PACKED_KEY_ALLOC, |
| 681 | |
| 682 | /* Unable to copy packed key */ |
| 683 | VB2_ERROR_PACKED_KEY_COPY, |
| 684 | |
Randall Spangler | 59c2920 | 2014-11-17 14:24:59 -0800 | [diff] [blame] | 685 | /********************************************************************** |
Randall Spangler | c644a8c | 2014-11-21 11:04:36 -0800 | [diff] [blame] | 686 | * Errors generated by host library signature functions |
| 687 | */ |
| 688 | VB2_ERROR_HOST_SIG = VB2_ERROR_HOST_BASE + 0x030000, |
| 689 | |
| 690 | /* Bad hash algorithm in vb2_digest_info() */ |
| 691 | VB2_ERROR_DIGEST_INFO, |
| 692 | |
| 693 | /* |
| 694 | * Unable to determine signature size for key algorithm in |
| 695 | * vb2_sig_size_for_key(). |
| 696 | */ |
| 697 | VB2_ERROR_SIG_SIZE_FOR_KEY, |
| 698 | |
| 699 | /* Bad signature size in vb2_sign_data() */ |
| 700 | VB2_SIGN_DATA_SIG_SIZE, |
| 701 | |
| 702 | /* Unable to get digest info in vb2_sign_data() */ |
| 703 | VB2_SIGN_DATA_DIGEST_INFO, |
| 704 | |
| 705 | /* Unable to get digest size in vb2_sign_data() */ |
| 706 | VB2_SIGN_DATA_DIGEST_SIZE, |
| 707 | |
| 708 | /* Unable to allocate digest buffer in vb2_sign_data() */ |
| 709 | VB2_SIGN_DATA_DIGEST_ALLOC, |
| 710 | |
| 711 | /* Unable to initialize digest in vb2_sign_data() */ |
| 712 | VB2_SIGN_DATA_DIGEST_INIT, |
| 713 | |
| 714 | /* Unable to extend digest in vb2_sign_data() */ |
| 715 | VB2_SIGN_DATA_DIGEST_EXTEND, |
| 716 | |
| 717 | /* Unable to finalize digest in vb2_sign_data() */ |
| 718 | VB2_SIGN_DATA_DIGEST_FINALIZE, |
| 719 | |
| 720 | /* RSA encrypt failed in vb2_sign_data() */ |
| 721 | VB2_SIGN_DATA_RSA_ENCRYPT, |
| 722 | |
| 723 | /* Not enough buffer space to hold signature in vb2_sign_object() */ |
| 724 | VB2_SIGN_OBJECT_OVERFLOW, |
| 725 | |
| 726 | /********************************************************************** |
Randall Spangler | 9328bbf | 2014-11-24 12:55:29 -0800 | [diff] [blame] | 727 | * Errors generated by host library keyblock functions |
| 728 | */ |
| 729 | VB2_ERROR_HOST_KEYBLOCK = VB2_ERROR_HOST_BASE + 0x040000, |
| 730 | |
| 731 | /* Unable to determine signature sizes for vb2_create_keyblock() */ |
| 732 | VB2_KEYBLOCK_CREATE_SIG_SIZE, |
| 733 | |
| 734 | /* Unable to pack data key for vb2_create_keyblock() */ |
| 735 | VB2_KEYBLOCK_CREATE_DATA_KEY, |
| 736 | |
| 737 | /* Unable to allocate buffer in vb2_create_keyblock() */ |
| 738 | VB2_KEYBLOCK_CREATE_ALLOC, |
| 739 | |
| 740 | /* Unable to sign keyblock in vb2_create_keyblock() */ |
| 741 | VB2_KEYBLOCK_CREATE_SIGN, |
| 742 | |
| 743 | /********************************************************************** |
Randall Spangler | 42a8500 | 2014-11-25 10:52:59 -0800 | [diff] [blame] | 744 | * Errors generated by host library firmware preamble functions |
| 745 | */ |
| 746 | VB2_ERROR_HOST_FW_PREAMBLE = VB2_ERROR_HOST_BASE + 0x050000, |
| 747 | |
| 748 | /* Unable to determine signature sizes for vb2_create_fw_preamble() */ |
| 749 | VB2_FW_PREAMBLE_CREATE_SIG_SIZE, |
| 750 | |
| 751 | /* Unable to allocate buffer in vb2_create_fw_preamble() */ |
| 752 | VB2_FW_PREAMBLE_CREATE_ALLOC, |
| 753 | |
| 754 | /* Unable to sign preamble in vb2_create_fw_preamble() */ |
| 755 | VB2_FW_PREAMBLE_CREATE_SIGN, |
| 756 | |
| 757 | /********************************************************************** |
Randall Spangler | f87aa72 | 2016-09-09 10:49:37 -0700 | [diff] [blame] | 758 | * Errors generated by unit test functions |
| 759 | */ |
| 760 | VB2_ERROR_UNIT_TEST = VB2_ERROR_HOST_BASE + 0x060000, |
| 761 | |
| 762 | /* Unable to open an input file needed for a unit test */ |
| 763 | VB2_ERROR_TEST_INPUT_FILE, |
| 764 | |
| 765 | /********************************************************************** |
Randall Spangler | b9be536 | 2014-06-05 13:32:11 -0700 | [diff] [blame] | 766 | * Highest non-zero error generated inside vboot library. Note that |
| 767 | * error codes passed through vboot when it calls external APIs may |
| 768 | * still be outside this range. |
| 769 | */ |
Randall Spangler | 02e11b3 | 2014-11-19 12:48:36 -0800 | [diff] [blame] | 770 | VB2_ERROR_MAX = VB2_ERROR_BASE + 0x1fffffff, |
Randall Spangler | 786acda | 2014-05-22 13:27:07 -0700 | [diff] [blame] | 771 | }; |
| 772 | |
| 773 | #endif /* VBOOT_2_RETURN_CODES_H_ */ |