Lines Matching refs:ctx

910 	struct streebog_state *ctx = shash_desc_ctx(desc);
914 memset(ctx, 0, sizeof(struct streebog_state));
917 ctx->h.qword[i] = cpu_to_le64(0x0101010101010101ULL);
922 static void streebog_pad(struct streebog_state *ctx)
924 if (ctx->fillsize >= STREEBOG_BLOCK_SIZE)
927 memset(ctx->buffer + ctx->fillsize, 0,
928 sizeof(ctx->buffer) - ctx->fillsize);
930 ctx->buffer[ctx->fillsize] = 1;
975 static void streebog_stage2(struct streebog_state *ctx, const u8 *data)
981 streebog_g(&ctx->h, &ctx->N, &m);
983 streebog_add512(&ctx->N, &buffer512, &ctx->N);
984 streebog_add512(&ctx->Sigma, &m, &ctx->Sigma);
987 static void streebog_stage3(struct streebog_state *ctx)
991 buf.qword[0] = cpu_to_le64(ctx->fillsize << 3);
992 streebog_pad(ctx);
994 streebog_g(&ctx->h, &ctx->N, &ctx->m);
995 streebog_add512(&ctx->N, &buf, &ctx->N);
996 streebog_add512(&ctx->Sigma, &ctx->m, &ctx->Sigma);
997 streebog_g(&ctx->h, &buffer0, &ctx->N);
998 streebog_g(&ctx->h, &buffer0, &ctx->Sigma);
999 memcpy(&ctx->hash, &ctx->h, sizeof(struct streebog_uint512));
1005 struct streebog_state *ctx = shash_desc_ctx(desc);
1008 if (ctx->fillsize) {
1009 chunksize = STREEBOG_BLOCK_SIZE - ctx->fillsize;
1012 memcpy(&ctx->buffer[ctx->fillsize], data, chunksize);
1013 ctx->fillsize += chunksize;
1017 if (ctx->fillsize == STREEBOG_BLOCK_SIZE) {
1018 streebog_stage2(ctx, ctx->buffer);
1019 ctx->fillsize = 0;
1024 streebog_stage2(ctx, data);
1030 memcpy(&ctx->buffer, data, len);
1031 ctx->fillsize = len;
1038 struct streebog_state *ctx = shash_desc_ctx(desc);
1040 streebog_stage3(ctx);
1041 ctx->fillsize = 0;
1043 memcpy(digest, &ctx->hash.qword[4], STREEBOG256_DIGEST_SIZE);
1045 memcpy(digest, &ctx->hash.qword[0], STREEBOG512_DIGEST_SIZE);