Lines Matching refs:ctx
181 (ctx->block[(n)] = \
187 (ctx->block[(n)])
194 static const void *body(PHP_MD5_CTX *ctx, const void *data, size_t size) in body() argument
202 a = ctx->a; in body()
203 b = ctx->b; in body()
204 c = ctx->c; in body()
205 d = ctx->d; in body()
293 ctx->a = a; in body()
294 ctx->b = b; in body()
295 ctx->c = c; in body()
296 ctx->d = d; in body()
301 PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx) in PHP_MD5Init() argument
303 ctx->a = 0x67452301; in PHP_MD5Init()
304 ctx->b = 0xefcdab89; in PHP_MD5Init()
305 ctx->c = 0x98badcfe; in PHP_MD5Init()
306 ctx->d = 0x10325476; in PHP_MD5Init()
308 ctx->lo = 0; in PHP_MD5Init()
309 ctx->hi = 0; in PHP_MD5Init()
312 PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size) in PHP_MD5Update() argument
317 saved_lo = ctx->lo; in PHP_MD5Update()
318 if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) { in PHP_MD5Update()
319 ctx->hi++; in PHP_MD5Update()
321 ctx->hi += size >> 29; in PHP_MD5Update()
329 memcpy(&ctx->buffer[used], data, size); in PHP_MD5Update()
333 memcpy(&ctx->buffer[used], data, free); in PHP_MD5Update()
336 body(ctx, ctx->buffer, 64); in PHP_MD5Update()
340 data = body(ctx, data, size & ~(size_t)0x3f); in PHP_MD5Update()
344 memcpy(ctx->buffer, data, size); in PHP_MD5Update()
347 PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx) in PHP_MD5Final() argument
351 used = ctx->lo & 0x3f; in PHP_MD5Final()
353 ctx->buffer[used++] = 0x80; in PHP_MD5Final()
358 memset(&ctx->buffer[used], 0, free); in PHP_MD5Final()
359 body(ctx, ctx->buffer, 64); in PHP_MD5Final()
364 memset(&ctx->buffer[used], 0, free - 8); in PHP_MD5Final()
366 ctx->lo <<= 3; in PHP_MD5Final()
367 ctx->buffer[56] = ctx->lo; in PHP_MD5Final()
368 ctx->buffer[57] = ctx->lo >> 8; in PHP_MD5Final()
369 ctx->buffer[58] = ctx->lo >> 16; in PHP_MD5Final()
370 ctx->buffer[59] = ctx->lo >> 24; in PHP_MD5Final()
371 ctx->buffer[60] = ctx->hi; in PHP_MD5Final()
372 ctx->buffer[61] = ctx->hi >> 8; in PHP_MD5Final()
373 ctx->buffer[62] = ctx->hi >> 16; in PHP_MD5Final()
374 ctx->buffer[63] = ctx->hi >> 24; in PHP_MD5Final()
376 body(ctx, ctx->buffer, 64); in PHP_MD5Final()
378 result[0] = ctx->a; in PHP_MD5Final()
379 result[1] = ctx->a >> 8; in PHP_MD5Final()
380 result[2] = ctx->a >> 16; in PHP_MD5Final()
381 result[3] = ctx->a >> 24; in PHP_MD5Final()
382 result[4] = ctx->b; in PHP_MD5Final()
383 result[5] = ctx->b >> 8; in PHP_MD5Final()
384 result[6] = ctx->b >> 16; in PHP_MD5Final()
385 result[7] = ctx->b >> 24; in PHP_MD5Final()
386 result[8] = ctx->c; in PHP_MD5Final()
387 result[9] = ctx->c >> 8; in PHP_MD5Final()
388 result[10] = ctx->c >> 16; in PHP_MD5Final()
389 result[11] = ctx->c >> 24; in PHP_MD5Final()
390 result[12] = ctx->d; in PHP_MD5Final()
391 result[13] = ctx->d >> 8; in PHP_MD5Final()
392 result[14] = ctx->d >> 16; in PHP_MD5Final()
393 result[15] = ctx->d >> 24; in PHP_MD5Final()
395 ZEND_SECURE_ZERO(ctx, sizeof(*ctx)); in PHP_MD5Final()