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

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

Issue 2848006: Refactor LoadFrmware() to avoid global variables, which don't work when running out of ROM (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Undo change to vboot_struct 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_firmware.h ('k') | vboot_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) 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 * High-level firmware API for loading and verifying rewritable firmware. 5 * High-level firmware API for loading and verifying rewritable firmware.
6 * (Firmware portion) 6 * (Firmware portion)
7 */ 7 */
8 8
9 #include "load_firmware_fw.h" 9 #include "load_firmware_fw.h"
10 10
11 #include "firmware_image_fw.h" 11 #include "firmware_image_fw.h"
12 #include "utility.h" 12 #include "utility.h"
13 13
14 14
15 static const char kFakeKernelBlob[] = "Fake kernel sign key blob"; 15 static const char kFakeKernelBlob[2088] = "Fake kernel sign key blob";
16
17 void UpdateFirmwareBodyHash(uint8_t* data, uint64_t size) {
18 /* TODO: actually update the hash. */
19 }
20 16
21 17
22 int LoadFirmware(LoadFirmwareParams* params) { 18 int LoadFirmware(LoadFirmwareParams* params) {
23 /* TODO: real implementation! For now, this just chains to the old 19 /* TODO: real implementation! This is now sufficiently broken due
24 * implementation. */ 20 * to refactoring that we'll just trust firmware A. */
25 21 params->kernel_sign_key_blob = (void *)kFakeKernelBlob;
26 uint8_t* fw0;
27 uint8_t* fw1;
28 uint64_t len;
29 int rv;
30
31 /* Get the firmware data */
32 fw0 = GetFirmwareBody(0, &len);
33 fw1 = GetFirmwareBody(1, &len);
34
35 /* Call the old firmware image driver */
36 rv = VerifyFirmwareDriver_f(params->firmware_root_key_blob,
37 params->verification_block_0,
38 fw0,
39 params->verification_block_1,
40 fw1);
41
42 /* Pass back a dummy key blob, since we can't extract the real
43 * kernel sign key blob yet */
44 params->kernel_sign_key_blob = (void*)kFakeKernelBlob;
45 params->kernel_sign_key_size = sizeof(kFakeKernelBlob); 22 params->kernel_sign_key_size = sizeof(kFakeKernelBlob);
46 23 params->firmware_index = 0;
47 switch(rv) { 24 return LOAD_FIRMWARE_SUCCESS;
48 case BOOT_FIRMWARE_A_CONTINUE:
49 params->firmware_index = 0;
50 return LOAD_FIRMWARE_SUCCESS;
51 case BOOT_FIRMWARE_B_CONTINUE:
52 params->firmware_index = 1;
53 return LOAD_FIRMWARE_SUCCESS;
54 }
55
56 /* If we're still here, we failed */
57 return LOAD_FIRMWARE_RECOVERY;
58
59 } 25 }
OLDNEW
« no previous file with comments | « vboot_firmware/lib/include/vboot_firmware.h ('k') | vboot_firmware/lib/vboot_common.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698