| OLD | NEW |
| 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 "kernel_image.h" | |
| 13 | |
| 14 extern int gTestSuccess; | 12 extern int gTestSuccess; |
| 15 | 13 |
| 16 /* Return 1 if result is equal to expected_result, else return 0. | 14 /* Return 1 if result is equal to expected_result, else return 0. |
| 17 * Also update the global gTestSuccess flag if test fails. */ | 15 * Also update the global gTestSuccess flag if test fails. */ |
| 18 int TEST_EQ(int result, int expected_result, char* testname); | 16 int TEST_EQ(int result, int expected_result, char* testname); |
| 19 /* Return 0 if result is equal to not_expected_result, else return 1. | 17 /* Return 0 if result is equal to not_expected_result, else return 1. |
| 20 * Also update the global gTestSuccess flag if test fails. */ | 18 * Also update the global gTestSuccess flag if test fails. */ |
| 21 int TEST_NEQ(int result, int not_expected_result, char* testname); | 19 int TEST_NEQ(int result, int not_expected_result, char* testname); |
| 22 | 20 |
| 23 /* Test kernel image generation functions. */ | |
| 24 KernelImage* GenerateTestKernelImage(int firmware_sign_algorithm, | |
| 25 int kernel_sign_algorithm, | |
| 26 const uint8_t* kernel_sign_key, | |
| 27 int kernel_key_version, | |
| 28 int kernel_version, | |
| 29 uint64_t kernel_len, | |
| 30 const char* firmware_key_file, | |
| 31 const char* kernel_key_file, | |
| 32 uint8_t kernel_data_fill_char); | |
| 33 uint8_t* GenerateTestKernelBlob(int firmware_sign_algorithm, | |
| 34 int kernel_sign_algorithm, | |
| 35 const uint8_t* kernel_sign_key, | |
| 36 int kernel_key_version, | |
| 37 int kernel_version, | |
| 38 uint64_t kernel_len, | |
| 39 const char* firmware_key_file, | |
| 40 const char* kernel_key_file); | |
| 41 | |
| 42 /* Generates a test kernel iamge for rollback tests with a given | |
| 43 * [kernel_key_version} and [kernel_version]. If [is_corrupt] is 1, | |
| 44 * then the image has invalid signatures and will fail verification. */ | |
| 45 uint8_t* GenerateRollbackTestKernelBlob(int kernel_key_version, | |
| 46 int kernel_version, | |
| 47 int is_corrupt); | |
| 48 #endif /* VBOOT_REFERENCE_TEST_COMMON_H_ */ | 21 #endif /* VBOOT_REFERENCE_TEST_COMMON_H_ */ |
| OLD | NEW |