Lines Matching refs:ctx
33 static void MD4Init(MD4_CTX *ctx);
34 static void MD4Update(MD4_CTX *ctx, const unsigned char *input, size_t len);
35 static void MD4Final(unsigned char digest[MD4_DIGEST_LENGTH], MD4_CTX *ctx);
40 MD4_CTX ctx;
43 MD4Init(&ctx);
45 MD4Update(&ctx, addr[i], len[i]);
46 MD4Final(mac, &ctx);
103 static void MD4Init(MD4_CTX *ctx)
105 ctx->count = 0;
106 ctx->state[0] = 0x67452301;
107 ctx->state[1] = 0xefcdab89;
108 ctx->state[2] = 0x98badcfe;
109 ctx->state[3] = 0x10325476;
116 static void MD4Update(MD4_CTX *ctx, const unsigned char *input, size_t len)
121 have = (size_t)((ctx->count >> 3) & (MD4_BLOCK_LENGTH - 1));
125 ctx->count += (u64)len << 3;
129 os_memcpy(ctx->buffer + have, input, need);
130 MD4Transform(ctx->state, ctx->buffer);
138 MD4Transform(ctx->state, input);
146 os_memcpy(ctx->buffer + have, input, len);
153 static void MD4Pad(MD4_CTX *ctx)
159 PUT_64BIT_LE(count, ctx->count);
163 ((ctx->count >> 3) & (MD4_BLOCK_LENGTH - 1));
166 MD4Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
167 MD4Update(ctx, count, 8);
171 * Final wrapup--call MD4Pad, fill in digest and zero out ctx.
173 static void MD4Final(unsigned char digest[MD4_DIGEST_LENGTH], MD4_CTX *ctx)
177 MD4Pad(ctx);
180 PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
181 os_memset(ctx, 0, sizeof(*ctx));