Browse Source

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>
tags/n1.0
Samuel Pitoiset Martin Storsjö 13 years ago
parent
commit
e4a7fb3da3
1 changed files with 2 additions and 4 deletions
  1. +2
    -4
      libavutil/blowfish.c

+ 2
- 4
libavutil/blowfish.c View File

@@ -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;
}
}
}


Loading…
Cancel
Save