Lines Matching refs:state
79 static inline void chacha20_quarter_round( uint32_t state[16], in chacha20_quarter_round()
86 state[a] += state[b]; in chacha20_quarter_round()
87 state[d] ^= state[a]; in chacha20_quarter_round()
88 state[d] = ROTL32( state[d], 16 ); in chacha20_quarter_round()
91 state[c] += state[d]; in chacha20_quarter_round()
92 state[b] ^= state[c]; in chacha20_quarter_round()
93 state[b] = ROTL32( state[b], 12 ); in chacha20_quarter_round()
96 state[a] += state[b]; in chacha20_quarter_round()
97 state[d] ^= state[a]; in chacha20_quarter_round()
98 state[d] = ROTL32( state[d], 8 ); in chacha20_quarter_round()
101 state[c] += state[d]; in chacha20_quarter_round()
102 state[b] ^= state[c]; in chacha20_quarter_round()
103 state[b] = ROTL32( state[b], 7 ); in chacha20_quarter_round()
114 static void chacha20_inner_block( uint32_t state[16] ) in chacha20_inner_block()
116 chacha20_quarter_round( state, 0, 4, 8, 12 ); in chacha20_inner_block()
117 chacha20_quarter_round( state, 1, 5, 9, 13 ); in chacha20_inner_block()
118 chacha20_quarter_round( state, 2, 6, 10, 14 ); in chacha20_inner_block()
119 chacha20_quarter_round( state, 3, 7, 11, 15 ); in chacha20_inner_block()
121 chacha20_quarter_round( state, 0, 5, 10, 15 ); in chacha20_inner_block()
122 chacha20_quarter_round( state, 1, 6, 11, 12 ); in chacha20_inner_block()
123 chacha20_quarter_round( state, 2, 7, 8, 13 ); in chacha20_inner_block()
124 chacha20_quarter_round( state, 3, 4, 9, 14 ); in chacha20_inner_block()
177 mbedtls_platform_zeroize( ctx->state, sizeof( ctx->state ) ); in mbedtls_chacha20_init()
199 ctx->state[0] = 0x61707865; in mbedtls_chacha20_setkey()
200 ctx->state[1] = 0x3320646e; in mbedtls_chacha20_setkey()
201 ctx->state[2] = 0x79622d32; in mbedtls_chacha20_setkey()
202 ctx->state[3] = 0x6b206574; in mbedtls_chacha20_setkey()
205 ctx->state[4] = MBEDTLS_GET_UINT32_LE( key, 0 ); in mbedtls_chacha20_setkey()
206 ctx->state[5] = MBEDTLS_GET_UINT32_LE( key, 4 ); in mbedtls_chacha20_setkey()
207 ctx->state[6] = MBEDTLS_GET_UINT32_LE( key, 8 ); in mbedtls_chacha20_setkey()
208 ctx->state[7] = MBEDTLS_GET_UINT32_LE( key, 12 ); in mbedtls_chacha20_setkey()
209 ctx->state[8] = MBEDTLS_GET_UINT32_LE( key, 16 ); in mbedtls_chacha20_setkey()
210 ctx->state[9] = MBEDTLS_GET_UINT32_LE( key, 20 ); in mbedtls_chacha20_setkey()
211 ctx->state[10] = MBEDTLS_GET_UINT32_LE( key, 24 ); in mbedtls_chacha20_setkey()
212 ctx->state[11] = MBEDTLS_GET_UINT32_LE( key, 28 ); in mbedtls_chacha20_setkey()
225 ctx->state[12] = counter; in mbedtls_chacha20_starts()
228 ctx->state[13] = MBEDTLS_GET_UINT32_LE( nonce, 0 ); in mbedtls_chacha20_starts()
229 ctx->state[14] = MBEDTLS_GET_UINT32_LE( nonce, 4 ); in mbedtls_chacha20_starts()
230 ctx->state[15] = MBEDTLS_GET_UINT32_LE( nonce, 8 ); in mbedtls_chacha20_starts()
267 chacha20_block( ctx->state, ctx->keystream8 ); in mbedtls_chacha20_update()
268 ctx->state[CHACHA20_CTR_INDEX]++; in mbedtls_chacha20_update()
290 chacha20_block( ctx->state, ctx->keystream8 ); in mbedtls_chacha20_update()
291 ctx->state[CHACHA20_CTR_INDEX]++; in mbedtls_chacha20_update()