1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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
This commit is contained in:
Michael Niedermayer 2007-01-14 13:46:20 +00:00
parent 84c72fb129
commit ba554c025e

View File

@ -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;
@ -144,8 +144,8 @@ 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);
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]];