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

Side by Side Diff: vboot_firmware/lib/vboot_kernel.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/vboot_firmware.c ('k') | vboot_firmware/linktest/main.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 * Functions for loading a kernel from disk. 5 * Functions for loading a kernel from disk.
6 * (Firmware portion) 6 * (Firmware portion)
7 */ 7 */
8 8
9 #include "vboot_kernel.h" 9 #include "vboot_kernel.h"
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 found_partitions++; 85 found_partitions++;
86 86
87 /* Read the first part of the kernel partition */ 87 /* Read the first part of the kernel partition */
88 if (part_size < kbuf_sectors) 88 if (part_size < kbuf_sectors)
89 continue; 89 continue;
90 if (0 != BootDeviceReadLBA(part_start, kbuf_sectors, kbuf)) 90 if (0 != BootDeviceReadLBA(part_start, kbuf_sectors, kbuf))
91 continue; 91 continue;
92 92
93 /* Verify the key block */ 93 /* Verify the key block */
94 key_block = (VbKeyBlockHeader*)kbuf; 94 key_block = (VbKeyBlockHeader*)kbuf;
95 if ((0 != VerifyKeyBlock(key_block, KBUF_SIZE, kernel_subkey))) 95 if ((0 != KeyBlockVerify(key_block, KBUF_SIZE, kernel_subkey)))
96 continue; 96 continue;
97 97
98 /* Check the key block flags against the current boot mode */ 98 /* Check the key block flags against the current boot mode */
99 if (!(key_block->key_block_flags && 99 if (!(key_block->key_block_flags &&
100 ((BOOT_FLAG_DEVELOPER & params->boot_flags) ? 100 ((BOOT_FLAG_DEVELOPER & params->boot_flags) ?
101 KEY_BLOCK_FLAG_DEVELOPER_1 : KEY_BLOCK_FLAG_DEVELOPER_0))) 101 KEY_BLOCK_FLAG_DEVELOPER_1 : KEY_BLOCK_FLAG_DEVELOPER_0)))
102 continue; 102 continue;
103 if (!(key_block->key_block_flags && 103 if (!(key_block->key_block_flags &&
104 ((BOOT_FLAG_RECOVERY & params->boot_flags) ? 104 ((BOOT_FLAG_RECOVERY & params->boot_flags) ?
105 KEY_BLOCK_FLAG_RECOVERY_1 : KEY_BLOCK_FLAG_RECOVERY_0))) 105 KEY_BLOCK_FLAG_RECOVERY_1 : KEY_BLOCK_FLAG_RECOVERY_0)))
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 /* Success! */ 258 /* Success! */
259 return LOAD_KERNEL_SUCCESS; 259 return LOAD_KERNEL_SUCCESS;
260 } 260 }
261 261
262 // Handle error cases 262 // Handle error cases
263 if (found_partitions) 263 if (found_partitions)
264 return LOAD_KERNEL_INVALID; 264 return LOAD_KERNEL_INVALID;
265 else 265 else
266 return LOAD_KERNEL_NOT_FOUND; 266 return LOAD_KERNEL_NOT_FOUND;
267 } 267 }
OLDNEW
« no previous file with comments | « vboot_firmware/lib/vboot_firmware.c ('k') | vboot_firmware/linktest/main.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698