mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-06-19 19:03:00 +02:00
blowfish: Fix CBC decryption with dst==src
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
@@ -388,15 +388,15 @@ void av_blowfish_crypt(AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
|
|||||||
|
|
||||||
av_blowfish_crypt_ecb(ctx, &v0, &v1, decrypt);
|
av_blowfish_crypt_ecb(ctx, &v0, &v1, decrypt);
|
||||||
|
|
||||||
AV_WB32(dst, v0);
|
|
||||||
AV_WB32(dst + 4, v1);
|
|
||||||
|
|
||||||
if (iv) {
|
if (iv) {
|
||||||
for (i = 0; i < 8; i++)
|
v0 ^= AV_RB32(iv);
|
||||||
dst[i] = dst[i] ^ iv[i];
|
v1 ^= AV_RB32(iv + 4);
|
||||||
memcpy(iv, src, 8);
|
memcpy(iv, src, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AV_WB32(dst, v0);
|
||||||
|
AV_WB32(dst + 4, v1);
|
||||||
|
|
||||||
src += 8;
|
src += 8;
|
||||||
dst += 8;
|
dst += 8;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user