MD4 checksum fix
Donovan Baarda
abo at minkirri.apana.org.au
Sun Apr 6 17:29:56 EST 2003
On Sun, 2003-04-06 at 16:29, cbarratt at users.sourceforge.net wrote:
> > It looks like it will work OK, but it's kinda ugly in that starts
> > embedding version stuff into the mdfour implementation. Still... its
> > better than the nothing I've produced :-)
>
> Yes, it's certainly not elegant. An alternative would be to
> have two different sets of MD4 routines and then have more
> logic in checksum.c to call the correct routines. That makes
> for more changes to checksum.c but avoids a library depending
> upon a global variable.
I don't think you need two whole implementations of MD4 routines, just a
replacement _tail function and replacement _result function to use it.
Note that truncating the bit count to 32 bits can be done in the _tail
function.
It might even turn out easier to just write a _result replacement that
munges the mdfour struct (ie, truncs the byte count and empties the tail
buffer) before calling the correct _result implementation.
These can be put into the checksum.c with the appropriate protocol
version logic. That way the mdfour.c implementation becomes a fixed
stand-alone md4 implementation (that can be replaced with faster/cleaner
standard implementations further down the track).
> Or we could add a new function in mdfour.c, eg: mdfour_broken(),
> that gets called once at startup if remote_version < 27. This
> would avoid the need for md4 to pull in remote_version.
This still puts protocol version specific code into mdfour.c, making it
harder further down the track to drop in a replacement implementation or
link against a standard md4 library implementation.
--
----------------------------------------------------------------
Donovan Baarda http://minkirri.apana.org.au/~abo/
----------------------------------------------------------------
More information about the rsync
mailing list