From 579450af2b13e08fb3402c62c9090d01f783b92d Mon Sep 17 00:00:00 2001
From: Manuel Thalmann <m@nuth.ch>
Date: Tue, 14 Nov 2023 08:58:24 +0100
Subject: [PATCH] Initialize AES state properly

---
 aes/aes.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/aes/aes.cpp b/aes/aes.cpp
index 9899e55..b6a25cc 100644
--- a/aes/aes.cpp
+++ b/aes/aes.cpp
@@ -173,8 +173,9 @@ void aes(uint8_t *in, uint8_t *out, uint8_t *skey)
 
     t_state state;
 
-    state[0] = word(in[0],  in[1],  in[2],  in[3]);
-    /* ??? */
+    for (uint8_t i = 0; i < 4; i++) {
+        state[i] = word(in[i * 4], in[i * 4 + 1], in[i * 4 + 2], in[i * 4 + 3]);
+    }
 
     printf("IN:  "); printstate(state);