Lines Matching refs:astate
179 static void AddRoundKey(unsigned astate[16], const uint32_t *RoundKeys) in AddRoundKey()
185 astate[i + 0] ^= (n >> 24); in AddRoundKey()
186 astate[i + 1] ^= (n >> 16) & 255; in AddRoundKey()
187 astate[i + 2] ^= (n >> 8) & 255; in AddRoundKey()
188 astate[i + 3] ^= n & 255; in AddRoundKey()
194 static void SubBytes(unsigned astate[16]) in SubBytes()
199 astate[i] = sbox[astate[i]]; in SubBytes()
206 #define ASTATE(col,row) astate[(col)*4 + (row)]
211 static void ShiftRows(unsigned astate[16]) in ShiftRows()
235 static void MixColumns(unsigned astate[16]) in MixColumns()
243 a = astate[i + 0]; in MixColumns()
244 b = astate[i + 1]; in MixColumns()
245 c = astate[i + 2]; in MixColumns()
246 d = astate[i + 3]; in MixColumns()
251 astate[i + 0] = x ^ ((-(int)(x >> 8)) & 0x11b); in MixColumns()
252 astate[i + 1] = y ^ ((-(int)(y >> 8)) & 0x11b); in MixColumns()
253 astate[i + 2] = z ^ ((-(int)(z >> 8)) & 0x11b); in MixColumns()
254 astate[i + 3] = t ^ ((-(int)(t >> 8)) & 0x11b); in MixColumns()
260 static void InvSubBytes(unsigned astate[16]) in InvSubBytes()
265 astate[i] = rsbox[astate[i]]; in InvSubBytes()
268 static void InvShiftRows(unsigned astate[16]) in InvShiftRows()
302 static void InvMixColumns(unsigned astate[16]) in InvMixColumns()
310 a = astate[i + 0]; in InvMixColumns()
311 b = astate[i + 1]; in InvMixColumns()
312 c = astate[i + 2]; in InvMixColumns()
313 d = astate[i + 3]; in InvMixColumns()
316 astate[i + 0] = Multiply(x); in InvMixColumns()
319 astate[i + 1] = Multiply(y); in InvMixColumns()
322 astate[i + 2] = Multiply(z); in InvMixColumns()
325 astate[i + 3] = Multiply(t); in InvMixColumns()
329 static void aes_encrypt_1(struct tls_aes *aes, unsigned astate[16]) in aes_encrypt_1()
335 AddRoundKey(astate, RoundKey); in aes_encrypt_1()
337 SubBytes(astate); in aes_encrypt_1()
338 ShiftRows(astate); in aes_encrypt_1()
341 MixColumns(astate); in aes_encrypt_1()
343 AddRoundKey(astate, RoundKey); in aes_encrypt_1()
353 unsigned astate[16]; in aes_encrypt_one_block() local
360 astate[i] = pt[i]; in aes_encrypt_one_block()
361 aes_encrypt_1(aes, astate); in aes_encrypt_one_block()
363 ct[i] = astate[i]; in aes_encrypt_one_block()
381 unsigned astate[16]; in aes_cbc_encrypt() local
383 astate[i] = pt[i] ^ iv2[i]; in aes_cbc_encrypt()
384 aes_encrypt_1(aes, astate); in aes_cbc_encrypt()
386 iv2[i] = ct[i] = astate[i]; in aes_cbc_encrypt()
394 static void aes_decrypt_1(struct tls_aes *aes, unsigned astate[16]) in aes_decrypt_1()
400 AddRoundKey(astate, RoundKey); in aes_decrypt_1()
402 InvShiftRows(astate); in aes_decrypt_1()
403 InvSubBytes(astate); in aes_decrypt_1()
405 AddRoundKey(astate, RoundKey); in aes_decrypt_1()
408 InvMixColumns(astate); in aes_decrypt_1()
417 unsigned astate[16];
424 astate[i] = ct[i];
425 aes_decrypt_1(aes, astate);
427 pt[i] = astate[i];
449 unsigned astate[16]; in aes_cbc_decrypt() local
451 ivnext[i] = astate[i] = ct[i]; in aes_cbc_decrypt()
452 aes_decrypt_1(aes, astate); in aes_cbc_decrypt()
454 pt[i] = astate[i] ^ ivbuf[i]; in aes_cbc_decrypt()