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

Side by Side Diff: src/platform/vboot_reference/tests/kernel_rollback_tests.c

Issue 2584001: Remove obsolete VerifyKernelDriver() and associated data structures. (Closed) Base URL: ssh://git@gitrw.chromium.org/chromiumos
Patch Set: 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 | « no previous file | src/platform/vboot_reference/vboot_firmware/include/kernel_image_fw.h » ('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 * Tests for checking kernel rollback-prevention logic. 5 * Tests for checking kernel rollback-prevention logic.
6 */ 6 */
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
11 #include "cryptolib.h" 11 #include "cryptolib.h"
12 #include "file_keys.h" 12 #include "file_keys.h"
13 #include "kernel_image.h" 13 #include "kernel_image.h"
14 #include "rollback_index.h" 14 #include "rollback_index.h"
15 #include "test_common.h" 15 #include "test_common.h"
16 #include "utility.h" 16 #include "utility.h"
17 17
18 const char* kFirmwareKeyPublicFile = "testkeys/key_rsa1024.keyb"; 18 const char* kFirmwareKeyPublicFile = "testkeys/key_rsa1024.keyb";
19 19
20 /* Tests that check for correctness of the VerifyFirmwareDriver_f() logic 20 /* Tests that check for correctness of the VerifyFirmwareDriver_f() logic
21 * and rollback prevention. */ 21 * and rollback prevention. */
22 void VerifyKernelDriverTest(void) { 22 void VerifyKernelDriverTest(void) {
23 uint64_t len; 23 uint64_t len;
24 uint8_t* firmware_key_pub = BufferFromFile(kFirmwareKeyPublicFile, &len); 24 uint8_t* firmware_key_pub = BufferFromFile(kFirmwareKeyPublicFile, &len);
25 25
26 /* TODO(gauravsh): Rebase this to use LoadKernel() (maybe by making
27 * it a part of load_kernel_test.c */
28 #if 0
26 /* Initialize kernel blobs, including their associated parition 29 /* Initialize kernel blobs, including their associated parition
27 * table attributed. */ 30 * table attributed. */
28 kernel_entry valid_kernelA = { 31 kernel_entry valid_kernelA = {
29 GenerateRollbackTestKernelBlob(1, 1, 0), 32 GenerateRollbackTestKernelBlob(1, 1, 0),
30 15, /* Highest Priority. */ 33 15, /* Highest Priority. */
31 5, /* Enough for tests. */ 34 5, /* Enough for tests. */
32 0 /* Assume we haven't boot off it yet. */ 35 0 /* Assume we haven't boot off it yet. */
33 }; 36 };
34 kernel_entry corrupt_kernelA = { 37 kernel_entry corrupt_kernelA = {
35 GenerateRollbackTestKernelBlob(1, 1, 1), 38 GenerateRollbackTestKernelBlob(1, 1, 1),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 debug("\nGenerating updated Kernel A blob with " 130 debug("\nGenerating updated Kernel A blob with "
128 "new version.\n"); 131 "new version.\n");
129 Free(valid_kernelA.kernel_blob); 132 Free(valid_kernelA.kernel_blob);
130 valid_kernelA.kernel_blob = GenerateRollbackTestKernelBlob(3, 3, 0); 133 valid_kernelA.kernel_blob = GenerateRollbackTestKernelBlob(3, 3, 0);
131 TEST_EQ(VerifyKernelDriver_f(firmware_key_pub, 134 TEST_EQ(VerifyKernelDriver_f(firmware_key_pub,
132 &valid_kernelA, &valid_kernelB, 135 &valid_kernelA, &valid_kernelB,
133 DEV_MODE_DISABLED), 136 DEV_MODE_DISABLED),
134 BOOT_KERNEL_A_CONTINUE, 137 BOOT_KERNEL_A_CONTINUE,
135 "(Valid Kernel A (new version)\n" 138 "(Valid Kernel A (new version)\n"
136 " Valid Kernel B (old version) runs A):"); 139 " Valid Kernel B (old version) runs A):");
137
138 Free(firmware_key_pub);
139 Free(valid_kernelA.kernel_blob); 140 Free(valid_kernelA.kernel_blob);
140 Free(valid_kernelB.kernel_blob); 141 Free(valid_kernelB.kernel_blob);
141 Free(corrupt_kernelA.kernel_blob); 142 Free(corrupt_kernelA.kernel_blob);
142 Free(corrupt_kernelB.kernel_blob); 143 Free(corrupt_kernelB.kernel_blob);
144 #endif
145
146 Free(firmware_key_pub);
143 } 147 }
144 148
145 int main(int argc, char* argv[]) { 149 int main(int argc, char* argv[]) {
146 int error_code = 0; 150 int error_code = 0;
147 VerifyKernelDriverTest(); 151 VerifyKernelDriverTest();
148 if (!gTestSuccess) 152 if (!gTestSuccess)
149 error_code = 255; 153 error_code = 255;
150 return error_code; 154 return error_code;
151 } 155 }
OLDNEW
« no previous file with comments | « no previous file | src/platform/vboot_reference/vboot_firmware/include/kernel_image_fw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698