Add generic wrappers for performing message digest operations.
A DigestContext structure now wraps state for all the SHA* algorithms. Replaced the old SHA*_file functions to use these new wrappers. Also moved the digest utility functions from tests/ to crypto/.
BUG=670
TEST=Modified existing tests to use the new wrappers and they pass.
Review URL: http://codereview.chromium.org/579007
diff --git a/tests/signature_digest.c b/tests/signature_digest.c
index 89d98fe..8dcd8c9 100644
--- a/tests/signature_digest.c
+++ b/tests/signature_digest.c
@@ -17,9 +17,9 @@
#include <stdlib.h>
#include <unistd.h>
-#include "digest_utility.h"
#include "padding.h"
#include "sha.h"
+#include "sha_utility.h"
uint8_t* prepend_digestinfo(int algorithm, uint8_t* digest) {
const int digest_size = hash_size_map[algorithm];
@@ -52,7 +52,7 @@
goto failure;
}
- if (!(digest = calculate_digest(argv[2], algorithm)))
+ if (!(digest = DigestFile(argv[2], algorithm)))
goto failure;
info_digest = prepend_digestinfo(algorithm, digest);