Lines Matching refs:ctx

64 #define	SHA1_TRANSFORM(ctx, in) \
65 SHA1Transform((ctx)->state[0], (ctx)->state[1], (ctx)->state[2], \
66 (ctx)->state[3], (ctx)->state[4], (ctx), (in))
73 #define SHA1_TRANSFORM(ctx, in) sha1_block_data_order((ctx), (in), 1)
74 #define SHA1_TRANSFORM_BLOCKS(ctx, in, num) sha1_block_data_order((ctx), \
77 void sha1_block_data_order(SHA1_CTX *ctx, const void *inpp, size_t num_blocks);
81 #define SHA1_TRANSFORM(ctx, in) SHA1Transform((ctx), (in))
128 SHA1Init(SHA1_CTX *ctx)
130 ctx->count[0] = ctx->count[1] = 0;
137 ctx->state[0] = 0x67452301U;
138 ctx->state[1] = 0xefcdab89U;
139 ctx->state[2] = 0x98badcfeU;
140 ctx->state[3] = 0x10325476U;
141 ctx->state[4] = 0xc3d2e1f0U;
186 SHA1Update(SHA1_CTX *ctx, const void *inptr, size_t input_len)
202 buf_index = (ctx->count[1] >> 3) & 0x3F;
205 if ((ctx->count[1] += (input_len << 3)) < (input_len << 3))
206 ctx->count[0]++;
208 ctx->count[0] += (input_len >> 29);
241 bcopy(input, &ctx->buf_un.buf8[buf_index], buf_len);
244 ctx->buf_un.buf32,
245 &ctx->state[0], VIS);
247 SHA1_TRANSFORM(ctx, ctx->buf_un.buf8);
268 * uint32_t *, // Pointer to SHA state i.e ctx->state
289 &ctx->state[0], VIS);
299 &ctx->state[0], VIS);
308 SHA1_TRANSFORM(ctx, &input[i]);
327 bcopy(&input[i], &ctx->buf_un.buf8[buf_index], input_len - i);
333 SHA1Update(SHA1_CTX *ctx, const void *inptr, size_t input_len)
346 buf_index = (ctx->count[1] >> 3) & 0x3F;
349 if ((ctx->count[1] += (input_len << 3)) < (input_len << 3))
350 ctx->count[0]++;
352 ctx->count[0] += (input_len >> 29);
371 bcopy(input, &ctx->buf_un.buf8[buf_index], buf_len);
372 SHA1_TRANSFORM(ctx, ctx->buf_un.buf8);
378 SHA1_TRANSFORM(ctx, &input[i]);
382 SHA1_TRANSFORM_BLOCKS(ctx, &input[i], block_count);
402 bcopy(&input[i], &ctx->buf_un.buf8[buf_index], input_len - i);
420 SHA1Final(void *digest, SHA1_CTX *ctx)
422 uint8_t bitcount_be[sizeof (ctx->count)];
423 uint32_t index = (ctx->count[1] >> 3) & 0x3f;
426 Encode(bitcount_be, ctx->count, sizeof (bitcount_be));
429 SHA1Update(ctx, PADDING, ((index < 56) ? 56 : 120) - index);
432 SHA1Update(ctx, bitcount_be, sizeof (bitcount_be));
435 Encode(digest, ctx->state, sizeof (ctx->state));
438 bzero(ctx, sizeof (*ctx));
500 SHA1_CTX *ctx, const uint8_t blk[64])
562 * blk = bcopy(ctx->buf_un.buf32, blk, sizeof (ctx->buf_un.buf32));
569 bcopy(blk, ctx->buf_un.buf32, sizeof (ctx->buf_un.buf32));
570 w_15 = LOAD_BIG_32(ctx->buf_un.buf32 + 15);
571 w_14 = LOAD_BIG_32(ctx->buf_un.buf32 + 14);
572 w_13 = LOAD_BIG_32(ctx->buf_un.buf32 + 13);
573 w_12 = LOAD_BIG_32(ctx->buf_un.buf32 + 12);
574 w_11 = LOAD_BIG_32(ctx->buf_un.buf32 + 11);
575 w_10 = LOAD_BIG_32(ctx->buf_un.buf32 + 10);
576 w_9 = LOAD_BIG_32(ctx->buf_un.buf32 + 9);
577 w_8 = LOAD_BIG_32(ctx->buf_un.buf32 + 8);
578 w_7 = LOAD_BIG_32(ctx->buf_un.buf32 + 7);
579 w_6 = LOAD_BIG_32(ctx->buf_un.buf32 + 6);
580 w_5 = LOAD_BIG_32(ctx->buf_un.buf32 + 5);
581 w_4 = LOAD_BIG_32(ctx->buf_un.buf32 + 4);
582 w_3 = LOAD_BIG_32(ctx->buf_un.buf32 + 3);
583 w_2 = LOAD_BIG_32(ctx->buf_un.buf32 + 2);
584 w_1 = LOAD_BIG_32(ctx->buf_un.buf32 + 1);
585 w_0 = LOAD_BIG_32(ctx->buf_un.buf32 + 0);
623 SHA1Transform(SHA1_CTX *ctx, const uint8_t blk[64])
626 sha1word a = ctx->state[0];
627 sha1word b = ctx->state[1];
628 sha1word c = ctx->state[2];
629 sha1word d = ctx->state[3];
630 sha1word e = ctx->state[4];
988 ctx->state[0] += ROTATE_LEFT(b, 5) + G(c, d, e) + a + W(15) +
990 ctx->state[1] += b;
991 ctx->state[2] += ROTATE_LEFT(c, 30);
992 ctx->state[3] += d;
993 ctx->state[4] += e;