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

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

Issue 1519008: VBoot Reference: 18 Exabytes ought to be enough for everybody (Closed)
Patch Set: Use symbolic constants. Created 10 years, 8 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
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 "file_keys.h" 11 #include "file_keys.h"
12 #include "kernel_image.h" 12 #include "kernel_image.h"
13 #include "rsa_utility.h" 13 #include "rsa_utility.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";
19
18 /* Tests that check for correctness of the VerifyFirmwareDriver_f() logic 20 /* Tests that check for correctness of the VerifyFirmwareDriver_f() logic
19 * and rollback prevention. */ 21 * and rollback prevention. */
20 void VerifyKernelDriverTest(void) { 22 void VerifyKernelDriverTest(void) {
21 uint64_t len; 23 uint64_t len;
22 uint8_t* firmware_key_pub = BufferFromFile("testkeys/key_rsa1024.keyb", 24 uint8_t* firmware_key_pub = BufferFromFile(kFirmwareKeyPublicFile, &len);
23 &len); 25
24 /* Initialize kernel blobs, including their associated parition 26 /* Initialize kernel blobs, including their associated parition
25 * table attributed. */ 27 * table attributed. */
26 kernel_entry valid_kernelA = { 28 kernel_entry valid_kernelA = {
27 GenerateRollbackTestKernelBlob(1, 1, 0), 29 GenerateRollbackTestKernelBlob(1, 1, 0),
28 15, /* Highest Priority. */ 30 15, /* Highest Priority. */
29 5, /* Enough for tests. */ 31 5, /* Enough for tests. */
30 0 /* Assume we haven't boot off it yet. */ 32 0 /* Assume we haven't boot off it yet. */
31 }; 33 };
32 kernel_entry corrupt_kernelA = { 34 kernel_entry corrupt_kernelA = {
33 GenerateRollbackTestKernelBlob(1, 1, 1), 35 GenerateRollbackTestKernelBlob(1, 1, 1),
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 Free(corrupt_kernelB.kernel_blob); 142 Free(corrupt_kernelB.kernel_blob);
141 } 143 }
142 144
143 int main(int argc, char* argv[]) { 145 int main(int argc, char* argv[]) {
144 int error_code = 0; 146 int error_code = 0;
145 VerifyKernelDriverTest(); 147 VerifyKernelDriverTest();
146 if (!gTestSuccess) 148 if (!gTestSuccess)
147 error_code = 255; 149 error_code = 255;
148 return error_code; 150 return error_code;
149 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698