diff options
Diffstat (limited to 'src/md5.c')
| -rw-r--r-- | src/md5.c | 30 |
1 files changed, 7 insertions, 23 deletions
| @@ -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) */ |
| 73 | void | 73 | void |
| 74 | md5_init_ctx (ctx) | 74 | md5_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. */ |
| 91 | void * | 90 | void * |
| 92 | md5_read_ctx (ctx, resbuf) | 91 | md5_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. */ |
| 109 | void * | 106 | void * |
| 110 | md5_finish_ctx (ctx, resbuf) | 107 | md5_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. */ |
| 140 | int | 135 | int |
| 141 | md5_stream (stream, resblock) | 136 | md5_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. */ |
| 197 | void * | 190 | void * |
| 198 | md5_buffer (buffer, len, resblock) | 191 | md5_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 | ||
| 216 | void | 206 | void |
| 217 | md5_process_bytes (buffer, len, ctx) | 207 | md5_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 | ||
| 289 | void | 276 | void |
| 290 | md5_process_block (buffer, len, ctx) | 277 | md5_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; |