Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1078)

Unified Diff: src/platform/vboot_reference/include/sha.h

Issue 558025: Refactor SHA*_file functions into a separate file. Generate them using a C macro. (Closed)
Patch Set: Switched back from a macro to duplicate code. Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/platform/vboot_reference/tests/Makefile » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/include/sha.h
diff --git a/src/platform/vboot_reference/include/sha.h b/src/platform/vboot_reference/include/sha.h
index b15cfd1d09d3672b498926c8bd3aead8ba05c43c..d9466c8348c3ee290e8ee59b354f04669dc36edc 100644
--- a/src/platform/vboot_reference/include/sha.h
+++ b/src/platform/vboot_reference/include/sha.h
@@ -53,20 +53,31 @@ typedef struct {
void SHA1_init(SHA1_CTX* ctx);
void SHA1_update(SHA1_CTX* ctx, const uint8_t* data, int len);
uint8_t* SHA1_final(SHA1_CTX* ctx);
-/* Convenience function for SHA-1. Computes hash on [data] of length [len].
- * and stores it into [digest]. [digest] should be pre-allocated to
- * SHA1_DIGEST_SIZE bytes.
- */
-uint8_t* SHA1(const void* data, int len, uint8_t* digest);
void SHA256_init(SHA256_CTX* ctx);
void SHA256_update(SHA256_CTX* ctx, const uint8_t* data, int len);
uint8_t* SHA256_final(SHA256_CTX* ctx);
-uint8_t* SHA256(const uint8_t* data, int len, uint8_t* digest);
void SHA512_init(SHA512_CTX* ctx);
void SHA512_update(SHA512_CTX* ctx, const uint8_t* data, int len);
uint8_t* SHA512_final(SHA512_CTX* ctx);
+
+/* Convenience function for SHA-1. Computes hash on [data] of length [len].
+ * and stores it into [digest]. [digest] should be pre-allocated to
+ * SHA1_DIGEST_SIZE bytes.
+ */
+uint8_t* SHA1(const void* data, int len, uint8_t* digest);
+
+/* Convenience function for SHA-256. Computes hash on [data] of length [len].
+ * and stores it into [digest]. [digest] should be pre-allocated to
+ * SHA256_DIGEST_SIZE bytes.
+ */
+uint8_t* SHA256(const uint8_t* data, int len, uint8_t* digest);
+
+/* Convenience function for SHA-512. Computes hash on [data] of length [len].
+ * and stores it into [digest]. [digest] should be pre-allocated to
+ * SHA512_DIGEST_SIZE bytes.
+ */
uint8_t* SHA512(const uint8_t* data, int len, uint8_t* digest);
« no previous file with comments | « no previous file | src/platform/vboot_reference/tests/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698