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 * Tests for kernel image library. | 5 * Tests for kernel image library. |
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 "test_common.h" | 14 #include "test_common.h" |
15 #include "utility.h" | 15 #include "utility.h" |
16 | 16 |
17 #define DEV_MODE_ENABLED 1 | |
18 #define DEV_MODE_DISABLED 0 | |
19 | |
20 /* Normal Kernel Blob Verification Tests. */ | 17 /* Normal Kernel Blob Verification Tests. */ |
21 void VerifyKernelTest(uint8_t* kernel_blob, uint8_t* firmware_key_blob) { | 18 void VerifyKernelTest(uint8_t* kernel_blob, uint8_t* firmware_key_blob) { |
22 TEST_EQ(VerifyKernel(firmware_key_blob, kernel_blob, DEV_MODE_ENABLED), | 19 TEST_EQ(VerifyKernel(firmware_key_blob, kernel_blob, DEV_MODE_ENABLED), |
23 VERIFY_KERNEL_SUCCESS, | 20 VERIFY_KERNEL_SUCCESS, |
24 "Normal Kernel Blob Verification (Dev Mode)"); | 21 "Normal Kernel Blob Verification (Dev Mode)"); |
25 | 22 |
26 TEST_EQ(VerifyKernel(firmware_key_blob, kernel_blob, DEV_MODE_DISABLED), | 23 TEST_EQ(VerifyKernel(firmware_key_blob, kernel_blob, DEV_MODE_DISABLED), |
27 VERIFY_KERNEL_SUCCESS, | 24 VERIFY_KERNEL_SUCCESS, |
28 "Normal Kernel Blob Verification (Trusted)"); | 25 "Normal Kernel Blob Verification (Trusted)"); |
29 } | 26 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 130 |
134 failure: | 131 failure: |
135 Free(kernel_blob); | 132 Free(kernel_blob); |
136 KernelImageFree(image); | 133 KernelImageFree(image); |
137 Free(kernel_sign_key_buf); | 134 Free(kernel_sign_key_buf); |
138 Free(firmware_key_blob); | 135 Free(firmware_key_blob); |
139 RSAPublicKeyFree(firmware_key); | 136 RSAPublicKeyFree(firmware_key); |
140 | 137 |
141 return error_code; | 138 return error_code; |
142 } | 139 } |
OLD | NEW |