summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-01-14 13:46:20 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-01-14 13:46:20 +0000
commitba554c025e55edd3d7c194a421242b03620d8796 (patch)
tree263bdfffbeb2d198ef8937da13553db87824db25 /libavutil
parent84c72fb129b7a567fdf935ec38d73f48f739f95e (diff)
simplify round_key generation by writing over the end but ensuring that theres some irrelevant stuff afterwards
Originally committed as revision 7471 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/aes.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavutil/aes.c b/libavutil/aes.c
index bdbced1913..090ecd234d 100644
--- a/libavutil/aes.c
+++ b/libavutil/aes.c
@@ -23,8 +23,8 @@
#include "aes.h"
typedef struct AVAES{
- uint8_t state[4][4];
uint8_t round_key[15][4][4];
+ uint8_t state[4][4];
int rounds;
}AVAES;
@@ -143,9 +143,9 @@ AVAES *av_aes_init(uint8_t *key, int key_bits) {
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]];