| 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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 debug("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, 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 } |
| OLD | NEW |