Home | History | Annotate | Download | only in lib

Lines Matching full:ctx

55 md5_init_ctx (ctx)
56 struct md5_ctx *ctx;
58 ctx->A = 0x67452301;
59 ctx->B = 0xefcdab89;
60 ctx->C = 0x98badcfe;
61 ctx->D = 0x10325476;
63 ctx->total[0] = ctx->total[1] = 0;
64 ctx->buflen = 0;
67 /* Put result from CTX in first 16 bytes following RESBUF. The result
73 md5_read_ctx (ctx, resbuf)
74 const struct md5_ctx *ctx;
77 ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
78 ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
79 ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
80 ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
91 md5_finish_ctx (ctx, resbuf)
92 struct md5_ctx *ctx;
96 md5_uint32 bytes = ctx->buflen;
100 ctx->total[0] += bytes;
101 if (ctx->total[0] < bytes)
102 ++ctx->total[1];
105 memcpy (&ctx->buffer[bytes], fillbuf, pad);
108 *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
109 *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
110 (ctx->total[0] >> 29));
113 md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
115 return md5_read_ctx (ctx, resbuf);
130 struct md5_ctx ctx;
135 md5_init_ctx (&ctx);
164 md5_process_block (buffer, BLOCKSIZE, &ctx);
169 md5_process_bytes (buffer, sum, &ctx);
172 md5_finish_ctx (&ctx, resblock);
189 struct md5_ctx ctx;
192 md5_init_ctx (&ctx);
195 md5_process_bytes (buffer, len, &ctx);
198 return md5_finish_ctx (&ctx, resblock);
204 md5_process_bytes (buffer, len, ctx)
207 struct md5_ctx *ctx;
211 if (ctx->buflen != 0)
213 size_t left_over = ctx->buflen;
216 memcpy (&ctx->buffer[left_over], buffer, add);
217 ctx->buflen += add;
219 if (ctx->buflen > 64)
221 md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
223 ctx->buflen &= 63;
225 memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
226 ctx->buflen);
247 md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
254 md5_process_block (buffer, len & ~63, ctx);
263 size_t left_over = ctx->buflen;
265 memcpy (&ctx->buffer[left_over], buffer, len);
269 md5_process_block (ctx->buffer, 64, ctx);
271 memcpy (ctx->buffer, &ctx->buffer[64], left_over);
273 ctx->buflen = left_over;
287 /* Process LEN bytes of BUFFER, accumulating context into CTX.
291 md5_process_block (buffer, len, ctx)
294 struct md5_ctx *ctx;
300 md5_uint32 A = ctx->A;
301 md5_uint32 B = ctx->B;
302 md5_uint32 C = ctx->C;
303 md5_uint32 D = ctx->D;
308 ctx->total[0] += len;
309 if (ctx->total[0] < len)
310 ++ctx->total[1];
442 ctx->A = A;
443 ctx->B = B;
444 ctx->C = C;
445 ctx->D = D;