Lines Matching refs:sctx
32 static void octeon_sha512_store_hash(struct sha512_state *sctx)
34 write_octeon_64bit_hash_sha512(sctx->state[0], 0);
35 write_octeon_64bit_hash_sha512(sctx->state[1], 1);
36 write_octeon_64bit_hash_sha512(sctx->state[2], 2);
37 write_octeon_64bit_hash_sha512(sctx->state[3], 3);
38 write_octeon_64bit_hash_sha512(sctx->state[4], 4);
39 write_octeon_64bit_hash_sha512(sctx->state[5], 5);
40 write_octeon_64bit_hash_sha512(sctx->state[6], 6);
41 write_octeon_64bit_hash_sha512(sctx->state[7], 7);
44 static void octeon_sha512_read_hash(struct sha512_state *sctx)
46 sctx->state[0] = read_octeon_64bit_hash_sha512(0);
47 sctx->state[1] = read_octeon_64bit_hash_sha512(1);
48 sctx->state[2] = read_octeon_64bit_hash_sha512(2);
49 sctx->state[3] = read_octeon_64bit_hash_sha512(3);
50 sctx->state[4] = read_octeon_64bit_hash_sha512(4);
51 sctx->state[5] = read_octeon_64bit_hash_sha512(5);
52 sctx->state[6] = read_octeon_64bit_hash_sha512(6);
53 sctx->state[7] = read_octeon_64bit_hash_sha512(7);
78 static void __octeon_sha512_update(struct sha512_state *sctx, const u8 *data,
86 index = sctx->count[0] % SHA512_BLOCK_SIZE;
89 if ((sctx->count[0] += len) < len)
90 sctx->count[1]++;
96 memcpy(&sctx->buf[index], data, part_len);
97 octeon_sha512_transform(sctx->buf);
109 memcpy(&sctx->buf[index], &data[i], len - i);
115 struct sha512_state *sctx = shash_desc_ctx(desc);
124 if ((sctx->count[0] % SHA512_BLOCK_SIZE) + len < SHA512_BLOCK_SIZE)
128 octeon_sha512_store_hash(sctx);
130 __octeon_sha512_update(sctx, data, len);
132 octeon_sha512_read_hash(sctx);
140 struct sha512_state *sctx = shash_desc_ctx(desc);
151 bits[1] = cpu_to_be64(sctx->count[0] << 3);
152 bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
155 index = sctx->count[0] & 0x7f;
159 octeon_sha512_store_hash(sctx);
161 __octeon_sha512_update(sctx, padding, pad_len);
164 __octeon_sha512_update(sctx, (const u8 *)bits, sizeof(bits));
166 octeon_sha512_read_hash(sctx);
171 dst[i] = cpu_to_be64(sctx->state[i]);
174 memset(sctx, 0, sizeof(struct sha512_state));