Simplify key expansion
This commit is contained in:
parent
ea7b6b89de
commit
2be8b672cb
1 changed files with 1 additions and 3 deletions
|
@ -142,9 +142,7 @@ void mixColumns(t_state s) {
|
||||||
// Taken from: https://www.brainkart.com/article/AES-Key-Expansion_8410/
|
// Taken from: https://www.brainkart.com/article/AES-Key-Expansion_8410/
|
||||||
void expandKey(uint8_t k[16], uint32_t ek[44]) {
|
void expandKey(uint8_t k[16], uint32_t ek[44]) {
|
||||||
for (uint8_t i = 0; i < 4; i++) {
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
for (uint8_t j = 0; j < 4; j++) {
|
ek[i] = word(k[i], k[i + 1], k[i + 2], k[i + 3]);
|
||||||
*(((uint8_t*)(&(ek[i]))) + j) = k[i * 4 + j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 4; i < 44; i++) {
|
for (uint8_t i = 4; i < 44; i++) {
|
||||||
|
|
Loading…
Reference in a new issue