diff options
author | David Benjamin <davidben@google.com> | 2016-04-19 23:51:11 -0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2016-04-27 18:45:12 +0000 |
commit | a90aa643024459c1698dbec84f4c79a3238b3db8 (patch) | |
tree | 792c14ec005b323bdaebef87b8a03b814827a5b9 /decrepit/ripemd | |
parent | e3118b8dc4c05abc8ed822a181e81a2a070ebe61 (diff) | |
download | boringssl-a90aa643024459c1698dbec84f4c79a3238b3db8.zip boringssl-a90aa643024459c1698dbec84f4c79a3238b3db8.tar.gz boringssl-a90aa643024459c1698dbec84f4c79a3238b3db8.tar.bz2 |
Pull HASH_MAKE_STRING out of md32_common.h.
This is in preparation for taking md_len out of SHA256_CTX by allowing us to do
something similar to SHA512_CTX. md32_common.h now emits a static "finish"
function which Final composes with the extraction step.
Change-Id: I314fb31e2482af642fd280500cc0e4716aef1ac6
Reviewed-on: https://boringssl-review.googlesource.com/7721
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'decrepit/ripemd')
-rw-r--r-- | decrepit/ripemd/internal.h | 16 | ||||
-rw-r--r-- | decrepit/ripemd/ripemd.c | 18 |
2 files changed, 19 insertions, 15 deletions
diff --git a/decrepit/ripemd/internal.h b/decrepit/ripemd/internal.h index c4db4b2..dea532b 100644 --- a/decrepit/ripemd/internal.h +++ b/decrepit/ripemd/internal.h @@ -74,21 +74,7 @@ static void ripemd160_block_data_order(uint32_t h[5], const uint8_t *data, #define HASH_CBLOCK RIPEMD160_CBLOCK #define HASH_UPDATE RIPEMD160_Update #define HASH_TRANSFORM RIPEMD160_Transform -#define HASH_FINAL RIPEMD160_Final -#define HASH_MAKE_STRING(c, s) \ - do { \ - unsigned long ll; \ - ll = (c)->h[0]; \ - (void)HOST_l2c(ll, (s)); \ - ll = (c)->h[1]; \ - (void)HOST_l2c(ll, (s)); \ - ll = (c)->h[2]; \ - (void)HOST_l2c(ll, (s)); \ - ll = (c)->h[3]; \ - (void)HOST_l2c(ll, (s)); \ - ll = (c)->h[4]; \ - (void)HOST_l2c(ll, (s)); \ - } while (0) +#define HASH_FINISH ripemd160_finish #define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order #include "../../crypto/digest/md32_common.h" diff --git a/decrepit/ripemd/ripemd.c b/decrepit/ripemd/ripemd.c index 6ed7816..c871ea7 100644 --- a/decrepit/ripemd/ripemd.c +++ b/decrepit/ripemd/ripemd.c @@ -71,6 +71,24 @@ int RIPEMD160_Init(RIPEMD160_CTX *ctx) { return 1; } +int RIPEMD160_Final(uint8_t *md, RIPEMD160_CTX *ctx) { + ripemd160_finish(ctx); + + unsigned long ll; + ll = ctx->h[0]; + (void)HOST_l2c(ll, md); + ll = ctx->h[1]; + (void)HOST_l2c(ll, md); + ll = ctx->h[2]; + (void)HOST_l2c(ll, md); + ll = ctx->h[3]; + (void)HOST_l2c(ll, md); + ll = ctx->h[4]; + (void)HOST_l2c(ll, md); + + return 1; +} + static void ripemd160_block_data_order(uint32_t h[5], const uint8_t *data, size_t num) { uint32_t A, B, C, D, E; |