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

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

Issue 1430001: VBoot Reference: Fix splicing bugs in Firmware and Kernel verification. (Closed)
Patch Set: . Created 10 years, 9 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 firmware image library. 5 * Tests for firmware image library.
6 */ 6 */
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 root_key_blob = BufferFromFile(argv[3], &len); 75 root_key_blob = BufferFromFile(argv[3], &len);
76 firmware_sign_key_buf = BufferFromFile(argv[5], &len); 76 firmware_sign_key_buf = BufferFromFile(argv[5], &len);
77 root_key_file = argv[2]; 77 root_key_file = argv[2];
78 firmware_key_file = argv[4]; 78 firmware_key_file = argv[4];
79 image = GenerateTestFirmwareImage(algorithm, 79 image = GenerateTestFirmwareImage(algorithm,
80 firmware_sign_key_buf, 80 firmware_sign_key_buf,
81 1, /* Firmware Key Version. */ 81 1, /* Firmware Key Version. */
82 1, /* Firmware Version. */ 82 1, /* Firmware Version. */
83 1000, /* Firmware length. */ 83 1000, /* Firmware length. */
84 root_key_file, 84 root_key_file,
85 firmware_key_file); 85 firmware_key_file,
86 'F');
86 87
87 if (!root_key_pub || !firmware_sign_key_buf || !image) { 88 if (!root_key_pub || !firmware_sign_key_buf || !image) {
88 error_code = 1; 89 error_code = 1;
89 goto failure; 90 goto failure;
90 } 91 }
91 firmware_blob = GetFirmwareBlob(image, &firmware_blob_len); 92 firmware_blob = GetFirmwareBlob(image, &firmware_blob_len);
92 93
93 /* Test Firmware blob verify operations. */ 94 /* Test Firmware blob verify operations. */
94 VerifyFirmwareTest(firmware_blob, root_key_blob); 95 VerifyFirmwareTest(firmware_blob, root_key_blob);
95 96
96 /* Test FirmwareImage verify operations. */ 97 /* Test FirmwareImage verify operations. */
97 VerifyFirmwareImageTest(image, root_key_pub); 98 VerifyFirmwareImageTest(image, root_key_pub);
98 VerifyFirmwareImageTamperTest(image, root_key_pub); 99 VerifyFirmwareImageTamperTest(image, root_key_pub);
99 100
100 if (!gTestSuccess) 101 if (!gTestSuccess)
101 error_code = 255; 102 error_code = 255;
102 103
103 failure: 104 failure:
104 Free(firmware_blob); 105 Free(firmware_blob);
105 FirmwareImageFree(image); 106 FirmwareImageFree(image);
106 Free(firmware_sign_key_buf); 107 Free(firmware_sign_key_buf);
107 Free(root_key_blob); 108 Free(root_key_blob);
108 RSAPublicKeyFree(root_key_pub); 109 RSAPublicKeyFree(root_key_pub);
109 110
110 return error_code; 111 return error_code;
111 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698