Pull HASH_TRANSFORM out of md32_common.h. The macro isn't doing any work here. Change-Id: Id97dfa4b027407c5e4b3e7eb1586c3c2a2d977d8 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/47806 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/digest/md32_common.h b/crypto/fipsmodule/digest/md32_common.h index a0634d1..8a14108 100644 --- a/crypto/fipsmodule/digest/md32_common.h +++ b/crypto/fipsmodule/digest/md32_common.h
@@ -86,9 +86,6 @@ // |HASH_UPDATE| must be defined as the name of the "Update" function to // generate. // -// |HASH_TRANSFORM| must be defined as the the name of the "Transform" -// 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. @@ -121,9 +118,6 @@ #ifndef HASH_UPDATE #error "HASH_UPDATE must be defined!" #endif -#ifndef HASH_TRANSFORM -#error "HASH_TRANSFORM must be defined!" -#endif #ifndef HASH_FINAL #error "HASH_FINAL must be defined!" #endif @@ -185,11 +179,6 @@ } -void HASH_TRANSFORM(HASH_CTX *c, const uint8_t data[HASH_CBLOCK]) { - HASH_BLOCK_DATA_ORDER(c->h, data, 1); -} - - int HASH_FINAL(uint8_t out[HASH_DIGEST_LENGTH], HASH_CTX *c) { // |c->data| always has room for at least one byte. A full block would have // been consumed.
diff --git a/crypto/fipsmodule/md4/md4.c b/crypto/fipsmodule/md4/md4.c index 0551664..9d229bf 100644 --- a/crypto/fipsmodule/md4/md4.c +++ b/crypto/fipsmodule/md4/md4.c
@@ -84,13 +84,16 @@ void md4_block_data_order(uint32_t *state, const uint8_t *data, size_t num); +void MD4_Transform(MD4_CTX *c, const uint8_t data[MD4_CBLOCK]) { + md4_block_data_order(c->h, data, 1); +} + #define DATA_ORDER_IS_LITTLE_ENDIAN #define HASH_CTX MD4_CTX #define HASH_CBLOCK 64 #define HASH_DIGEST_LENGTH 16 #define HASH_UPDATE MD4_Update -#define HASH_TRANSFORM MD4_Transform #define HASH_FINAL MD4_Final #define HASH_MAKE_STRING(c, s) \ do { \ @@ -240,7 +243,6 @@ #undef HASH_CBLOCK #undef HASH_DIGEST_LENGTH #undef HASH_UPDATE -#undef HASH_TRANSFORM #undef HASH_FINAL #undef HASH_MAKE_STRING #undef HASH_BLOCK_DATA_ORDER
diff --git a/crypto/fipsmodule/md5/md5.c b/crypto/fipsmodule/md5/md5.c index bd6bf6a..e454a84 100644 --- a/crypto/fipsmodule/md5/md5.c +++ b/crypto/fipsmodule/md5/md5.c
@@ -89,6 +89,9 @@ size_t num); #endif +void MD5_Transform(MD5_CTX *c, const uint8_t data[MD5_CBLOCK]) { + md5_block_data_order(c->h, data, 1); +} #define DATA_ORDER_IS_LITTLE_ENDIAN @@ -96,7 +99,6 @@ #define HASH_CBLOCK 64 #define HASH_DIGEST_LENGTH 16 #define HASH_UPDATE MD5_Update -#define HASH_TRANSFORM MD5_Transform #define HASH_FINAL MD5_Final #define HASH_MAKE_STRING(c, s) \ do { \ @@ -283,7 +285,6 @@ #undef HASH_CBLOCK #undef HASH_DIGEST_LENGTH #undef HASH_UPDATE -#undef HASH_TRANSFORM #undef HASH_FINAL #undef HASH_MAKE_STRING #undef HASH_BLOCK_DATA_ORDER
diff --git a/crypto/fipsmodule/sha/sha1.c b/crypto/fipsmodule/sha/sha1.c index 2f50c67..7149d11 100644 --- a/crypto/fipsmodule/sha/sha1.c +++ b/crypto/fipsmodule/sha/sha1.c
@@ -83,6 +83,15 @@ return out; } +#if !defined(SHA1_ASM) +static void sha1_block_data_order(uint32_t *state, const uint8_t *data, + size_t num); +#endif + +void SHA1_Transform(SHA_CTX *c, const uint8_t data[SHA_CBLOCK]) { + sha1_block_data_order(c->h, data, 1); +} + #define DATA_ORDER_IS_BIG_ENDIAN #define HASH_CTX SHA_CTX @@ -103,7 +112,6 @@ } while (0) #define HASH_UPDATE SHA1_Update -#define HASH_TRANSFORM SHA1_Transform #define HASH_FINAL SHA1_Final #define HASH_BLOCK_DATA_ORDER sha1_block_data_order #define ROTATE(a, n) (((a) << (n)) | ((a) >> (32 - (n)))) @@ -113,11 +121,6 @@ (ix) = (a) = ROTATE((a), 1); \ } while (0) -#if !defined(SHA1_ASM) -static void sha1_block_data_order(uint32_t *state, const uint8_t *data, - size_t num); -#endif - #include "../digest/md32_common.h" #define K_00_19 0x5a827999UL @@ -346,7 +349,6 @@ #undef HASH_DIGEST_LENGTH #undef HASH_MAKE_STRING #undef HASH_UPDATE -#undef HASH_TRANSFORM #undef HASH_FINAL #undef HASH_BLOCK_DATA_ORDER #undef ROTATE
diff --git a/crypto/fipsmodule/sha/sha256.c b/crypto/fipsmodule/sha/sha256.c index 390ee3a..ff961c8 100644 --- a/crypto/fipsmodule/sha/sha256.c +++ b/crypto/fipsmodule/sha/sha256.c
@@ -122,6 +122,15 @@ return SHA256_Final(out, ctx); } +#ifndef SHA256_ASM +static void sha256_block_data_order(uint32_t *state, const uint8_t *in, + size_t num); +#endif + +void SHA256_Transform(SHA256_CTX *c, const uint8_t data[SHA256_CBLOCK]) { + sha256_block_data_order(c->h, data, 1); +} + #define DATA_ORDER_IS_BIG_ENDIAN #define HASH_CTX SHA256_CTX @@ -167,13 +176,8 @@ #define HASH_UPDATE SHA256_Update -#define HASH_TRANSFORM SHA256_Transform #define HASH_FINAL SHA256_Final #define HASH_BLOCK_DATA_ORDER sha256_block_data_order -#ifndef SHA256_ASM -static void sha256_block_data_order(uint32_t *state, const uint8_t *in, - size_t num); -#endif #include "../digest/md32_common.h" @@ -324,7 +328,6 @@ #undef HASH_DIGEST_LENGTH #undef HASH_MAKE_STRING #undef HASH_UPDATE -#undef HASH_TRANSFORM #undef HASH_FINAL #undef HASH_BLOCK_DATA_ORDER #undef ROTATE
diff --git a/decrepit/ripemd/ripemd.c b/decrepit/ripemd/ripemd.c index 50329c7..ac6bd83 100644 --- a/decrepit/ripemd/ripemd.c +++ b/decrepit/ripemd/ripemd.c
@@ -80,6 +80,11 @@ static void ripemd160_block_data_order(uint32_t h[5], const uint8_t *data, size_t num); +void RIPEMD160_Transform(RIPEMD160_CTX *c, + const uint8_t data[RIPEMD160_CBLOCK]) { + ripemd160_block_data_order(c->h, data, 1); +} + #define DATA_ORDER_IS_LITTLE_ENDIAN #define HASH_LONG uint32_t @@ -87,7 +92,6 @@ #define HASH_CBLOCK RIPEMD160_CBLOCK #define HASH_DIGEST_LENGTH RIPEMD160_DIGEST_LENGTH #define HASH_UPDATE RIPEMD160_Update -#define HASH_TRANSFORM RIPEMD160_Transform #define HASH_FINAL RIPEMD160_Final #define HASH_MAKE_STRING(c, s) \ do { \