diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2012-07-05 11:19:13 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-07-05 12:45:18 +0300 |
commit | 983db9b2b4c753507d1cf8427675fca80d598b4c (patch) | |
tree | 6125a656fa0c8226e01db6cbc73daf3c6a11e7e8 /libavutil/xtea.c | |
parent | e4a7fb3da33d98e3c5bbd4e58faf8b8945a07f9c (diff) | |
download | ffmpeg-983db9b2b4c753507d1cf8427675fca80d598b4c.tar.gz |
xtea: Make the count parameter match the documentation
Previously it was interpreted as number of bytes, while the
documentation stated that it was the number of 8 byte blocks.
This makes it behave similarly to the existing AES code.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/xtea.c')
-rw-r--r-- | libavutil/xtea.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavutil/xtea.c b/libavutil/xtea.c index 07a66e5666..7c3a14c2be 100644 --- a/libavutil/xtea.c +++ b/libavutil/xtea.c @@ -72,7 +72,7 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count, int i; if (decrypt) { - while (count > 0) { + while (count--) { xtea_crypt_ecb(ctx, dst, src, decrypt); if (iv) { @@ -83,10 +83,9 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count, src += 8; dst += 8; - count -= 8; } } else { - while (count > 0) { + while (count--) { if (iv) { for (i = 0; i < 8; i++) dst[i] = src[i] ^ iv[i]; @@ -97,7 +96,6 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count, } src += 8; dst += 8; - count -= 8; } } } |