summaryrefslogtreecommitdiff
path: root/libavutil/xtea.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-05 21:23:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-05 21:55:31 +0200
commit24823a761cb28eff5876d5de266a7d7103075e94 (patch)
treea476ad08e498a91e05f8a2b789bf6b4f495a145d /libavutil/xtea.c
parent92c7ef1e30d677f29c06caf765c527c9db486861 (diff)
parentbb58c43c69078c6cf29a9efee12e14469e2c21f8 (diff)
downloadffmpeg-24823a761cb28eff5876d5de266a7d7103075e94.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: qdm2: remove broken and disabled dump_context() debug function x86: h264_intrapred: use newly introduced SPLAT* and PSHUFLW macros x86inc: add SPLATB_LOAD, SPLATB_REG, PSHUFLW macros x86inc: modify ALIGN to not generate long nops on i586 x86: h264_intrapred: port to cpuflag macros avplay: update input filter pointer when the filtergraph is reset. avconv: fix parsing of -force_key_frames option. h264: use templates to avoid excessive inlining xtea: Make the count parameter match the documentation blowfish: Make the count parameter match the documentation mpegvideo: Don't use ff_mspel_motion() for vc1 xtea: invert branch and loop precedence blowfish: invert branch and loop precedence flvdec: optionally trust the metadata avconv: Set audio filter time base to the sample rate vp8: Add ifdef guards around the sse2 loopfilter in the sse2slow branch too Conflicts: ffmpeg.c ffplay.c libavcodec/h264.c libavcodec/mpegvideo_common.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/xtea.c')
-rw-r--r--libavutil/xtea.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libavutil/xtea.c b/libavutil/xtea.c
index 983cae90a5..0a5df1cec9 100644
--- a/libavutil/xtea.c
+++ b/libavutil/xtea.c
@@ -71,8 +71,8 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count,
{
int i;
- while (count > 0) {
- if (decrypt) {
+ if (decrypt) {
+ while (count--) {
xtea_crypt_ecb(ctx, dst, src, decrypt);
if (iv) {
@@ -80,7 +80,12 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count,
dst[i] = dst[i] ^ iv[i];
memcpy(iv, src, 8);
}
- } else {
+
+ src += 8;
+ dst += 8;
+ }
+ } else {
+ while (count--) {
if (iv) {
for (i = 0; i < 8; i++)
dst[i] = src[i] ^ iv[i];
@@ -89,11 +94,9 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count,
} else {
xtea_crypt_ecb(ctx, dst, src, decrypt);
}
+ src += 8;
+ dst += 8;
}
-
- src += 8;
- dst += 8;
- count -= 8;
}
}