summaryrefslogtreecommitdiff
path: root/libavutil/blowfish.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2012-07-05 11:33:54 +0200
committerMartin Storsjö <martin@martin.st>2012-07-05 12:41:57 +0300
commite4a7fb3da33d98e3c5bbd4e58faf8b8945a07f9c (patch)
tree1a7f4349057e2d975734c1ba4e19192f54bef187 /libavutil/blowfish.c
parent18f2d5cb9c48d06895960f37467576725c9dc2d1 (diff)
blowfish: 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/blowfish.c')
-rw-r--r--libavutil/blowfish.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavutil/blowfish.c b/libavutil/blowfish.c
index 554953e865..5df3dfcf1e 100644
--- a/libavutil/blowfish.c
+++ b/libavutil/blowfish.c
@@ -382,7 +382,7 @@ void av_blowfish_crypt(AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
int i;
if (decrypt) {
- while (count > 0) {
+ while (count--) {
v0 = AV_RB32(src);
v1 = AV_RB32(src + 4);
@@ -399,10 +399,9 @@ void av_blowfish_crypt(AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
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];
@@ -423,7 +422,6 @@ void av_blowfish_crypt(AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
src += 8;
dst += 8;
- count -= 8;
}
}
}