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

Side by Side Diff: tests/big_firmware_tests.c

Issue 2871033: Switch to using .vbprivk for signing everything now. (Closed) Base URL: ssh://git@chromiumos-git//vboot_reference.git
Patch Set: Okay, now tests pass again. Created 10 years, 5 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 if firmware image library deals with very large firmware. This 5 * Tests if firmware image library deals with very large firmware. This
6 * is a quick and dirty test for detecting integer overflow issues. 6 * is a quick and dirty test for detecting integer overflow issues.
7 */ 7 */
8 8
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 15 matching lines...) Expand all
26 const char* kFirmwareKeyPublicFile = FIRMWARE_KEY_BASE_NAME ".keyb"; 26 const char* kFirmwareKeyPublicFile = FIRMWARE_KEY_BASE_NAME ".keyb";
27 const char* kFirmwareKeyFile = FIRMWARE_KEY_BASE_NAME ".pem"; 27 const char* kFirmwareKeyFile = FIRMWARE_KEY_BASE_NAME ".pem";
28 28
29 int BigFirmwareTest(void) { 29 int BigFirmwareTest(void) {
30 int error_code = 0; 30 int error_code = 0;
31 uint64_t len; 31 uint64_t len;
32 uint8_t* firmware_blob = NULL; 32 uint8_t* firmware_blob = NULL;
33 RSAPublicKey* root_key = RSAPublicKeyFromFile(kRootKeyPublicFile); 33 RSAPublicKey* root_key = RSAPublicKeyFromFile(kRootKeyPublicFile);
34 uint8_t* root_key_blob = BufferFromFile(kRootKeyPublicFile, &len); 34 uint8_t* root_key_blob = BufferFromFile(kRootKeyPublicFile, &len);
35 uint8_t* firmware_sign_key_buf= BufferFromFile(kFirmwareKeyPublicFile, &len); 35 uint8_t* firmware_sign_key_buf= BufferFromFile(kFirmwareKeyPublicFile, &len);
36 debug("Generating Big FirmwareImage..."); 36 VBDEBUG(("Generating Big FirmwareImage..."));
37 FirmwareImage* image = 37 FirmwareImage* image =
38 GenerateTestFirmwareImage(0, /* RSA1024/SHA1 */ 38 GenerateTestFirmwareImage(0, /* RSA1024/SHA1 */
39 firmware_sign_key_buf, 39 firmware_sign_key_buf,
40 1, /* Firmware Key Version. */ 40 1, /* Firmware Key Version. */
41 1, /* Firmware Version */ 41 1, /* Firmware Version */
42 BIG_FIRMWARE_SIZE, 42 BIG_FIRMWARE_SIZE,
43 kRootKeyFile, 43 kRootKeyFile,
44 kFirmwareKeyFile, 44 kFirmwareKeyFile,
45 'F'); /* Firmware data fill. */ 45 'F'); /* Firmware data fill. */
46 if (!root_key || !root_key_blob || !firmware_sign_key_buf || !image) { 46 if (!root_key || !root_key_blob || !firmware_sign_key_buf || !image) {
47 error_code = 1; 47 error_code = 1;
48 goto cleanup; 48 goto cleanup;
49 } 49 }
50 debug("Done.\n"); 50 VBDEBUG(("Done.\n"));
51 TEST_EQ(VerifyFirmwareImage(root_key, image), 51 TEST_EQ(VerifyFirmwareImage(root_key, image),
52 VERIFY_FIRMWARE_SUCCESS, 52 VERIFY_FIRMWARE_SUCCESS,
53 "Big FirmwareImage Verification"); 53 "Big FirmwareImage Verification");
54 firmware_blob = GetFirmwareBlob(image, &len); 54 firmware_blob = GetFirmwareBlob(image, &len);
55 TEST_EQ(VerifyFirmware(root_key_blob, image->firmware_data, firmware_blob), 55 TEST_EQ(VerifyFirmware(root_key_blob, image->firmware_data, firmware_blob),
56 VERIFY_FIRMWARE_SUCCESS, 56 VERIFY_FIRMWARE_SUCCESS,
57 "Big Firmware Blob Verification"); 57 "Big Firmware Blob Verification");
58 58
59 cleanup: 59 cleanup:
60 Free(firmware_blob); 60 Free(firmware_blob);
61 FirmwareImageFree(image); 61 FirmwareImageFree(image);
62 Free(firmware_sign_key_buf); 62 Free(firmware_sign_key_buf);
63 RSAPublicKeyFree(root_key); 63 RSAPublicKeyFree(root_key);
64 return error_code; 64 return error_code;
65 } 65 }
66 66
67 int main(int argc, char* argv[1]) 67 int main(int argc, char* argv[1])
68 { 68 {
69 int error_code = 0; 69 int error_code = 0;
70 error_code = BigFirmwareTest(); 70 error_code = BigFirmwareTest();
71 if (!gTestSuccess) 71 if (!gTestSuccess)
72 error_code = 255; 72 error_code = 255;
73 return error_code; 73 return error_code;
74 } 74 }
OLDNEW
« no previous file with comments | « host/lib/signature_digest.c ('k') | tests/big_kernel_tests.c » ('j') | utility/vbutil_key.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698