Lines Matching refs:ctx
24 static void MD4Init(MD4_CTX *ctx);
25 static void MD4Update(MD4_CTX *ctx, const unsigned char *input, size_t len);
26 static void MD4Final(unsigned char digest[MD4_DIGEST_LENGTH], MD4_CTX *ctx);
31 MD4_CTX ctx;
37 MD4Init(&ctx);
39 MD4Update(&ctx, addr[i], len[i]);
40 MD4Final(mac, &ctx);
98 static void MD4Init(MD4_CTX *ctx)
100 ctx->count = 0;
101 ctx->state[0] = 0x67452301;
102 ctx->state[1] = 0xefcdab89;
103 ctx->state[2] = 0x98badcfe;
104 ctx->state[3] = 0x10325476;
111 static void MD4Update(MD4_CTX *ctx, const unsigned char *input, size_t len)
116 have = (size_t)((ctx->count >> 3) & (MD4_BLOCK_LENGTH - 1));
120 ctx->count += (u64)len << 3;
124 os_memcpy(ctx->buffer + have, input, need);
125 MD4Transform(ctx->state, ctx->buffer);
133 MD4Transform(ctx->state, input);
141 os_memcpy(ctx->buffer + have, input, len);
148 static void MD4Pad(MD4_CTX *ctx)
154 PUT_64BIT_LE(count, ctx->count);
158 ((ctx->count >> 3) & (MD4_BLOCK_LENGTH - 1));
161 MD4Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
162 MD4Update(ctx, count, 8);
166 * Final wrapup--call MD4Pad, fill in digest and zero out ctx.
168 static void MD4Final(unsigned char digest[MD4_DIGEST_LENGTH], MD4_CTX *ctx)
172 MD4Pad(ctx);
175 PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
176 os_memset(ctx, 0, sizeof(*ctx));