diff options
author | Niels Möller <nisse@lysator.liu.se> | 2002-01-09 15:58:32 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2002-01-09 15:58:32 +0100 |
commit | 2f43e1c87876e07d35970cd9f6514f503d518e49 (patch) | |
tree | 4ed5fa1a8e0b77ac7157513b7bdae1f7d3b29794 | |
parent | 5725c1bf093767c276e02a33a00246c2aa5f81bb (diff) | |
download | nettle-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
-rw-r--r-- | md5.c | 7 | ||||
-rw-r--r-- | md5.h | 5 | ||||
-rw-r--r-- | sha.h | 10 | ||||
-rw-r--r-- | sha1.c | 7 | ||||
-rw-r--r-- | sha256.c | 7 |
5 files changed, 18 insertions, 18 deletions
@@ -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 */ @@ -51,10 +51,7 @@ md5_update(struct md5_ctx *ctx, const uint8_t *data); void -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); @@ -53,10 +53,7 @@ sha1_update(struct sha1_ctx *ctx, const uint8_t *data); void -sha1_final(struct sha1_ctx *ctx); - -void -sha1_digest(const struct sha1_ctx *ctx, +sha1_digest(struct sha1_ctx *ctx, unsigned length, uint8_t *digest); @@ -85,10 +82,7 @@ sha256_update(struct sha256_ctx *ctx, const uint8_t *data); void -sha256_final(struct sha256_ctx *ctx); - -void -sha256_digest(const struct sha256_ctx *ctx, +sha256_digest(struct sha256_ctx *ctx, unsigned length, uint8_t *digest); @@ -294,7 +294,7 @@ sha1_update(struct sha1_ctx *ctx, /* Final wrapup - pad to SHA1_DATA_SIZE-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first) */ -void +static void sha1_final(struct sha1_ctx *ctx) { uint32_t data[SHA1_DATA_LENGTH]; @@ -338,7 +338,7 @@ sha1_final(struct sha1_ctx *ctx) } void -sha1_digest(const struct sha1_ctx *ctx, +sha1_digest(struct sha1_ctx *ctx, unsigned length, uint8_t *digest) { @@ -348,6 +348,8 @@ sha1_digest(const struct sha1_ctx *ctx, assert(length <= SHA1_DIGEST_SIZE); + sha1_final(ctx); + words = length / 4; leftover = length % 4; @@ -377,4 +379,5 @@ sha1_digest(const struct sha1_ctx *ctx, digest[--j] = (word >> 24) & 0xff; } } + sha1_init(ctx); } @@ -268,7 +268,7 @@ sha256_update(struct sha256_ctx *ctx, /* Final wrapup - pad to SHA1_DATA_SIZE-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first) */ -void +static void sha256_final(struct sha256_ctx *ctx) { uint32_t data[SHA256_DATA_LENGTH]; @@ -312,7 +312,7 @@ sha256_final(struct sha256_ctx *ctx) } void -sha256_digest(const struct sha256_ctx *ctx, +sha256_digest(struct sha256_ctx *ctx, unsigned length, uint8_t *digest) { @@ -322,6 +322,8 @@ sha256_digest(const struct sha256_ctx *ctx, assert(length <= SHA256_DIGEST_SIZE); + sha256_final(ctx); + words = length / 4; leftover = length % 4; @@ -351,4 +353,5 @@ sha256_digest(const struct sha256_ctx *ctx, digest[--j] = (word >> 24) & 0xff; } } + sha256_init(ctx); } |