Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2016-04-27 21:59:12 +0300
committerAdam Langley <agl@google.com>2016-04-27 22:01:23 +0300
commit862c0aa8806b226286205a3ce2482840721173d6 (patch)
tree1e888fcf8fe9dc42dc3250b054fb706f45098c8a /crypto/digest
parent88e27bcbe08210666b1e05c3daa12ff9faed2564 (diff)
Revert md_len removal from SHA256_CTX and SHA512_CTX.
This reverts commits: - 91586371422dae70481c39752e55f01f50e9a93a - a90aa643024459c1698dbec84f4c79a3238b3db8 - c0d8b83b4462a0eb1889f32dbd7f46e83f4dbc81 It turns out code outside of BoringSSL also mismatches Init and Update/Final functions. Since this is largely cosmetic, it's probably not worth the cost to do this. Change-Id: I14e7b299172939f69ced2114be45ccba1dbbb704 Reviewed-on: https://boringssl-review.googlesource.com/7793 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/digest')
-rw-r--r--crypto/digest/md32_common.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/crypto/digest/md32_common.h b/crypto/digest/md32_common.h
index 77aaa449..4cf050ca 100644
--- a/crypto/digest/md32_common.h
+++ b/crypto/digest/md32_common.h
@@ -90,7 +90,7 @@ extern "C" {
* |HASH_TRANSFORM| must be defined as the the name of the "Transform"
* function to generate.
*
- * |HASH_FINISH| must be defined as the name of "finish" function to generate.
+ * |HASH_FINAL| must be defined as the name of "Final" function to generate.
*
* |HASH_BLOCK_DATA_ORDER| must be defined as the name of the "Block" function.
* That function must be implemented manually. It must be capable of operating
@@ -103,7 +103,11 @@ extern "C" {
* It must update the hash state |state| with |num| blocks of data from |data|,
* where each block is |HASH_CBLOCK| bytes; i.e. |data| points to a array of
* |HASH_CBLOCK * num| bytes. |state| points to the |h| member of a |HASH_CTX|,
- * and so will have |<chaining length> / sizeof(uint32_t)| elements. */
+ * and so will have |<chaining length> / sizeof(uint32_t)| elements.
+ *
+ * |HASH_MAKE_STRING(c, s)| must be defined as a block statement that converts
+ * the hash state |c->h| into the output byte order, storing the result in |s|.
+ */
#if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN)
#error "DATA_ORDER must be defined!"
@@ -122,14 +126,18 @@ extern "C" {
#ifndef HASH_TRANSFORM
#error "HASH_TRANSFORM must be defined!"
#endif
-#ifndef HASH_FINISH
-#error "HASH_FINISH must be defined!"
+#ifndef HASH_FINAL
+#error "HASH_FINAL must be defined!"
#endif
#ifndef HASH_BLOCK_DATA_ORDER
#error "HASH_BLOCK_DATA_ORDER must be defined!"
#endif
+#ifndef HASH_MAKE_STRING
+#error "HASH_MAKE_STRING must be defined!"
+#endif
+
#if defined(DATA_ORDER_IS_BIG_ENDIAN)
#define HOST_c2l(c, l) \
@@ -212,7 +220,7 @@ void HASH_TRANSFORM(HASH_CTX *c, const uint8_t *data) {
}
-static void HASH_FINISH(HASH_CTX *c) {
+int HASH_FINAL(uint8_t *md, HASH_CTX *c) {
/* |c->data| always has room for at least one byte. A full block would have
* been consumed. */
size_t n = c->num;
@@ -241,6 +249,9 @@ static void HASH_FINISH(HASH_CTX *c) {
HASH_BLOCK_DATA_ORDER(c->h, c->data, 1);
c->num = 0;
memset(c->data, 0, HASH_CBLOCK);
+
+ HASH_MAKE_STRING(c, md);
+ return 1;
}