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 * Splicing tests for the kernel image verification library. | 5 * Splicing tests for the kernel image verification library. |
6 */ | 6 */ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 VERIFY_KERNEL_SUCCESS, | 58 VERIFY_KERNEL_SUCCESS, |
59 "KernelImage kernel_data Original"); | 59 "KernelImage kernel_data Original"); |
60 | 60 |
61 /* Splice kernel_data + kernel signature from [image1] | 61 /* Splice kernel_data + kernel signature from [image1] |
62 * and put it into [image2]. */ | 62 * and put it into [image2]. */ |
63 Memcpy(image2->kernel_signature, image1->kernel_signature, | 63 Memcpy(image2->kernel_signature, image1->kernel_signature, |
64 siglen_map[0]); | 64 siglen_map[0]); |
65 Memcpy(image2->kernel_data, image1->kernel_data, | 65 Memcpy(image2->kernel_data, image1->kernel_data, |
66 image2->kernel_len); | 66 image2->kernel_len); |
67 | 67 |
68 TEST_EQ(VerifyKernelImage(firmware_key, image2, 0), | 68 TEST_NEQ(VerifyKernelImage(firmware_key, image2, 0), |
69 VERIFY_KERNEL_SIGNATURE_FAILED, | 69 VERIFY_KERNEL_SUCCESS, |
70 "KernelImage kernel_data Splicing"); | 70 "KernelImage kernel_data Splicing"); |
71 kernel_blob = GetKernelBlob(image2, &len); | 71 kernel_blob = GetKernelBlob(image2, &len); |
72 TEST_EQ(VerifyKernel(firmware_key_blob, kernel_blob, 0), | 72 TEST_NEQ(VerifyKernel(firmware_key_blob, kernel_blob, 0), |
73 VERIFY_KERNEL_SIGNATURE_FAILED, | 73 VERIFY_KERNEL_SUCCESS, |
74 "Kernel Blob kernel_data Splicing"); | 74 "Kernel Blob kernel_data Splicing"); |
75 } | 75 } |
76 | 76 |
77 int main(int argc, char* argv[]) | 77 int main(int argc, char* argv[]) |
78 { | 78 { |
79 int error_code = 0; | 79 int error_code = 0; |
80 VerifyKernelSplicingTest(); | 80 VerifyKernelSplicingTest(); |
81 if (!gTestSuccess) | 81 if (!gTestSuccess) |
82 error_code = 255; | 82 error_code = 255; |
83 return error_code; | 83 return error_code; |
84 } | 84 } |
OLD | NEW |