From afe36cebe612dff55cbe020d7c9b70168fc97f1e Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 14 Nov 2023 11:04:48 +0100 Subject: [PATCH] Fix broken `expandKey` function --- aes/aes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aes/aes.cpp b/aes/aes.cpp index b6a25cc..10f8de7 100644 --- a/aes/aes.cpp +++ b/aes/aes.cpp @@ -142,7 +142,7 @@ void mixColumns(t_state s) { // Taken from: https://www.brainkart.com/article/AES-Key-Expansion_8410/ void expandKey(uint8_t k[16], uint32_t ek[44]) { for (uint8_t i = 0; i < 4; i++) { - ek[i] = word(k[i], k[i + 1], k[i + 2], k[i + 3]); + ek[i] = word(k[i * 4], k[i * 4 + 1], k[i * 4 + 2], k[i * 4 + 3]); } for (uint8_t i = 4; i < 44; i++) {