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

Side by Side Diff: src/platform/vboot_reference/vfirmware/include/firmware_image_fw.h

Issue 1578035: Change VerifyFirmware() to take separate pointers to firmware verification header and firmware data. (Closed)
Patch Set: review fixes Created 10 years, 8 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
« no previous file with comments | « src/platform/vboot_reference/vfirmware/firmware_image_fw.c ('k') | no next file » | 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) 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 * (Firmware Portion) 6 * (Firmware Portion)
7 */ 7 */
8 8
9 #ifndef VBOOT_REFERENCE_FIRMWARE_IMAGE_FW_H_ 9 #ifndef VBOOT_REFERENCE_FIRMWARE_IMAGE_FW_H_
10 #define VBOOT_REFERENCE_FIRMWARE_IMAGE_FW_H_ 10 #define VBOOT_REFERENCE_FIRMWARE_IMAGE_FW_H_
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 * 81 *
82 * On success, put firmware length into [firmware_len], and return 0. 82 * On success, put firmware length into [firmware_len], and return 0.
83 * Else, return error code on failure. 83 * Else, return error code on failure.
84 */ 84 */
85 int VerifyFirmwarePreamble(RSAPublicKey* sign_key, 85 int VerifyFirmwarePreamble(RSAPublicKey* sign_key,
86 const uint8_t* preamble_blob, 86 const uint8_t* preamble_blob,
87 int algorithm, 87 int algorithm,
88 uint64_t* firmware_len); 88 uint64_t* firmware_len);
89 89
90 /* Checks the signature on the preamble + firmware data at 90 /* Checks the signature on the preamble + firmware data at
91 * [preamble_start] and [firmware_data_start]. 91 * [preamble_start] and [firmware_data].
92 * The length of the actual firmware data is firmware_len and it is assumed to 92 * The length of the actual firmware data is firmware_len and it is assumed to
93 * be prepended with the signature whose size depends on the signature_algorithm 93 * be prepended with the signature whose size depends on the signature_algorithm
94 * [algorithm]. This signature also covers the preamble data (but not the 94 * [algorithm]. This signature also covers the preamble data (but not the
95 * preamble signature itself). 95 * preamble signature itself).
96 * 96 *
97 * Return 0 on success, error code on failure. 97 * Return 0 on success, error code on failure.
98 */ 98 */
99 int VerifyFirmwareData(RSAPublicKey* sign_key, 99 int VerifyFirmwareData(RSAPublicKey* sign_key,
100 const uint8_t* preamble_start, 100 const uint8_t* preamble_start,
101 const uint8_t* firmware_data_start, 101 const uint8_t* firmware_data,
102 uint64_t firmware_len, 102 uint64_t firmware_len,
103 int algorithm); 103 int algorithm);
104 104
105 /* Performs a chained verify of the firmware blob [firmware_blob]. 105 /* Performs a chained verify of the firmware blob [firmware_blob], using root
106 * key [root_key] and verification header [verification_header_blob].
106 * 107 *
107 * Returns 0 on success, error code on failure. 108 * Returns 0 on success, error code on failure.
108 * 109 *
109 * NOTE: The length of the firmware blob is derived from reading the fields 110 * NOTE: The length of the firmware blob is derived from reading the fields
110 * in the first few bytes of the buffer. This might look risky but in firmware 111 * in the first few bytes of the verification header. This might look risky but
111 * land, the start address of the firmware_blob will always be fixed depending 112 * in firmware land, the start address of the firmware_blob will always be fixed
112 * on the memory map on the particular platform. In addition, the signature on 113 * depending on the memory map on the particular platform. In addition, the
113 * length itself is checked early in the verification process for extra safety. 114 * signature on length itself is checked early in the verification process for
115 * extra safety.
114 */ 116 */
115 int VerifyFirmware(const uint8_t* root_key_blob, 117 int VerifyFirmware(const uint8_t* root_key_blob,
118 const uint8_t* verification_header_blob,
116 const uint8_t* firmware_blob); 119 const uint8_t* firmware_blob);
117 120
118 /* Returns the logical version of a firmware blob which is calculated as 121 /* Returns the logical version of a firmware blob which is calculated as
119 * (firmware_key_version << 16 | firmware_version). */ 122 * (firmware_key_version << 16 | firmware_version). */
120 uint32_t GetLogicalFirmwareVersion(uint8_t* firmware_blob); 123 uint32_t GetLogicalFirmwareVersion(uint8_t* firmware_blob);
121 124
122 #define BOOT_FIRMWARE_A_CONTINUE 1 125 #define BOOT_FIRMWARE_A_CONTINUE 1
123 #define BOOT_FIRMWARE_B_CONTINUE 2 126 #define BOOT_FIRMWARE_B_CONTINUE 2
124 #define BOOT_FIRMWARE_RECOVERY_CONTINUE 3 127 #define BOOT_FIRMWARE_RECOVERY_CONTINUE 3
125 128
126 /* This function is the driver used by the RO firmware to 129 /* This function is the driver used by the RO firmware to
127 * determine which copy of the firmware to boot from. It performs 130 * determine which copy of the firmware to boot from. It performs
128 * the requisite rollback index checking, including updating them, 131 * the requisite rollback index checking, including updating them,
129 * if required. 132 * if required.
130 * 133 *
131 * Returns the code path to follow. It is one of: 134 * Returns the code path to follow. It is one of:
132 * BOOT_FIRMWARE_A_CONTINUE Boot from Firmware A 135 * BOOT_FIRMWARE_A_CONTINUE Boot from Firmware A
133 * BOOT_FIRMWARE_B_CONTINUE Boot from Firmware B 136 * BOOT_FIRMWARE_B_CONTINUE Boot from Firmware B
134 * BOOT_FIRMWARE_RECOVERY_CONTINUE Jump to recovery mode 137 * BOOT_FIRMWARE_RECOVERY_CONTINUE Jump to recovery mode
135 */ 138 */
136 int VerifyFirmwareDriver_f(uint8_t* root_key_blob, 139 int VerifyFirmwareDriver_f(uint8_t* root_key_blob,
140 uint8_t* verification_headerA,
137 uint8_t* firmwareA, 141 uint8_t* firmwareA,
142 uint8_t* verification_headerB,
138 uint8_t* firmwareB); 143 uint8_t* firmwareB);
139 144
140
141 #endif /* VBOOT_REFERENCE_FIRMWARE_IMAGE_FW_H_ */ 145 #endif /* VBOOT_REFERENCE_FIRMWARE_IMAGE_FW_H_ */
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/vfirmware/firmware_image_fw.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698