Vboot Reference: Add the "real" reference firmware verification function (VerifyFirmware).
The old VerifyFirmware function (now called VerifyFirmwareImage) works on the FirmwareImage structure. This CL adds a verification function which can be used directly on packed binary verified boot firmware blobs. This function can be used as the reference implementation for verified boot in firmware. In addition, all functions that work on FirmwareImage structure have been renames to distinguish them from those which work on binary firmware blobs.
In addition, this adds some new crypto utility functions and refactors old ones.
BUG=670
TEST=Added tests for the new function and they pass.
Review URL: http://codereview.chromium.org/650105
diff --git a/utils/signature_digest.c b/utils/signature_digest.c
index 8dcd8c9..100f7ec 100644
--- a/utils/signature_digest.c
+++ b/utils/signature_digest.c
@@ -21,7 +21,7 @@
#include "sha.h"
#include "sha_utility.h"
-uint8_t* prepend_digestinfo(int algorithm, uint8_t* digest) {
+uint8_t* PrependDigestInfo(int algorithm, uint8_t* digest) {
const int digest_size = hash_size_map[algorithm];
const int digestinfo_size = digestinfo_size_map[algorithm];
const uint8_t* digestinfo = hash_digestinfo_map[algorithm];
@@ -55,7 +55,7 @@
if (!(digest = DigestFile(argv[2], algorithm)))
goto failure;
- info_digest = prepend_digestinfo(algorithm, digest);
+ info_digest = PrependDigestInfo(algorithm, digest);
write(1, info_digest, hash_size_map[algorithm] +
digestinfo_size_map[algorithm]);