Lines Matching refs:w
84 def aes_add_round_key(state, w): argument
86 state[i] ^= w[i]
91 def aes_sb_sr_mc_ark(state, w, w_idx, temp): argument
98 temp[temp_idx] = aes_gf8_mul_2(x0) ^ aes_gf8_mul_3(x1) ^ x2 ^ x3 ^ w[w_idx]
99 temp[temp_idx + 1] = x0 ^ aes_gf8_mul_2(x1) ^ aes_gf8_mul_3(x2) ^ x3 ^ w[w_idx + 1]
100 temp[temp_idx + 2] = x0 ^ x1 ^ aes_gf8_mul_2(x2) ^ aes_gf8_mul_3(x3) ^ w[w_idx + 2]
101 temp[temp_idx + 3] = aes_gf8_mul_3(x0) ^ x1 ^ x2 ^ aes_gf8_mul_2(x3) ^ w[w_idx + 3]
110 def aes_sb_sr_ark(state, w, w_idx, temp): argument
117 temp[temp_idx] = x0 ^ w[w_idx]
118 temp[temp_idx + 1] = x1 ^ w[w_idx + 1]
119 temp[temp_idx + 2] = x2 ^ w[w_idx + 2]
120 temp[temp_idx + 3] = x3 ^ w[w_idx + 3]
129 def aes_state(state, w, temp, nr): argument
130 aes_add_round_key(state, w)
133 aes_sb_sr_mc_ark(state, w, w_idx, temp)
135 aes_sb_sr_ark(state, w, w_idx, temp)
140 def aes_key_expansion(key, w, temp, nk, nr): argument
142 w[i] = key[i]
148 t[0] = aes_s_box(w[w_idx + 1]) ^ aes_r_con(i // nk)
150 t[j] = aes_s_box(w[w_idx + (j + 1) % 4])
153 t[j] = aes_s_box(w[w_idx + j])
155 t = w
159 w[w_idx + j] = w[w_idx + j - 4 * nk] ^ t[t_idx + j]
180 self.w = bytearray(16 * (self.nr + 1))
185 aes_key_expansion(key, self.w, self.temp, self.nk, self.nr)
195 aes_state(self.state, self.w, self.temp, self.nr)