[Ffmpeg-cvslog] r7481 - trunk/libavutil/aes.c

michael subversion
Sun Jan 14 17:49:35 CET 2007


Author: michael
Date: Sun Jan 14 17:49:35 2007
New Revision: 7481

Modified:
   trunk/libavutil/aes.c

Log:
simplify special round


Modified: trunk/libavutil/aes.c
==============================================================================
--- trunk/libavutil/aes.c	(original)
+++ trunk/libavutil/aes.c	Sun Jan 14 17:49:35 2007
@@ -70,10 +70,9 @@
 void av_aes_decrypt(AVAES *a){
     int t, r;
 
+    addkey(a->state, a->round_key[a->rounds]);
     for(r=a->rounds-1; r>=0; r--){
-        if(r==a->rounds-1)
-            addkey(a->state, a->round_key[r+1]);
-        else
+        if(r!=a->rounds-1)
             mix(a->state, dec_multbl);
         SUBSHIFT0((a->state[0]+0), inv_sbox)
         SUBSHIFT3((a->state[0]+1), inv_sbox)
@@ -92,11 +91,10 @@
         SUBSHIFT1((a->state[0]+1), sbox)
         SUBSHIFT2((a->state[0]+2), sbox)
         SUBSHIFT3((a->state[0]+3), sbox)
-        if(r==a->rounds-1)
-            addkey(a->state, a->round_key[r+1]);
-        else
+        if(r!=a->rounds-1)
             mix(a->state, enc_multbl); //FIXME replace log8 by const / optimze mix as this can be simplified alot
     }
+    addkey(a->state, a->round_key[r]);
 }
 
 static init_multbl(uint8_t tbl[256], int c[4], uint8_t *log8, uint8_t *alog8){




More information about the ffmpeg-cvslog mailing list