Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: firmware/lib/include/vboot_common.h

Issue 6626045: Pass VbSharedData between LoadFirmware() and LoadKernel() (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Fixes from code review. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « firmware/include/vboot_struct.h ('k') | firmware/lib/vboot_common.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Common functions between firmware and kernel verified boot. 5 * Common functions between firmware and kernel verified boot.
6 */ 6 */
7 7
8 #ifndef VBOOT_REFERENCE_VBOOT_COMMON_H_ 8 #ifndef VBOOT_REFERENCE_VBOOT_COMMON_H_
9 #define VBOOT_REFERENCE_VBOOT_COMMON_H_ 9 #define VBOOT_REFERENCE_VBOOT_COMMON_H_
10 10
11 #include "cryptolib.h" 11 #include "cryptolib.h"
12 #include "vboot_struct.h" 12 #include "vboot_struct.h"
13 13
14 /* Error Codes for all common functions. */ 14 /* Error Codes for all common functions. */
15 enum { 15 enum {
16 VBOOT_SUCCESS = 0, 16 VBOOT_SUCCESS = 0,
17 VBOOT_KEY_BLOCK_INVALID, /* Key block internal structure is 17 VBOOT_KEY_BLOCK_INVALID, /* Key block internal structure is
18 * invalid, or not a key block */ 18 * invalid, or not a key block */
19 VBOOT_KEY_BLOCK_SIGNATURE, /* Key block signature check failed */ 19 VBOOT_KEY_BLOCK_SIGNATURE, /* Key block signature check failed */
20 VBOOT_KEY_BLOCK_HASH, /* Key block hash check failed */ 20 VBOOT_KEY_BLOCK_HASH, /* Key block hash check failed */
21 VBOOT_PUBLIC_KEY_INVALID, /* Invalid public key passed to a 21 VBOOT_PUBLIC_KEY_INVALID, /* Invalid public key passed to a
22 * signature verficiation function. */ 22 * signature verficiation function. */
23 VBOOT_PREAMBLE_INVALID, /* Preamble internal structure is 23 VBOOT_PREAMBLE_INVALID, /* Preamble internal structure is
24 * invalid */ 24 * invalid */
25 VBOOT_PREAMBLE_SIGNATURE, /* Preamble signature check failed */ 25 VBOOT_PREAMBLE_SIGNATURE, /* Preamble signature check failed */
26 VBOOT_SHARED_DATA_INVALID, /* Shared data is invalid. */
26 VBOOT_ERROR_MAX, 27 VBOOT_ERROR_MAX,
27 }; 28 };
28 extern char* kVbootErrors[VBOOT_ERROR_MAX]; 29 extern char* kVbootErrors[VBOOT_ERROR_MAX];
29 30
30 31
31 /* Return offset of ptr from base. */ 32 /* Return offset of ptr from base. */
32 uint64_t OffsetOf(const void* base, const void* ptr); 33 uint64_t OffsetOf(const void* base, const void* ptr);
33 34
34 35
35 /* Helper functions to get data pointed to by a public key or signature. */ 36 /* Helper functions to get data pointed to by a public key or signature. */
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 101
101 102
102 /* Checks the sanity of a kernel preamble of size [size] bytes, 103 /* Checks the sanity of a kernel preamble of size [size] bytes,
103 * using public key [key]. 104 * using public key [key].
104 * 105 *
105 * Returns VBOOT_SUCCESS if successful. */ 106 * Returns VBOOT_SUCCESS if successful. */
106 int VerifyKernelPreamble(const VbKernelPreambleHeader* preamble, 107 int VerifyKernelPreamble(const VbKernelPreambleHeader* preamble,
107 uint64_t size, const RSAPublicKey* key); 108 uint64_t size, const RSAPublicKey* key);
108 109
109 110
111 /* Initialize a verified boot shared data structure.
112 *
113 * Returns 0 if success, non-zero if error. */
114 int VbSharedDataInit(VbSharedDataHeader* header, uint64_t size);
115
116 /* Reserve [size] bytes of the shared data area. Returns the offset of the
117 * reserved data from the start of the shared data buffer, or 0 if error. */
118 uint64_t VbSharedDataReserve(VbSharedDataHeader* header, uint64_t size);
119
120 /* Copy the kernel subkey into the shared data.
121 *
122 * Returns 0 if success, non-zero if error. */
123 int VbSharedDataSetKernelKey(VbSharedDataHeader* header,
124 const VbPublicKey* src);
110 125
111 126
112 #endif /* VBOOT_REFERENCE_VBOOT_COMMON_H_ */ 127 #endif /* VBOOT_REFERENCE_VBOOT_COMMON_H_ */
OLDNEW
« no previous file with comments | « firmware/include/vboot_struct.h ('k') | firmware/lib/vboot_common.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698