MD4 bug-fix for protocol version 27

Craig Barratt craig at
Thu May 8 15:34:12 EST 2003

> while implementing the rsync protocol in one of our projects I found
> that the current CVS version still has a MD4 bug. I'm using the FreeBSD
> libmd implementation and I still had checksum mismatches with protocol
> version 27 for files whose size was a multiple of 64 - 4 ( - 4 due to
> checksum_seed). A patch for todays CVS version is attached.

You are right.  There are three interfaces to checksum.c: the block
checksum (get_checksum2), the file checksum (file_checksum) and the
cumulative md4 (sum_init/sum_update/sum_end).  I missed sum_end.
I tested the block and file checksums for a wide range of sizes,
but not sum_end.  Ouch.

Your patch looks correct.

I vote for keeping the protocol version at 27.  This might trip up mixed
CVS versions, but that is a short term issue and it would be unpleasant
to keep indefinite support for yet another slightly broken MD4.


More information about the rsync mailing list