| 234 | for (int j = 0; j < 4; j++) roundKeys[i * 4 + j] = roundKeys[(i - nk) * 4 + j] ^ temp[j]; |
| 235 | } |
| 236 | } |
| 237 | static void encryptBlock(const unsigned char* in, unsigned char* out, const unsigned char* roundKeys, int nr) |
| 238 | { |
| 239 | unsigned char state[4][4]; |
| 240 | for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) state[j][i] = in[i * 4 + j]; |
| 241 | addRoundKey(state, roundKeys); |
| 242 | for (int round = 1; round < nr; round++) { |
| 243 | subBytes(state); |
| 244 | shiftRows(state); |
| 245 | mixColumns(state); |
| 246 | addRoundKey(state, roundKeys + round * 16); |
| 247 | } |
| 248 | subBytes(state); |
| 249 | shiftRows(state); |
| 250 | addRoundKey(state, roundKeys + nr * 16); |
| 251 | for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) out[i * 4 + j] = state[j][i]; |
| 252 | } |
| 253 | static void decryptBlock(const unsigned char* in, unsigned char* out, const unsigned char* roundKeys, int nr) |
| 254 | { |
nothing calls this directly
no outgoing calls
no test coverage detected