Revision ac9c19da

View differences:

libavformat/asfcrypt.c
139 139
    struct AVDES des;
140 140
    struct AVRC4 rc4;
141 141
    int num_qwords = len >> 3;
142
    uint64_t *qwords = (uint64_t *)data;
142
    uint8_t *qwords = data;
143 143
    uint64_t rc4buff[8];
144 144
    uint64_t packetkey;
145 145
    uint32_t ms_keys[12];
......
156 156
    av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1);
157 157
    multiswap_init((uint8_t *)rc4buff, ms_keys);
158 158

  
159
    packetkey = AV_RN64(&qwords[num_qwords - 1]);
159
    packetkey = AV_RN64(&qwords[num_qwords*8 - 8]);
160 160
    packetkey ^= rc4buff[7];
161 161
    av_des_init(&des, key + 12, 64, 1);
162 162
    av_des_crypt(&des, (uint8_t *)&packetkey, (uint8_t *)&packetkey, 1, NULL, 1);
......
166 166
    av_rc4_crypt(&rc4, data, data, len, NULL, 1);
167 167

  
168 168
    ms_state = 0;
169
    for (i = 0; i < num_qwords - 1; i++, qwords++)
169
    for (i = 0; i < num_qwords - 1; i++, qwords += 8)
170 170
        ms_state = multiswap_enc(ms_keys, ms_state, AV_RL64(qwords));
171 171
    multiswap_invert_keys(ms_keys);
172 172
    packetkey = (packetkey << 32) | (packetkey >> 32);

Also available in: Unified diff