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

Side by Side Diff: vboot_firmware/lib/vboot_common.c

Issue 2729021: Clean up of key block functions (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: More key block cleanup Created 10 years, 6 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 | « vboot_firmware/lib/include/vboot_common.h ('k') | vboot_firmware/lib/vboot_firmware.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) 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 * Common functions between firmware and kernel verified boot. 5 * Common functions between firmware and kernel verified boot.
6 * (Firmware portion) 6 * (Firmware portion)
7 */ 7 */
8 8
9 /* TODO: change all 'return 0', 'return 1' into meaningful return codes */ 9 /* TODO: change all 'return 0', 'return 1' into meaningful return codes */
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 if (!RSAVerifyBinary_f(NULL, key, data, sig->data_size, 119 if (!RSAVerifyBinary_f(NULL, key, data, sig->data_size,
120 GetSignatureDataC(sig), key->algorithm)) 120 GetSignatureDataC(sig), key->algorithm))
121 return 1; 121 return 1;
122 122
123 return 0; 123 return 0;
124 } 124 }
125 125
126 126
127 int VerifyKeyBlock(const VbKeyBlockHeader* block, uint64_t size, 127 int KeyBlockVerify(const VbKeyBlockHeader* block, uint64_t size,
128 const VbPublicKey *key) { 128 const VbPublicKey *key) {
129 129
130 const VbSignature* sig; 130 const VbSignature* sig;
131 131
132 /* Sanity checks before attempting signature of data */ 132 /* Sanity checks before attempting signature of data */
133 if (SafeMemcmp(block->magic, KEY_BLOCK_MAGIC, KEY_BLOCK_MAGIC_SIZE)) { 133 if (SafeMemcmp(block->magic, KEY_BLOCK_MAGIC, KEY_BLOCK_MAGIC_SIZE)) {
134 debug("Not a valid verified boot key block.\n"); 134 debug("Not a valid verified boot key block.\n");
135 return 1; 135 return 1;
136 } 136 }
137 if (block->header_version_major != KEY_BLOCK_HEADER_VERSION_MAJOR) { 137 if (block->header_version_major != KEY_BLOCK_HEADER_VERSION_MAJOR) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 /* Verify body signature is inside the block */ 303 /* Verify body signature is inside the block */
304 if (VerifySignatureInside(preamble, preamble->preamble_size, 304 if (VerifySignatureInside(preamble, preamble->preamble_size,
305 &preamble->body_signature)) { 305 &preamble->body_signature)) {
306 debug("Kernel body signature off end of preamble\n"); 306 debug("Kernel body signature off end of preamble\n");
307 return 1; 307 return 1;
308 } 308 }
309 309
310 /* Success */ 310 /* Success */
311 return 0; 311 return 0;
312 } 312 }
OLDNEW
« no previous file with comments | « vboot_firmware/lib/include/vboot_common.h ('k') | vboot_firmware/lib/vboot_firmware.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698