aboutsummaryrefslogtreecommitdiffstats
path: root/src/md5.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/md5.c')
-rw-r--r--src/md5.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/md5.c b/src/md5.c
index 37ae2e6acb5..1840c2ac92b 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -71,8 +71,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
71/* Initialize structure containing state of computation. 71/* Initialize structure containing state of computation.
72 (RFC 1321, 3.3: Step 3) */ 72 (RFC 1321, 3.3: Step 3) */
73void 73void
74md5_init_ctx (ctx) 74md5_init_ctx (struct md5_ctx *ctx)
75 struct md5_ctx *ctx;
76{ 75{
77 ctx->A = 0x67452301; 76 ctx->A = 0x67452301;
78 ctx->B = 0xefcdab89; 77 ctx->B = 0xefcdab89;
@@ -89,9 +88,7 @@ md5_init_ctx (ctx)
89 IMPORTANT: On some systems it is required that RESBUF is correctly 88 IMPORTANT: On some systems it is required that RESBUF is correctly
90 aligned for a 32 bits value. */ 89 aligned for a 32 bits value. */
91void * 90void *
92md5_read_ctx (ctx, resbuf) 91md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
93 const struct md5_ctx *ctx;
94 void *resbuf;
95{ 92{
96 ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); 93 ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
97 ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); 94 ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -107,9 +104,7 @@ md5_read_ctx (ctx, resbuf)
107 IMPORTANT: On some systems it is required that RESBUF is correctly 104 IMPORTANT: On some systems it is required that RESBUF is correctly
108 aligned for a 32 bits value. */ 105 aligned for a 32 bits value. */
109void * 106void *
110md5_finish_ctx (ctx, resbuf) 107md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
111 struct md5_ctx *ctx;
112 void *resbuf;
113{ 108{
114 /* Take yet unprocessed bytes into account. */ 109 /* Take yet unprocessed bytes into account. */
115 md5_uint32 bytes = ctx->buflen; 110 md5_uint32 bytes = ctx->buflen;
@@ -138,9 +133,7 @@ md5_finish_ctx (ctx, resbuf)
138 resulting message digest number will be written into the 16 bytes 133 resulting message digest number will be written into the 16 bytes
139 beginning at RESBLOCK. */ 134 beginning at RESBLOCK. */
140int 135int
141md5_stream (stream, resblock) 136md5_stream (FILE *stream, void *resblock)
142 FILE *stream;
143 void *resblock;
144{ 137{
145 /* Important: BLOCKSIZE must be a multiple of 64. */ 138 /* Important: BLOCKSIZE must be a multiple of 64. */
146#define BLOCKSIZE 4096 139#define BLOCKSIZE 4096
@@ -195,10 +188,7 @@ md5_stream (stream, resblock)
195 output yields to the wanted ASCII representation of the message 188 output yields to the wanted ASCII representation of the message
196 digest. */ 189 digest. */
197void * 190void *
198md5_buffer (buffer, len, resblock) 191md5_buffer (const char *buffer, size_t len, void *resblock)
199 const char *buffer;
200 size_t len;
201 void *resblock;
202{ 192{
203 struct md5_ctx ctx; 193 struct md5_ctx ctx;
204 194
@@ -214,10 +204,7 @@ md5_buffer (buffer, len, resblock)
214 204
215 205
216void 206void
217md5_process_bytes (buffer, len, ctx) 207md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
218 const void *buffer;
219 size_t len;
220 struct md5_ctx *ctx;
221{ 208{
222 /* const void aligned_buffer = buffer; */ 209 /* const void aligned_buffer = buffer; */
223 210
@@ -287,10 +274,7 @@ md5_process_bytes (buffer, len, ctx)
287 It is assumed that LEN % 64 == 0. */ 274 It is assumed that LEN % 64 == 0. */
288 275
289void 276void
290md5_process_block (buffer, len, ctx) 277md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
291 const void *buffer;
292 size_t len;
293 struct md5_ctx *ctx;
294{ 278{
295 md5_uint32 correct_words[16]; 279 md5_uint32 correct_words[16];
296 const md5_uint32 *words = buffer; 280 const md5_uint32 *words = buffer;