summaryrefslogtreecommitdiff
path: root/tests/test_common.c
diff options
context:
space:
mode:
authorGaurav Shah <gauravsh@chromium.org>2010-04-18 16:35:07 -0700
committerGaurav Shah <gauravsh@chromium.org>2010-04-18 16:35:07 -0700
commit0265882a34030b5a49c0c573b28a10b2ac0c9d87 (patch)
tree4da003b7c1c34935dc25753bb84a303cdad0deec /tests/test_common.c
parent65127cc38acc379dfc55fca2b345465437518276 (diff)
downloadvboot-0265882a34030b5a49c0c573b28a10b2ac0c9d87.tar.gz
Change VerifyFirmware() to take separate pointers to firmware verification header and firmware data.
The firmware verification code no longer assumes that verification data and firmware data are contiguous and follow each other. Needed for EFI where the actual firmware must be stored in its own firmware volume. BUG=1704 TEST=modified existing tests for the new API, and they still pass Review URL: http://codereview.chromium.org/1578035
Diffstat (limited to 'tests/test_common.c')
-rw-r--r--tests/test_common.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/tests/test_common.c b/tests/test_common.c
index 5fcdc5e7..6f68d352 100644
--- a/tests/test_common.c
+++ b/tests/test_common.c
@@ -80,13 +80,13 @@ FirmwareImage* GenerateTestFirmwareImage(int algorithm,
return image;
}
-uint8_t* GenerateTestFirmwareBlob(int algorithm,
- const uint8_t* firmware_sign_key,
- int firmware_key_version,
- int firmware_version,
- uint64_t firmware_len,
- const char* root_key_file,
- const char* firmware_key_file) {
+uint8_t* GenerateTestVerificationBlob(int algorithm,
+ const uint8_t* firmware_sign_key,
+ int firmware_key_version,
+ int firmware_version,
+ uint64_t firmware_len,
+ const char* root_key_file,
+ const char* firmware_key_file) {
FirmwareImage* image = NULL;
uint8_t* firmware_blob = NULL;
uint64_t firmware_blob_len = 0;
@@ -104,12 +104,11 @@ uint8_t* GenerateTestFirmwareBlob(int algorithm,
return firmware_blob;
}
-uint8_t* GenerateRollbackTestFirmwareBlob(int firmware_key_version,
- int firmware_version,
- int is_corrupt) {
+uint8_t* GenerateRollbackTestVerificationBlob(int firmware_key_version,
+ int firmware_version) {
FirmwareImage* image = NULL;
uint64_t len;
- uint8_t* firmware_blob = NULL;
+ uint8_t* verification_blob = NULL;
uint8_t* firmware_sign_key = NULL;
firmware_sign_key = BufferFromFile("testkeys/key_rsa1024.keyb",
@@ -126,14 +125,9 @@ uint8_t* GenerateRollbackTestFirmwareBlob(int firmware_key_version,
'F');
if (!image)
return NULL;
- if (is_corrupt) {
- /* Invalidate image. */
- Memset(image->firmware_data, 'X', image->firmware_len);
- }
-
- firmware_blob = GetFirmwareBlob(image, &len);
+ verification_blob = GetFirmwareBlob(image, &len);
FirmwareImageFree(image);
- return firmware_blob;
+ return verification_blob;
}