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

Side by Side Diff: firmware/stub/load_firmware_stub.c

Issue 2809037: Make vboot_reference build in MSVC command line environment. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: Integrated trunk changes. 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 | « firmware/stub/include/biosincludes.h ('k') | firmware/stub/tlcl.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 * TEMPORARY stub for calling LoadFirmware() which looks like the old 5 * TEMPORARY stub for calling LoadFirmware() which looks like the old
6 * VerifyFirmwareDriver_f() call. 6 * VerifyFirmwareDriver_f() call.
7 * (Firmware portion) 7 * (Firmware portion)
8 */ 8 */
9 9
10 #include "load_firmware_fw.h" 10 #include "load_firmware_fw.h"
(...skipping 17 matching lines...) Expand all
28 uint64_t size; 28 uint64_t size;
29 29
30 /* In a real implementation, GetFirmwareBody() should be what reads 30 /* In a real implementation, GetFirmwareBody() should be what reads
31 * and decompresses the firmware volume. In this temporary hack, we 31 * and decompresses the firmware volume. In this temporary hack, we
32 * just pass the pointer which we got from 32 * just pass the pointer which we got from
33 * VerifyFirmwareDriver_Stub(). */ 33 * VerifyFirmwareDriver_Stub(). */
34 switch(index) { 34 switch(index) {
35 case 0: 35 case 0:
36 size = ci->firmwareA_size; 36 size = ci->firmwareA_size;
37 fw = ci->firmwareA; 37 fw = ci->firmwareA;
38 break;
39
38 case 1: 40 case 1:
39 size = ci->firmwareB_size; 41 size = ci->firmwareB_size;
40 fw = ci->firmwareB; 42 fw = ci->firmwareB;
43 break;
44
41 default: 45 default:
42 /* Anything else is invalid */ 46 /* Anything else is invalid */
43 return 1; 47 return 1;
44 } 48 }
45 49
46 /* Need to call UpdateFirmwareBodyHash() with the firmware volume 50 /* Need to call UpdateFirmwareBodyHash() with the firmware volume
47 * data. In this temporary hack, the FV is already decompressed, so 51 * data. In this temporary hack, the FV is already decompressed, so
48 * we pass in the entire volume at once. In a real implementation, 52 * we pass in the entire volume at once. In a real implementation,
49 * you should call this as the FV is being decompressed. */ 53 * you should call this as the FV is being decompressed. */
50 UpdateFirmwareBodyHash(params, fw, size); 54 UpdateFirmwareBodyHash(params, fw, size);
(...skipping 10 matching lines...) Expand all
61 * directly. */ 65 * directly. */
62 int VerifyFirmwareDriver_stub(uint8_t* root_key_blob, 66 int VerifyFirmwareDriver_stub(uint8_t* root_key_blob,
63 uint8_t* verification_headerA, 67 uint8_t* verification_headerA,
64 uint8_t* firmwareA, 68 uint8_t* firmwareA,
65 uint8_t* verification_headerB, 69 uint8_t* verification_headerB,
66 uint8_t* firmwareB) { 70 uint8_t* firmwareB) {
67 71
68 int rv; 72 int rv;
69 73
70 CallerInternal ci; 74 CallerInternal ci;
75 LoadFirmwareParams p;
71 76
72 /* Copy the firmware volume pointers to our global variables. */ 77 /* Copy the firmware volume pointers to our global variables. */
73 ci.firmwareA = firmwareA; 78 ci.firmwareA = firmwareA;
74 ci.firmwareB = firmwareB; 79 ci.firmwareB = firmwareB;
75 80
76 /* TODO: YOU NEED TO PASS IN THE FIRMWARE VOLUME SIZES SOMEHOW */ 81 /* TODO: YOU NEED TO PASS IN THE FIRMWARE VOLUME SIZES SOMEHOW */
77 ci.firmwareA_size = 0; 82 ci.firmwareA_size = 0;
78 ci.firmwareB_size = 0; 83 ci.firmwareB_size = 0;
79 84
80 /* Set up the params for LoadFirmware() */ 85 /* Set up the params for LoadFirmware() */
81 LoadFirmwareParams p;
82 p.caller_internal = &ci; 86 p.caller_internal = &ci;
83 p.firmware_root_key_blob = root_key_blob; 87 p.firmware_root_key_blob = root_key_blob;
84 p.verification_block_0 = verification_headerA; 88 p.verification_block_0 = verification_headerA;
85 p.verification_block_1 = verification_headerB; 89 p.verification_block_1 = verification_headerB;
86 90
87 /* Allocate a key blob buffer */ 91 /* Allocate a key blob buffer */
88 p.kernel_sign_key_blob = Malloc(LOAD_FIRMWARE_KEY_BLOB_REC_SIZE); 92 p.kernel_sign_key_blob = Malloc(LOAD_FIRMWARE_KEY_BLOB_REC_SIZE);
89 p.kernel_sign_key_size = LOAD_FIRMWARE_KEY_BLOB_REC_SIZE; 93 p.kernel_sign_key_size = LOAD_FIRMWARE_KEY_BLOB_REC_SIZE;
90 94
91 /* Call LoadFirmware() */ 95 /* Call LoadFirmware() */
92 rv = LoadFirmware(&p); 96 rv = LoadFirmware(&p);
93 if (LOAD_FIRMWARE_SUCCESS == rv) { 97 if (LOAD_FIRMWARE_SUCCESS == rv) {
94 /* TODO: YOU NEED TO KEEP TRACK OF p.kernel_sign_key_blob AND 98 /* TODO: YOU NEED TO KEEP TRACK OF p.kernel_sign_key_blob AND
95 * p.kernel_sign_key_size SO YOU CAN PASS THEM TO LoadKernel(). */ 99 * p.kernel_sign_key_size SO YOU CAN PASS THEM TO LoadKernel(). */
96 100
97 return (0 == p.firmware_index ? BOOT_FIRMWARE_A_CONTINUE : 101 return (0 == p.firmware_index ? BOOT_FIRMWARE_A_CONTINUE :
98 BOOT_FIRMWARE_B_CONTINUE); 102 BOOT_FIRMWARE_B_CONTINUE);
99 103
100 } else { 104 } else {
101 /* Error */ 105 /* Error */
102 return BOOT_FIRMWARE_RECOVERY_CONTINUE; 106 return BOOT_FIRMWARE_RECOVERY_CONTINUE;
103 } 107 }
104 } 108 }
OLDNEW
« no previous file with comments | « firmware/stub/include/biosincludes.h ('k') | firmware/stub/tlcl.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698