Lines Matching defs:ctx
62 isc_md5_init(isc_md5_t *ctx) {
63 ctx->buf[0] = 0x67452301;
64 ctx->buf[1] = 0xefcdab89;
65 ctx->buf[2] = 0x98badcfe;
66 ctx->buf[3] = 0x10325476;
68 ctx->bytes[0] = 0;
69 ctx->bytes[1] = 0;
73 isc_md5_invalidate(isc_md5_t *ctx) {
74 memset(ctx, 0, sizeof(isc_md5_t));
184 isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len) {
189 t = ctx->bytes[0];
190 if ((ctx->bytes[0] = t + len) < t)
191 ctx->bytes[1]++; /* Carry from low to high */
193 t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
195 memmove((unsigned char *)ctx->in + 64 - t, buf, len);
199 memmove((unsigned char *)ctx->in + 64 - t, buf, t);
200 byteSwap(ctx->in, 16);
201 transform(ctx->buf, ctx->in);
207 memmove(ctx->in, buf, 64);
208 byteSwap(ctx->in, 16);
209 transform(ctx->buf, ctx->in);
215 memmove(ctx->in, buf, len);
223 isc_md5_final(isc_md5_t *ctx, unsigned char *digest) {
224 int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
225 unsigned char *p = (unsigned char *)ctx->in + count;
235 byteSwap(ctx->in, 16);
236 transform(ctx->buf, ctx->in);
237 p = (unsigned char *)ctx->in;
241 byteSwap(ctx->in, 14);
244 ctx->in[14] = ctx->bytes[0] << 3;
245 ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
246 transform(ctx->buf, ctx->in);
248 byteSwap(ctx->buf, 4);
249 memmove(digest, ctx->buf, 16);
250 memset(ctx, 0, sizeof(isc_md5_t)); /* In case it's sensitive */