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

Side by Side Diff: src/platform/vboot_reference/tests/test_common.h

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 */ 5 */
6 6
7 #ifndef VBOOT_REFERENCE_TEST_COMMON_H_ 7 #ifndef VBOOT_REFERENCE_TEST_COMMON_H_
8 #define VBOOT_REFERENCE_TEST_COMMON_H_ 8 #define VBOOT_REFERENCE_TEST_COMMON_H_
9 9
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include "firmware_image.h" 12 #include "firmware_image.h"
13 #include "kernel_image.h" 13 #include "kernel_image.h"
14 14
15 extern int gTestSuccess; 15 extern int gTestSuccess;
16 /* Return 1 if result is equal to expected_result, else return 0. 16 /* Return 1 if result is equal to expected_result, else return 0.
17 * Also update the global gTestSuccess flag if test fails. */ 17 * Also update the global gTestSuccess flag if test fails. */
18 int TEST_EQ(int result, int expected_result, char* testname); 18 int TEST_EQ(int result, int expected_result, char* testname);
19 19
20 /* Test firmware image generation functions. */ 20 /* Test firmware image generation functions. */
21 FirmwareImage* GenerateTestFirmwareImage(int algorithm, 21 FirmwareImage* GenerateTestFirmwareImage(int algorithm,
22 const uint8_t* firmware_sign_key, 22 const uint8_t* firmware_sign_key,
23 int firmware_key_version, 23 int firmware_key_version,
24 int firmware_version, 24 int firmware_version,
25 int firmware_len, 25 uint64_t firmware_len,
26 const char* root_key_file, 26 const char* root_key_file,
27 const char* firmware_key_file, 27 const char* firmware_key_file,
28 uint8_t firmware_data_fill_char); 28 uint8_t firmware_data_fill_char);
29 uint8_t* GenerateTestFirmwareBlob(int algorithm, 29 uint8_t* GenerateTestFirmwareBlob(int algorithm,
30 const uint8_t* firmware_sign_key, 30 const uint8_t* firmware_sign_key,
31 int firmware_key_version, 31 int firmware_key_version,
32 int firmware_version, 32 int firmware_version,
33 int firmware_len, 33 uint64_t firmware_len,
34 const char* root_key_file, 34 const char* root_key_file,
35 const char* firmware_key_file); 35 const char* firmware_key_file);
36 36
37 /* Test kernel image generation functions. */ 37 /* Test kernel image generation functions. */
38 KernelImage* GenerateTestKernelImage(int firmware_sign_algorithm, 38 KernelImage* GenerateTestKernelImage(int firmware_sign_algorithm,
39 int kernel_sign_algorithm, 39 int kernel_sign_algorithm,
40 const uint8_t* kernel_sign_key, 40 const uint8_t* kernel_sign_key,
41 int kernel_key_version, 41 int kernel_key_version,
42 int kernel_version, 42 int kernel_version,
43 int kernel_len, 43 uint64_t kernel_len,
44 const char* firmware_key_file, 44 const char* firmware_key_file,
45 const char* kernel_key_file, 45 const char* kernel_key_file,
46 uint8_t kernel_data_fill_char); 46 uint8_t kernel_data_fill_char);
47 ; 47 ;
48 uint8_t* GenerateTestKernelBlob(int firmware_sign_algorithm, 48 uint8_t* GenerateTestKernelBlob(int firmware_sign_algorithm,
49 int kernel_sign_algorithm, 49 int kernel_sign_algorithm,
50 const uint8_t* kernel_sign_key, 50 const uint8_t* kernel_sign_key,
51 int kernel_key_version, 51 int kernel_key_version,
52 int kernel_version, 52 int kernel_version,
53 int kernel_len, 53 uint64_t kernel_len,
54 const char* firmware_key_file, 54 const char* firmware_key_file,
55 const char* kernel_key_file); 55 const char* kernel_key_file);
56 56
57 /* Generates a test firmware image for rollback tests with a given 57 /* Generates a test firmware image for rollback tests with a given
58 * [firmware_key_version] and [firmware_version]. If [is_corrupt] is 1, 58 * [firmware_key_version] and [firmware_version]. If [is_corrupt] is 1,
59 * then the image has invalid signatures and will fail verification. */ 59 * then the image has invalid signatures and will fail verification. */
60 uint8_t* GenerateRollbackTestFirmwareBlob(int firmware_key_version, 60 uint8_t* GenerateRollbackTestFirmwareBlob(int firmware_key_version,
61 int firmware_version, 61 int firmware_version,
62 int is_corrupt); 62 int is_corrupt);
63 63
64 /* Generates a test kernel iamge for rollback tests with a given 64 /* Generates a test kernel iamge for rollback tests with a given
65 * [kernel_key_version} and [kernel_version]. If [is_corrupt] is 1, 65 * [kernel_key_version} and [kernel_version]. If [is_corrupt] is 1,
66 * then the image has invalid signatures and will fail verification. */ 66 * then the image has invalid signatures and will fail verification. */
67 uint8_t* GenerateRollbackTestKernelBlob(int kernel_key_version, 67 uint8_t* GenerateRollbackTestKernelBlob(int kernel_key_version,
68 int kernel_version, 68 int kernel_version,
69 int is_corrupt); 69 int is_corrupt);
70 #endif /* VBOOT_REFERENCE_TEST_COMMON_H_ */ 70 #endif /* VBOOT_REFERENCE_TEST_COMMON_H_ */
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/tests/kernel_splicing_tests.c ('k') | src/platform/vboot_reference/tests/test_common.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698