Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The count of chunks should really be an int32, not a size_t,
[rsync/rsync.git]
/
lib
/
mdfour.c
diff --git
a/lib/mdfour.c
b/lib/mdfour.c
index
d8e8632
..
38123c6
100644
(file)
--- a/
lib/mdfour.c
+++ b/
lib/mdfour.c
@@
-117,7
+117,7
@@
static void mdfour_tail(unsigned char *in, uint32 n)
{
unsigned char buf[128];
uint32 M[16];
{
unsigned char buf[128];
uint32 M[16];
- extern int
remote
_version;
+ extern int
protocol
_version;
/*
* Count total number of bits, modulo 2^64
/*
* Count total number of bits, modulo 2^64
@@
-140,7
+140,7
@@
static void mdfour_tail(unsigned char *in, uint32 n)
* of bits modulo 2^64, which was fixed starting with
* protocol version 27.
*/
* of bits modulo 2^64, which was fixed starting with
* protocol version 27.
*/
- if (
remote
_version >= 27) {
+ if (
protocol
_version >= 27) {
copy4(buf+60, m->totalN2);
}
copy64(M, buf);
copy4(buf+60, m->totalN2);
}
copy64(M, buf);
@@
-153,7
+153,7
@@
static void mdfour_tail(unsigned char *in, uint32 n)
* of bits modulo 2^64, which was fixed starting with
* protocol version 27.
*/
* of bits modulo 2^64, which was fixed starting with
* protocol version 27.
*/
- if (
remote
_version >= 27) {
+ if (
protocol
_version >= 27) {
copy4(buf+124, m->totalN2);
}
copy64(M, buf);
copy4(buf+124, m->totalN2);
}
copy64(M, buf);
@@
-206,9
+206,11
@@
void mdfour(unsigned char *out, unsigned char *in, int n)
}
#ifdef TEST_MDFOUR
}
#ifdef TEST_MDFOUR
+int protocol_version = 28;
+
static void file_checksum1(char *fname)
{
static void file_checksum1(char *fname)
{
- int fd, i;
+ int fd, i
, was_multiple_of_64 = 1
;
struct mdfour md;
unsigned char buf[64*1024], sum[16];
struct mdfour md;
unsigned char buf[64*1024], sum[16];
@@
-222,9
+224,13
@@
static void file_checksum1(char *fname)
while (1) {
int n = read(fd, buf, sizeof(buf));
while (1) {
int n = read(fd, buf, sizeof(buf));
- if (n <= 0) break;
+ if (n <= 0)
+ break;
+ was_multiple_of_64 = !(n % 64);
mdfour_update(&md, buf, n);
}
mdfour_update(&md, buf, n);
}
+ if (was_multiple_of_64 && protocol_version >= 27)
+ mdfour_update(&md, buf, 0);
close(fd);
close(fd);