changeset 174:263bbdc10c1e libavutil

simplify round_key generation by writing over the end but ensuring that theres some irrelevant stuff afterwards
author michael
date Sun, 14 Jan 2007 13:46:20 +0000
parents 712b0f43e8ac
children 937928db9781
files aes.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/aes.c	Sun Jan 14 13:38:10 2007 +0000
+++ b/aes.c	Sun Jan 14 13:46:20 2007 +0000
@@ -23,8 +23,8 @@
 #include "aes.h"
 
 typedef struct AVAES{
+    uint8_t round_key[15][4][4];
     uint8_t state[4][4];
-    uint8_t round_key[15][4][4];
     int rounds;
 }AVAES;
 
@@ -143,9 +143,9 @@
 
     memcpy(tk, key, KC*4);
 
-    for(t= 0; t < (rounds+1)*4; ) {
-        for(j = 0; j < KC && t < (rounds+1)*4; j++, t++)
-            memcpy(a->round_key[0][t],  tk[j], 4);
+    for(t= 0; t < (rounds+1)*4;) {
+        memcpy(a->round_key[0][t], tk, KC*4);
+        t+= KC;
 
         for(i = 0; i < 4; i++)
             tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]];