Revision 95d1236b libavutil/aes.c

View differences:

libavutil/aes.c
52 52
#define SUBSHIFT2(s, box) t=s[0]; s[0]=box[s[ 8]]; s[ 8]=box[    t]; t=s[ 4]; s[ 4]=box[s[12]]; s[12]=box[t];
53 53
#define SUBSHIFT3(s, box) t=s[0]; s[0]=box[s[12]]; s[12]=box[s[ 8]];          s[ 8]=box[s[ 4]]; s[ 4]=box[t];
54 54

  
55
#define ROT(x,s) ((x>>s)|(x<<(32-s))
55
#define ROT(x,s) ((x<<s)|(x>>(32-s)))
56 56

  
57 57
static inline void mix(uint8_t state[4][4], uint32_t multbl[4][256]){
58 58
    int i;
......
97 97
    addkey(a->state, a->round_key[r]);
98 98
}
99 99

  
100
static init_multbl(uint8_t tbl[256], int c[4], uint8_t *log8, uint8_t *alog8){
100
static init_multbl(uint8_t tbl[1024], int c[4], uint8_t *log8, uint8_t *alog8){
101 101
    int i;
102 102
    for(i=4; i<1024; i++)
103 103
        tbl[i]= alog8[ log8[i/4] + log8[c[i&3]] ];
......
132 132
//            av_log(NULL, AV_LOG_ERROR, "%d, ", log8[i]);
133 133
        }
134 134
        init_multbl(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8);
135
#ifndef CONFIG_SMALL
135 136
        init_multbl(dec_multbl[1], (int[4]){0xb, 0xe, 0x9, 0xd}, log8, alog8);
136 137
        init_multbl(dec_multbl[2], (int[4]){0xd, 0xb, 0xe, 0x9}, log8, alog8);
137 138
        init_multbl(dec_multbl[3], (int[4]){0x9, 0xd, 0xb, 0xe}, log8, alog8);
139
#endif
138 140
        init_multbl(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8);
141
#ifndef CONFIG_SMALL
139 142
        init_multbl(enc_multbl[1], (int[4]){0x3, 0x2, 0x1, 0x1}, log8, alog8);
140 143
        init_multbl(enc_multbl[2], (int[4]){0x1, 0x3, 0x2, 0x1}, log8, alog8);
141 144
        init_multbl(enc_multbl[3], (int[4]){0x1, 0x1, 0x3, 0x2}, log8, alog8);
145
#endif
142 146
    }
143 147

  
144 148
    if(key_bits!=128 && key_bits!=192 && key_bits!=256)

Also available in: Unified diff