aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/aes.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-01-14 21:13:14 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-01-14 21:13:14 +0000
commitf25b650a5be8ef947cb3f57a751772ab7f2f5744 (patch)
tree538dd7c9507019bd3310136dc301409d4041fdb4 /libavutil/aes.c
parent8d4ae47c3f21e709ef905717f1420e5eba5191d7 (diff)
downloadffmpeg-f25b650a5be8ef947cb3f57a751772ab7f2f5744.tar.gz
revert simplification (broke 192 bit keys)
Originally committed as revision 7500 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/aes.c')
-rw-r--r--libavutil/aes.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavutil/aes.c b/libavutil/aes.c
index df3ba03541..135b9310f0 100644
--- a/libavutil/aes.c
+++ b/libavutil/aes.c
@@ -158,9 +158,7 @@ AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) {
memcpy(tk, key, KC*4);
for(t= 0; t < (rounds+1)*4;) {
- if(decrypt) memcpy(a->round_key[0 ][ t], tk, KC*4);
- else memcpy(a->round_key[rounds][-t], tk, KC*4);
-
+ memcpy(a->round_key[0][t], tk, KC*4);
t+= KC;
for(i = 0; i < 4; i++)
@@ -181,6 +179,11 @@ AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) {
a->round_key[i][0][j]= sbox[a->round_key[i][0][j]];
mix(a->round_key[i], dec_multbl);
}
+ }else{
+ for(i=0; i<(rounds+1)/2; i++){
+ for(j=0; j<16; j++)
+ FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]);
+ }
}
return a;