Index: src/platform/vboot_reference/tests/verify_firmware_fuzz_driver.c |
diff --git a/src/platform/vboot_reference/tests/verify_firmware_fuzz_driver.c b/src/platform/vboot_reference/tests/verify_firmware_fuzz_driver.c |
index 8ab33ad685c0f9cd8cd1221880a54600241fc64d..f04a7d5da8e27bae348bea40a508a5c0c2a6c19e 100644 |
--- a/src/platform/vboot_reference/tests/verify_firmware_fuzz_driver.c |
+++ b/src/platform/vboot_reference/tests/verify_firmware_fuzz_driver.c |
@@ -11,11 +11,13 @@ |
#include "firmware_image.h" |
#include "utility.h" |
-int VerifySignedFirmware(const char* image_file, |
- const char* root_key_file) { |
+int VerifySignedFirmware(const char* root_key_file, |
+ const char* verification_file, |
+ const char* firmware_file) { |
int error, error_code = 0; |
uint64_t len; |
- uint8_t* firmware_blob = BufferFromFile(image_file, &len); |
+ uint8_t* verification_blob = BufferFromFile(verification_file, &len); |
+ uint8_t* firmware_blob = BufferFromFile(firmware_file, &len); |
uint8_t* root_key_blob = BufferFromFile(root_key_file, &len); |
if (!root_key_blob) { |
@@ -24,11 +26,18 @@ int VerifySignedFirmware(const char* image_file, |
} |
if (!error_code && !firmware_blob) { |
- fprintf(stderr, "Couldn't read firmware image or malformed image.\n"); |
+ fprintf(stderr, "Couldn't read firmware image.\n"); |
error_code = 1; |
} |
- if (!error_code && (error = VerifyFirmware(root_key_blob, firmware_blob))) { |
+ if (!error_code && !verification_blob) { |
+ fprintf(stderr, "Couldn't read verification data image.\n"); |
+ error_code = 1; |
+ } |
+ |
+ if (!error_code && (error = VerifyFirmware(root_key_blob, |
+ verification_blob, |
+ firmware_blob))) { |
fprintf(stderr, "%s\n", VerifyFirmwareErrorString(error)); |
error_code = 1; |
} |
@@ -41,15 +50,15 @@ int VerifySignedFirmware(const char* image_file, |
} |
int main(int argc, char* argv[]) { |
- if (argc != 3) { |
- fprintf(stderr, "Usage: %s <image_to_verify> <root_keyb>\n", argv[0]); |
+ if (argc != 4) { |
+ fprintf(stderr, "Usage: %s <verification blob> <image_to_verify> <root_keyb>" |
+ "\n", argv[0]); |
return -1; |
} |
- if (VerifySignedFirmware(argv[1], argv[2])) { |
+ if (VerifySignedFirmware(argv[3], argv[1], argv[2])) { |
fprintf(stderr, "Verification SUCCESS!\n"); |
return 0; |
- } |
- else { |
+ } else { |
fprintf(stderr, "Verification FAILURE!\n"); |
return -1; |
} |