[FFmpeg-cvslog] blowfish: Fix CBC decryption with dst==src

Martin Storsjö git at videolan.org
Thu Oct 4 12:37:05 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Oct  2 00:04:38 2012 +0300| [87f023f2c01e7004618537114e2d53be69b01019] | committer: Martin Storsjö

blowfish: Fix CBC decryption with dst==src

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87f023f2c01e7004618537114e2d53be69b01019
---

 libavutil/blowfish.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavutil/blowfish.c b/libavutil/blowfish.c
index 35c546a..604c0be 100644
--- a/libavutil/blowfish.c
+++ b/libavutil/blowfish.c
@@ -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_WB32(dst, v0);
-            AV_WB32(dst + 4, v1);
-
             if (iv) {
-                for (i = 0; i < 8; i++)
-                    dst[i] = dst[i] ^ iv[i];
+                v0 ^= AV_RB32(iv);
+                v1 ^= AV_RB32(iv + 4);
                 memcpy(iv, src, 8);
             }
 
+            AV_WB32(dst, v0);
+            AV_WB32(dst + 4, v1);
+
             src   += 8;
             dst   += 8;
         }



More information about the ffmpeg-cvslog mailing list