summaryrefslogtreecommitdiff
path: root/md5.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2002-01-09 15:58:32 +0100
committerNiels Möller <nisse@lysator.liu.se>2002-01-09 15:58:32 +0100
commit2f43e1c87876e07d35970cd9f6514f503d518e49 (patch)
tree4ed5fa1a8e0b77ac7157513b7bdae1f7d3b29794 /md5.c
parent5725c1bf093767c276e02a33a00246c2aa5f81bb (diff)
downloadnettle-2f43e1c87876e07d35970cd9f6514f503d518e49.tar.gz
(md5_digest): Call md5_final and md5_init.
(md5_final): Declared static. sha1.c, sha256.c: Analogous changes. Rev: src/nettle/md5.c:1.4 Rev: src/nettle/md5.h:1.4 Rev: src/nettle/sha.h:1.2 Rev: src/nettle/sha1.c:1.6 Rev: src/nettle/sha256.c:1.2
Diffstat (limited to 'md5.c')
-rw-r--r--md5.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/md5.c b/md5.c
index 932f6ca1..20568d90 100644
--- a/md5.c
+++ b/md5.c
@@ -91,7 +91,7 @@ md5_update(struct md5_ctx *ctx,
/* Final wrapup - pad to MD5_DATA_SIZE-byte boundary with the bit
* pattern 1 0* (64-bit count of bits processed, LSB-first) */
-void
+static void
md5_final(struct md5_ctx *ctx)
{
uint32_t data[MD5_DATA_LENGTH];
@@ -136,7 +136,7 @@ md5_final(struct md5_ctx *ctx)
}
void
-md5_digest(const struct md5_ctx *ctx,
+md5_digest(struct md5_ctx *ctx,
unsigned length,
uint8_t *digest)
{
@@ -146,6 +146,8 @@ md5_digest(const struct md5_ctx *ctx,
assert(length <= MD5_DIGEST_SIZE);
+ md5_final(ctx);
+
words = length / 4;
leftover = length % 4;
@@ -165,6 +167,7 @@ md5_digest(const struct md5_ctx *ctx,
j++, word >>= 8)
digest[j] = word & 0xff;
}
+ md5_init(ctx);
}
/* MD5 functions */