Mercurial > libavutil.hg
comparison aes.c @ 188:969465695c2c libavutil
make decode look more like encode
author | michael |
---|---|
date | Sun, 14 Jan 2007 19:02:59 +0000 |
parents | 9b8b17e058a4 |
children | 61ca39abb491 |
comparison
equal
deleted
inserted
replaced
187:9b8b17e058a4 | 188:969465695c2c |
---|---|
73 } | 73 } |
74 | 74 |
75 void av_aes_decrypt(AVAES *a){ | 75 void av_aes_decrypt(AVAES *a){ |
76 int t, r; | 76 int t, r; |
77 | 77 |
78 addkey(a->state, a->round_dec_key[a->rounds]); | 78 for(r=a->rounds; r>1; r--){ |
79 for(r=a->rounds-2; r>=0; r--){ | 79 addkey(a->state, a->round_dec_key[r]); |
80 SUBSHIFT3x((a->state[0]+1)) | 80 SUBSHIFT3x((a->state[0]+1)) |
81 SUBSHIFT2x((a->state[0]+2)) | 81 SUBSHIFT2x((a->state[0]+2)) |
82 SUBSHIFT1x((a->state[0]+3)) | 82 SUBSHIFT1x((a->state[0]+3)) |
83 mix(a->state, dec_multbl); | 83 mix(a->state, dec_multbl); |
84 addkey(a->state, a->round_dec_key[r+1]); | 84 } |
85 } | 85 addkey(a->state, a->round_dec_key[1]); |
86 SUBSHIFT0((a->state[0]+0), inv_sbox) | 86 SUBSHIFT0((a->state[0]+0), inv_sbox) |
87 SUBSHIFT3((a->state[0]+1), inv_sbox) | 87 SUBSHIFT3((a->state[0]+1), inv_sbox) |
88 SUBSHIFT2((a->state[0]+2), inv_sbox) | 88 SUBSHIFT2((a->state[0]+2), inv_sbox) |
89 SUBSHIFT1((a->state[0]+3), inv_sbox) | 89 SUBSHIFT1((a->state[0]+3), inv_sbox) |
90 addkey(a->state, a->round_dec_key[0]); | 90 addkey(a->state, a->round_dec_key[0]); |