• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *
12  * Note that other values may be passed through from vb2ex_*() calls; see
13  * the comment for VB2_ERROR_EX below.
14  */
15 enum vb2_return_code {
16 	/* Success - no error */
17 	VB2_SUCCESS = 0,
18 
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 	 */
23 	VB2_ERROR_BASE = 0x10000000,
24 
25 	/* Unknown / unspecified error */
26 	VB2_ERROR_UNKNOWN = VB2_ERROR_BASE + 1,
27 
28 	/* Mock error for testing */
29 	VB2_ERROR_MOCK,
30 
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 
74 	/* Bad size calculation in vb2_check_padding() */
75 	VB2_ERROR_RSA_PADDING_SIZE,
76 
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 
96 	/* Bad struct version in vb2_secdata_init() */
97 	VB2_ERROR_SECDATA_VERSION,
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 
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 
114         /**********************************************************************
115 	 * Common code errors
116 	 */
117 	VB2_ERROR_COMMON = VB2_ERROR_BASE + 0x050000,
118 
119 	/* Buffer is smaller than alignment offset in vb2_align() */
120 	VB2_ERROR_ALIGN_BIGGER_THAN_SIZE,
121 
122 	/* Buffer is smaller than request in vb2_align() */
123 	VB2_ERROR_ALIGN_SIZE,
124 
125 	/* Parent wraps around in vb2_verify_member_inside() */
126 	VB2_ERROR_INSIDE_PARENT_WRAPS,
127 
128 	/* Member wraps around in vb2_verify_member_inside() */
129 	VB2_ERROR_INSIDE_MEMBER_WRAPS,
130 
131 	/* Member outside parent in vb2_verify_member_inside() */
132 	VB2_ERROR_INSIDE_MEMBER_OUTSIDE,
133 
134 	/* Member data wraps around in vb2_verify_member_inside() */
135 	VB2_ERROR_INSIDE_DATA_WRAPS,
136 
137 	/* Member data outside parent in vb2_verify_member_inside() */
138 	VB2_ERROR_INSIDE_DATA_OUTSIDE,
139 
140 	/* Unsupported signature algorithm in vb2_unpack_key() */
141 	VB2_ERROR_UNPACK_KEY_SIG_ALGORITHM,                      /* 0x150008 */
142 
143 	/* Bad key size in vb2_unpack_key() */
144 	VB2_ERROR_UNPACK_KEY_SIZE,
145 
146 	/* Bad key alignment in vb2_unpack_key() */
147 	VB2_ERROR_UNPACK_KEY_ALIGN,
148 
149 	/* Bad key array size in vb2_unpack_key() */
150 	VB2_ERROR_UNPACK_KEY_ARRAY_SIZE,
151 
152 	/* Bad algorithm in vb2_verify_data() */
153 	VB2_ERROR_VDATA_ALGORITHM,
154 
155 	/* Incorrect signature size for algorithm in vb2_verify_data() */
156 	VB2_ERROR_VDATA_SIG_SIZE,
157 
158 	/* Data smaller than length of signed data in vb2_verify_data() */
159 	VB2_ERROR_VDATA_NOT_ENOUGH_DATA,
160 
161 	/* Not enough work buffer for digest in vb2_verify_data() */
162 	VB2_ERROR_VDATA_WORKBUF_DIGEST,
163 
164 	/* Not enough work buffer for hash temp data in vb2_verify_data() */
165 	VB2_ERROR_VDATA_WORKBUF_HASHING,                         /* 0x150010 */
166 
167 	/*
168 	 * Bad digest size in vb2_verify_data() - probably because algorithm
169 	 * is bad.
170 	 */
171 	VB2_ERROR_VDATA_DIGEST_SIZE,
172 
173 	/* Unsupported hash algorithm in vb2_unpack_key() */
174 	VB2_ERROR_UNPACK_KEY_HASH_ALGORITHM,
175 
176 	/* Member data overlaps member header */
177 	VB2_ERROR_INSIDE_DATA_OVERLAP,
178 
179 	/* Unsupported packed key struct version */
180 	VB2_ERROR_UNPACK_KEY_STRUCT_VERSION,
181 
182 	/*
183 	 * Buffer too small for total, fixed size, or description reported in
184 	 * common header, or member data checked via
185 	 * vb2_verify_common_member().
186 	 */
187 	VB2_ERROR_COMMON_TOTAL_SIZE,
188 	VB2_ERROR_COMMON_FIXED_SIZE,
189 	VB2_ERROR_COMMON_DESC_SIZE,
190 	VB2_ERROR_COMMON_MEMBER_SIZE,                            /* 0x150018 */
191 
192 	/*
193 	 * Total, fixed, description, or member offset/size not a multiple of
194 	 * 32 bits.
195 	 */
196 	VB2_ERROR_COMMON_TOTAL_UNALIGNED,
197 	VB2_ERROR_COMMON_FIXED_UNALIGNED,
198 	VB2_ERROR_COMMON_DESC_UNALIGNED,
199 	VB2_ERROR_COMMON_MEMBER_UNALIGNED,
200 
201 	/* Common struct description or member data wraps address space */
202 	VB2_ERROR_COMMON_DESC_WRAPS,
203 	VB2_ERROR_COMMON_MEMBER_WRAPS,
204 
205 	/* Common struct description is not null-terminated */
206 	VB2_ERROR_COMMON_DESC_TERMINATOR,
207 
208 	/* Member data overlaps previous data */
209 	VB2_ERROR_COMMON_MEMBER_OVERLAP,                         /* 0x150020 */
210 
211 	/* Signature bad magic number */
212 	VB2_ERROR_SIG_MAGIC,
213 
214 	/* Signature incompatible version */
215 	VB2_ERROR_SIG_VERSION,
216 
217 	/* Signature header doesn't fit */
218 	VB2_ERROR_SIG_HEADER_SIZE,
219 
220 	/* Signature unsupported algorithm */
221 	VB2_ERROR_SIG_ALGORITHM,
222 
223 	/* Signature bad size for algorithm */
224 	VB2_ERROR_SIG_SIZE,
225 
226 	/* Wrong amount of data signed */
227 	VB2_ERROR_VDATA_SIZE,
228 
229 	/* Digest mismatch */
230 	VB2_ERROR_VDATA_VERIFY_DIGEST,
231 
232 	/* Key algorithm doesn't match signature algorithm */
233 	VB2_ERROR_VDATA_ALGORITHM_MISMATCH,
234 
235 	/* Bad magic number in vb2_unpack_key() */
236 	VB2_ERROR_UNPACK_KEY_MAGIC,
237 
238         /**********************************************************************
239 	 * Keyblock verification errors (all in vb2_verify_keyblock())
240 	 */
241 	VB2_ERROR_KEYBLOCK = VB2_ERROR_BASE + 0x060000,
242 
243 	/* Data buffer too small for header */
244 	VB2_ERROR_KEYBLOCK_TOO_SMALL_FOR_HEADER,
245 
246 	/* Magic number not present */
247 	VB2_ERROR_KEYBLOCK_MAGIC,
248 
249 	/* Header version incompatible */
250 	VB2_ERROR_KEYBLOCK_HEADER_VERSION,
251 
252 	/* Data buffer too small for keyblock */
253 	VB2_ERROR_KEYBLOCK_SIZE,
254 
255 	/* Signature data offset outside keyblock */
256 	VB2_ERROR_KEYBLOCK_SIG_OUTSIDE,
257 
258 	/* Signature signed more data than size of keyblock */
259 	VB2_ERROR_KEYBLOCK_SIGNED_TOO_MUCH,
260 
261 	/* Signature signed less data than size of keyblock header */
262 	VB2_ERROR_KEYBLOCK_SIGNED_TOO_LITTLE,
263 
264 	/* Signature invalid */
265 	VB2_ERROR_KEYBLOCK_SIG_INVALID,
266 
267 	/* Data key outside keyblock */
268 	VB2_ERROR_KEYBLOCK_DATA_KEY_OUTSIDE,
269 
270 	/* Data key outside signed part of keyblock */
271 	VB2_ERROR_KEYBLOCK_DATA_KEY_UNSIGNED,
272 
273 	/* Signature signed wrong amount of data */
274 	VB2_ERROR_KEYBLOCK_SIGNED_SIZE,
275 
276 	/* No signature matching key GUID */
277 	VB2_ERROR_KEYBLOCK_SIG_GUID,
278 
279         /**********************************************************************
280 	 * Preamble verification errors (all in vb2_verify_preamble())
281 	 */
282 	VB2_ERROR_PREAMBLE = VB2_ERROR_BASE + 0x070000,
283 
284 	/* Preamble data too small to contain header */
285 	VB2_ERROR_PREAMBLE_TOO_SMALL_FOR_HEADER,
286 
287 	/* Header version incompatible */
288 	VB2_ERROR_PREAMBLE_HEADER_VERSION,
289 
290 	/* Header version too old */
291 	VB2_ERROR_PREAMBLE_HEADER_OLD,
292 
293 	/* Data buffer too small for preamble */
294 	VB2_ERROR_PREAMBLE_SIZE,
295 
296 	/* Signature data offset outside preamble */
297 	VB2_ERROR_PREAMBLE_SIG_OUTSIDE,
298 
299 	/* Signature signed more data than size of preamble */
300 	VB2_ERROR_PREAMBLE_SIGNED_TOO_MUCH,
301 
302 	/* Signature signed less data than size of preamble header */
303 	VB2_ERROR_PREAMBLE_SIGNED_TOO_LITTLE,
304 
305 	/* Signature invalid */
306 	VB2_ERROR_PREAMBLE_SIG_INVALID,
307 
308 	/* Body signature outside preamble */
309 	VB2_ERROR_PREAMBLE_BODY_SIG_OUTSIDE,
310 
311 	/* Kernel subkey outside preamble */
312 	VB2_ERROR_PREAMBLE_KERNEL_SUBKEY_OUTSIDE,
313 
314 	/* Bad magic number */
315 	VB2_ERROR_PREAMBLE_MAGIC,
316 
317 	/* Hash is signed */
318 	VB2_ERROR_PREAMBLE_HASH_SIGNED,
319 
320         /**********************************************************************
321 	 * Misc higher-level code errors
322 	 */
323 	VB2_ERROR_MISC = VB2_ERROR_BASE + 0x080000,
324 
325 	/* Work buffer too small in vb2_init_context() */
326 	VB2_ERROR_INITCTX_WORKBUF_SMALL,
327 
328 	/* Work buffer unaligned in vb2_init_context() */
329 	VB2_ERROR_INITCTX_WORKBUF_ALIGN,
330 
331 	/* Work buffer too small in vb2_fw_parse_gbb() */
332 	VB2_ERROR_GBB_WORKBUF,
333 
334 	/* Bad magic number in vb2_read_gbb_header() */
335 	VB2_ERROR_GBB_MAGIC,
336 
337 	/* Incompatible version in vb2_read_gbb_header() */
338 	VB2_ERROR_GBB_VERSION,
339 
340 	/* Old version in vb2_read_gbb_header() */
341 	VB2_ERROR_GBB_TOO_OLD,
342 
343 	/* Header size too small in vb2_read_gbb_header() */
344 	VB2_ERROR_GBB_HEADER_SIZE,
345 
346 	/* Work buffer too small for root key in vb2_load_fw_keyblock() */
347 	VB2_ERROR_FW_KEYBLOCK_WORKBUF_ROOT_KEY,
348 
349 	/* Work buffer too small for header in vb2_load_fw_keyblock() */
350 	VB2_ERROR_FW_KEYBLOCK_WORKBUF_HEADER,
351 
352 	/* Work buffer too small for keyblock in vb2_load_fw_keyblock() */
353 	VB2_ERROR_FW_KEYBLOCK_WORKBUF,
354 
355 	/* Keyblock version out of range in vb2_load_fw_keyblock() */
356 	VB2_ERROR_FW_KEYBLOCK_VERSION_RANGE,
357 
358 	/* Keyblock version rollback in vb2_load_fw_keyblock() */
359 	VB2_ERROR_FW_KEYBLOCK_VERSION_ROLLBACK,
360 
361 	/* Missing firmware data key in vb2_load_fw_preamble() */
362 	VB2_ERROR_FW_PREAMBLE2_DATA_KEY,
363 
364 	/* Work buffer too small for header in vb2_load_fw_preamble() */
365 	VB2_ERROR_FW_PREAMBLE2_WORKBUF_HEADER,
366 
367 	/* Work buffer too small for preamble in vb2_load_fw_preamble() */
368 	VB2_ERROR_FW_PREAMBLE2_WORKBUF,
369 
370 	/* Firmware version out of range in vb2_load_fw_preamble() */
371 	VB2_ERROR_FW_PREAMBLE_VERSION_RANGE,
372 
373 	/* Firmware version rollback in vb2_load_fw_preamble() */
374 	VB2_ERROR_FW_PREAMBLE_VERSION_ROLLBACK,
375 
376 	/* Not enough space in work buffer for resource object */
377 	VB2_ERROR_READ_RESOURCE_OBJECT_BUF,
378 
379         /**********************************************************************
380 	 * API-level errors
381 	 */
382 	VB2_ERROR_API = VB2_ERROR_BASE + 0x090000,
383 
384 	/* Bag tag in vb2api_init_hash() */
385 	VB2_ERROR_API_INIT_HASH_TAG,
386 
387 	/* Preamble not present in vb2api_init_hash() */
388 	VB2_ERROR_API_INIT_HASH_PREAMBLE,
389 
390 	/* Work buffer too small in vb2api_init_hash() */
391 	VB2_ERROR_API_INIT_HASH_WORKBUF,
392 
393 	/* Missing firmware data key in vb2api_init_hash() */
394 	VB2_ERROR_API_INIT_HASH_DATA_KEY,
395 
396 	/* Uninitialized work area in vb2api_extend_hash() */
397 	VB2_ERROR_API_EXTEND_HASH_WORKBUF,
398 
399 	/* Too much data hashed in vb2api_extend_hash() */
400 	VB2_ERROR_API_EXTEND_HASH_SIZE,
401 
402 	/* Preamble not present in vb2api_check_hash() */
403 	VB2_ERROR_API_CHECK_HASH_PREAMBLE,
404 
405 	/* Uninitialized work area in vb2api_check_hash() */
406 	VB2_ERROR_API_CHECK_HASH_WORKBUF,
407 
408 	/* Wrong amount of data hashed in vb2api_check_hash() */
409 	VB2_ERROR_API_CHECK_HASH_SIZE,
410 
411 	/* Work buffer too small in vb2api_check_hash() */
412 	VB2_ERROR_API_CHECK_HASH_WORKBUF_DIGEST,
413 
414 	/* Bag tag in vb2api_check_hash() */
415 	VB2_ERROR_API_CHECK_HASH_TAG,
416 
417 	/* Missing firmware data key in vb2api_check_hash() */
418 	VB2_ERROR_API_CHECK_HASH_DATA_KEY,
419 
420 	/* Siganature size mismatch in vb2api_check_hash() */
421 	VB2_ERROR_API_CHECK_HASH_SIG_SIZE,
422 
423 	/* Phase one needs recovery mode */
424 	VB2_ERROR_API_PHASE1_RECOVERY,
425 
426 	/* Bag tag in vb2api_check_hash() */
427 	VB2_ERROR_API_INIT_HASH_GUID,
428 
429 	/* Siganature mismatch in vb2api_check_hash() */
430 	VB2_ERROR_API_CHECK_HASH_SIG,
431 
432 	/* Invalid enum vb2_pcr_digest requested to vb2api_get_pcr_digest */
433 	VB2_ERROR_API_PCR_DIGEST,
434 
435 	/* Buffer size for the digest is too small for vb2api_get_pcr_digest */
436 	VB2_ERROR_API_PCR_DIGEST_BUF,
437 
438         /**********************************************************************
439 	 * Errors which may be generated by implementations of vb2ex functions.
440 	 * Implementation may also return its own specific errors, which should
441 	 * NOT be in the range VB2_ERROR_BASE...VB2_ERROR_MAX to avoid
442 	 * conflicting with future vboot2 error codes.
443 	 */
444 	VB2_ERROR_EX = VB2_ERROR_BASE + 0x0a0000,
445 
446 	/* Read resource not implemented */
447 	VB2_ERROR_EX_READ_RESOURCE_UNIMPLEMENTED,
448 
449 	/* Resource index not found */
450 	VB2_ERROR_EX_READ_RESOURCE_INDEX,
451 
452 	/* Size of resource not big enough for requested offset and/or size */
453 	VB2_ERROR_EX_READ_RESOURCE_SIZE,
454 
455 	/* TPM clear owner failed */
456 	VB2_ERROR_EX_TPM_CLEAR_OWNER,
457 
458 	/* TPM clear owner not implemented */
459 	VB2_ERROR_EX_TPM_CLEAR_OWNER_UNIMPLEMENTED,
460 
461 	/* Hardware crypto engine doesn't support this algorithm (non-fatal) */
462 	VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED,
463 
464 
465         /**********************************************************************
466 	 * Errors generated by host library (non-firmware) start here.
467 	 */
468 	VB2_ERROR_HOST_BASE = 0x20000000,
469 
470         /**********************************************************************
471 	 * Errors generated by host library misc functions
472 	 */
473 	VB2_ERROR_HOST_MISC = VB2_ERROR_HOST_BASE + 0x010000,
474 
475 	/* Unable to open file in read_file() */
476 	VB2_ERROR_READ_FILE_OPEN,
477 
478 	/* Bad size in read_file() */
479 	VB2_ERROR_READ_FILE_SIZE,
480 
481 	/* Unable to allocate buffer in read_file() */
482 	VB2_ERROR_READ_FILE_ALLOC,
483 
484 	/* Unable to read data in read_file() */
485 	VB2_ERROR_READ_FILE_DATA,
486 
487 	/* Unable to open file in write_file() */
488 	VB2_ERROR_WRITE_FILE_OPEN,
489 
490 	/* Unable to write data in write_file() */
491 	VB2_ERROR_WRITE_FILE_DATA,
492 
493 	/* Unable to convert string to struct vb_guid */
494 	VB2_ERROR_STR_TO_GUID,
495 
496 	/* Unable to convert struct vb_guid to string */
497 	VB2_ERROR_GUID_TO_STR,
498 
499         /**********************************************************************
500 	 * Errors generated by host library key functions
501 	 */
502 	VB2_ERROR_HOST_KEY = VB2_ERROR_HOST_BASE + 0x020000,
503 
504 	/* Unable to allocate key  in vb2_private_key_read_pem() */
505 	VB2_ERROR_READ_PEM_ALLOC,
506 
507 	/* Unable to open .pem file in vb2_private_key_read_pem() */
508 	VB2_ERROR_READ_PEM_FILE_OPEN,
509 
510 	/* Bad RSA data from .pem file in vb2_private_key_read_pem() */
511 	VB2_ERROR_READ_PEM_RSA,
512 
513 	/* Unable to set private key description */
514 	VB2_ERROR_PRIVATE_KEY_SET_DESC,
515 
516 	/* Bad magic number in vb2_private_key_unpack() */
517 	VB2_ERROR_UNPACK_PRIVATE_KEY_MAGIC,
518 
519 	/* Bad common header in vb2_private_key_unpack() */
520 	VB2_ERROR_UNPACK_PRIVATE_KEY_HEADER,
521 
522 	/* Bad key data in vb2_private_key_unpack() */
523 	VB2_ERROR_UNPACK_PRIVATE_KEY_DATA,
524 
525 	/* Bad struct version in vb2_private_key_unpack() */
526 	VB2_ERROR_UNPACK_PRIVATE_KEY_STRUCT_VERSION,
527 
528 	/* Unable to allocate buffer in vb2_private_key_unpack() */
529 	VB2_ERROR_UNPACK_PRIVATE_KEY_ALLOC,
530 
531 	/* Unable to unpack RSA key in vb2_private_key_unpack() */
532 	VB2_ERROR_UNPACK_PRIVATE_KEY_RSA,
533 
534 	/* Unable to set description in vb2_private_key_unpack() */
535 	VB2_ERROR_UNPACK_PRIVATE_KEY_DESC,
536 
537 	/* Bad bare hash key in vb2_private_key_unpack() */
538 	VB2_ERROR_UNPACK_PRIVATE_KEY_HASH,
539 
540 	/* Unable to create RSA data in vb2_private_key_write() */
541 	VB2_ERROR_PRIVATE_KEY_WRITE_RSA,
542 
543 	/* Unable to allocate packed key buffer in vb2_private_key_write() */
544 	VB2_ERROR_PRIVATE_KEY_WRITE_ALLOC,
545 
546 	/* Unable to write file in vb2_private_key_write() */
547 	VB2_ERROR_PRIVATE_KEY_WRITE_FILE,
548 
549 	/* Bad algorithm in vb2_private_key_hash() */
550 	VB2_ERROR_PRIVATE_KEY_HASH,
551 
552 	/* Unable to determine key size in vb2_public_key_alloc() */
553 	VB2_ERROR_PUBLIC_KEY_ALLOC_SIZE,
554 
555 	/* Unable to allocate buffer in vb2_public_key_alloc() */
556 	VB2_ERROR_PUBLIC_KEY_ALLOC,
557 
558 	/* Unable to set public key description */
559 	VB2_ERROR_PUBLIC_KEY_SET_DESC,
560 
561 	/* Unable to read key data in vb2_public_key_read_keyb() */
562 	VB2_ERROR_READ_KEYB_DATA,
563 
564 	/* Wrong amount of data read in vb2_public_key_read_keyb() */
565 	VB2_ERROR_READ_KEYB_SIZE,
566 
567 	/* Unable to allocate key buffer in vb2_public_key_read_keyb() */
568 	VB2_ERROR_READ_KEYB_ALLOC,
569 
570 	/* Error unpacking RSA arrays in vb2_public_key_read_keyb() */
571 	VB2_ERROR_READ_KEYB_UNPACK,
572 
573 	/* Unable to read key data in vb2_packed_key_read() */
574 	VB2_ERROR_READ_PACKED_KEY_DATA,
575 
576 	/* Bad key data in vb2_packed_key_read() */
577 	VB2_ERROR_READ_PACKED_KEY,
578 
579 	/* Unable to determine key size in vb2_public_key_pack() */
580 	VB2_ERROR_PUBLIC_KEY_PACK_SIZE,
581 
582 	/* Bad hash algorithm in vb2_public_key_hash() */
583 	VB2_ERROR_PUBLIC_KEY_HASH,
584 
585         /**********************************************************************
586 	 * Errors generated by host library signature functions
587 	 */
588 	VB2_ERROR_HOST_SIG = VB2_ERROR_HOST_BASE + 0x030000,
589 
590 	/* Bad hash algorithm in vb2_digest_info() */
591 	VB2_ERROR_DIGEST_INFO,
592 
593 	/*
594 	 * Unable to determine signature size for key algorithm in
595 	 * vb2_sig_size_for_key().
596 	 */
597 	VB2_ERROR_SIG_SIZE_FOR_KEY,
598 
599 	/* Bad signature size in vb2_sign_data() */
600 	VB2_SIGN_DATA_SIG_SIZE,
601 
602 	/* Unable to get digest info in vb2_sign_data() */
603 	VB2_SIGN_DATA_DIGEST_INFO,
604 
605 	/* Unable to get digest size in vb2_sign_data() */
606 	VB2_SIGN_DATA_DIGEST_SIZE,
607 
608 	/* Unable to allocate digest buffer in vb2_sign_data() */
609 	VB2_SIGN_DATA_DIGEST_ALLOC,
610 
611 	/* Unable to initialize digest in vb2_sign_data() */
612 	VB2_SIGN_DATA_DIGEST_INIT,
613 
614 	/* Unable to extend digest in vb2_sign_data() */
615 	VB2_SIGN_DATA_DIGEST_EXTEND,
616 
617 	/* Unable to finalize digest in vb2_sign_data() */
618 	VB2_SIGN_DATA_DIGEST_FINALIZE,
619 
620 	/* RSA encrypt failed in vb2_sign_data() */
621 	VB2_SIGN_DATA_RSA_ENCRYPT,
622 
623 	/* Not enough buffer space to hold signature in vb2_sign_object() */
624 	VB2_SIGN_OBJECT_OVERFLOW,
625 
626         /**********************************************************************
627 	 * Errors generated by host library keyblock functions
628 	 */
629 	VB2_ERROR_HOST_KEYBLOCK = VB2_ERROR_HOST_BASE + 0x040000,
630 
631 	/* Unable to determine signature sizes for vb2_create_keyblock() */
632 	VB2_KEYBLOCK_CREATE_SIG_SIZE,
633 
634 	/* Unable to pack data key for vb2_create_keyblock() */
635 	VB2_KEYBLOCK_CREATE_DATA_KEY,
636 
637 	/* Unable to allocate buffer in vb2_create_keyblock() */
638 	VB2_KEYBLOCK_CREATE_ALLOC,
639 
640 	/* Unable to sign keyblock in vb2_create_keyblock() */
641 	VB2_KEYBLOCK_CREATE_SIGN,
642 
643         /**********************************************************************
644 	 * Errors generated by host library firmware preamble functions
645 	 */
646 	VB2_ERROR_HOST_FW_PREAMBLE = VB2_ERROR_HOST_BASE + 0x050000,
647 
648 	/* Unable to determine signature sizes for vb2_create_fw_preamble() */
649 	VB2_FW_PREAMBLE_CREATE_SIG_SIZE,
650 
651 	/* Unable to allocate buffer in vb2_create_fw_preamble() */
652 	VB2_FW_PREAMBLE_CREATE_ALLOC,
653 
654 	/* Unable to sign preamble in vb2_create_fw_preamble() */
655 	VB2_FW_PREAMBLE_CREATE_SIGN,
656 
657         /**********************************************************************
658 	 * Highest non-zero error generated inside vboot library.  Note that
659 	 * error codes passed through vboot when it calls external APIs may
660 	 * still be outside this range.
661 	 */
662 	VB2_ERROR_MAX = VB2_ERROR_BASE + 0x1fffffff,
663 };
664 
665 #endif  /* VBOOT_2_RETURN_CODES_H_ */
666