mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
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>
This commit is contained in:
parent
e4a7fb3da3
commit
983db9b2b4
@ -72,7 +72,7 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (decrypt) {
|
if (decrypt) {
|
||||||
while (count > 0) {
|
while (count--) {
|
||||||
xtea_crypt_ecb(ctx, dst, src, decrypt);
|
xtea_crypt_ecb(ctx, dst, src, decrypt);
|
||||||
|
|
||||||
if (iv) {
|
if (iv) {
|
||||||
@ -83,10 +83,9 @@ void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count,
|
|||||||
|
|
||||||
src += 8;
|
src += 8;
|
||||||
dst += 8;
|
dst += 8;
|
||||||
count -= 8;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (count > 0) {
|
while (count--) {
|
||||||
if (iv) {
|
if (iv) {
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
dst[i] = src[i] ^ iv[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;
|
src += 8;
|
||||||
dst += 8;
|
dst += 8;
|
||||||
count -= 8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user