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

Side by Side Diff: src/platform/vboot_reference/include/firmware_image.h

Issue 1430001: VBoot Reference: Fix splicing bugs in Firmware and Kernel verification. (Closed)
Patch Set: . Created 10 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
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 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 * Data structure and API definitions for a verified boot firmware image. 5 * Data structure and API definitions for a verified boot firmware image.
6 */ 6 */
7 7
8 #ifndef VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ 8 #ifndef VBOOT_REFERENCE_FIRMWARE_IMAGE_H_
9 #define VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ 9 #define VBOOT_REFERENCE_FIRMWARE_IMAGE_H_
10 10
(...skipping 26 matching lines...) Expand all
37 /* Firmware Preamble. */ 37 /* Firmware Preamble. */
38 uint16_t firmware_version; /* Firmware Version# for preventing rollbacks.*/ 38 uint16_t firmware_version; /* Firmware Version# for preventing rollbacks.*/
39 uint64_t firmware_len; /* Length of the rest of the R/W firmware data. */ 39 uint64_t firmware_len; /* Length of the rest of the R/W firmware data. */
40 uint8_t preamble[FIRMWARE_PREAMBLE_SIZE]; /* Remaining preamble data.*/ 40 uint8_t preamble[FIRMWARE_PREAMBLE_SIZE]; /* Remaining preamble data.*/
41 41
42 uint8_t* preamble_signature; /* Signature over the preamble. */ 42 uint8_t* preamble_signature; /* Signature over the preamble. */
43 43
44 /* The firmware signature comes first as it may allow us to parallelize 44 /* The firmware signature comes first as it may allow us to parallelize
45 * the firmware data fetch and RSA public operation. 45 * the firmware data fetch and RSA public operation.
46 */ 46 */
47 uint8_t* firmware_signature; /* Signature on [firmware_data]. */ 47 uint8_t* firmware_signature; /* Signature on the Preamble +
48 [firmware_data]. */
48 uint8_t* firmware_data; /* Rest of firmware data */ 49 uint8_t* firmware_data; /* Rest of firmware data */
49 50
50 } FirmwareImage; 51 } FirmwareImage;
51 52
52 /* Allocate and return a new FirmwareImage structure. */ 53 /* Allocate and return a new FirmwareImage structure. */
53 FirmwareImage* FirmwareImageNew(void); 54 FirmwareImage* FirmwareImageNew(void);
54 55
55 /* Deep free the contents of [fw]. */ 56 /* Deep free the contents of [fw]. */
56 void FirmwareImageFree(FirmwareImage* fw); 57 void FirmwareImageFree(FirmwareImage* fw);
57 58
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 * [preamble_blob] using the signing key [sign_key]. 136 * [preamble_blob] using the signing key [sign_key].
136 * 137 *
137 * On success, put firmware length into [firmware_len], and return 0. 138 * On success, put firmware length into [firmware_len], and return 0.
138 * Else, return error code on failure. 139 * Else, return error code on failure.
139 */ 140 */
140 int VerifyFirmwarePreamble(RSAPublicKey* sign_key, 141 int VerifyFirmwarePreamble(RSAPublicKey* sign_key,
141 const uint8_t* preamble_blob, 142 const uint8_t* preamble_blob,
142 int algorithm, 143 int algorithm,
143 int* firmware_len); 144 int* firmware_len);
144 145
145 /* Checks the signature on the firmware data at location [firmware_data_start]. 146 /* Checks the signature on the preamble + firmware data at
147 * [preamble_start] and [firmware_data_start].
146 * The length of the actual firmware data is firmware_len and it is assumed to 148 * The length of the actual firmware data is firmware_len and it is assumed to
147 * be prepended with the signature whose size depends on the signature_algorithm 149 * be prepended with the signature whose size depends on the signature_algorithm
148 * [algorithm]. 150 * [algorithm]. This signature also covers the preamble data (but not the
151 * preamble signature itself).
149 * 152 *
150 * Return 0 on success, error code on failure. 153 * Return 0 on success, error code on failure.
151 */ 154 */
152 int VerifyFirmwareData(RSAPublicKey* sign_key, 155 int VerifyFirmwareData(RSAPublicKey* sign_key,
156 const uint8_t* preamble_start,
153 const uint8_t* firmware_data_start, 157 const uint8_t* firmware_data_start,
154 int firmware_len, 158 int firmware_len,
155 int algorithm); 159 int algorithm);
156 160
157 /* Performs a chained verify of the firmware blob [firmware_blob]. 161 /* Performs a chained verify of the firmware blob [firmware_blob].
158 * 162 *
159 * Returns 0 on success, error code on failure. 163 * Returns 0 on success, error code on failure.
160 * 164 *
161 * NOTE: The length of the firmware blob is derived from reading the fields 165 * NOTE: The length of the firmware blob is derived from reading the fields
162 * in the first few bytes of the buffer. This might look risky but in firmware 166 * in the first few bytes of the buffer. This might look risky but in firmware
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 * Returns the code path to follow. It is one of: 211 * Returns the code path to follow. It is one of:
208 * BOOT_FIRMWARE_A_CONTINUE Boot from Firmware A 212 * BOOT_FIRMWARE_A_CONTINUE Boot from Firmware A
209 * BOOT_FIRMWARE_B_CONTINUE Boot from Firmware B 213 * BOOT_FIRMWARE_B_CONTINUE Boot from Firmware B
210 * BOOT_FIRMWARE_RECOVERY_CONTINUE Jump to recovery mode 214 * BOOT_FIRMWARE_RECOVERY_CONTINUE Jump to recovery mode
211 */ 215 */
212 int VerifyFirmwareDriver_f(uint8_t* root_key_blob, 216 int VerifyFirmwareDriver_f(uint8_t* root_key_blob,
213 uint8_t* firmwareA, 217 uint8_t* firmwareA,
214 uint8_t* firmwareB); 218 uint8_t* firmwareB);
215 219
216 #endif /* VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ */ 220 #endif /* VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698