The application sys-apps/dcfldd (which is an enhanced version of dd) produces wrong MD5 sums when compiled as a 64Bit app under AMD64. The sums are different from the sums generated by 'md5sum'. It works fine when compiled as a 32Bit app under AMD64. SHA1 sums are correct with both 64 and 32bit. Reproducible: Always Steps to Reproduce: 1. compile dcfldd (1.2.2 or 1.2.4) under AMD64 as a 64Bit ELF binary 2. run something like: $ dcfldd if=/dev/zero bs=10k hash=md5 count=30 hashwindow=100k | md5sum - 3. check the sum given in the "Total (md5):" line with the output of md5sum, both should be equal, but aren't 4. You can check the intermedian MD5 sums with: $ dd if=/dev/zero bs=100k count=1 | md5sum - Note: It works if you using SHA1 sums instead: $ dcfldd if=/dev/zero bs=10k hash=sha1 count=30 hashwindow=100k | sha1sum - or compile dcfldd with CFLAGS="-m32" to a 32bit ELF binary. Actual Results: With this: $ dcfldd --version dcfldd (dcfldd) 1.2.4 $ file `which dcfldd` /usr/bin/dcfldd: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), stripped I get: dcfldd if=/dev/zero bs=10k hash=md5 count=30 hashwindow=100k | md5sum - 0 - 102400: 5dc6ed28dcde75b5b6983d2c66717fea 102400 - 204800: 5dc6ed28dcde75b5b6983d2c66717fea 204800 - 307200: 5dc6ed28dcde75b5b6983d2c66717fea Total (md5): 858120c6ffe109f66f8627bb8910f824 30+0 records in 30+0 records out 90aeded9922cf8946ea7858635493724 - $ dd if=/dev/zero bs=100k count=1 | md5sum - # check intermedian MD5 sums 4c6426ac7ef186464ecbb0d81cbfcb1e - Expected Results: $ dcfldd if=/dev/zero bs=10k hash=md5 count=30 hashwindow=100k | md5sum - 0 - 102400: 4c6426ac7ef186464ecbb0d81cbfcb1e 102400 - 204800: 4c6426ac7ef186464ecbb0d81cbfcb1e 204800 - 307200: 4c6426ac7ef186464ecbb0d81cbfcb1e Total (md5): 90aeded9922cf8946ea7858635493724 30+0 records in 30+0 records out 90aeded9922cf8946ea7858635493724 - $ dd if=/dev/zero bs=100k count=1 | md5sum - 4c6426ac7ef186464ecbb0d81cbfcb1e - I get the above when I compile it with CFLAGS="-m32 -O2 -pipe". $ file `which dcfldd` /usr/bin/dcfldd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), stripped I checked version 1.2.2 and 1.2.4 both are calculating the same wrong MD5 sums Both are calculating right SHA1 sums. Other SHA sums are untested because of the lack of other calculation tools. The sums are wrong, but always identical by identical input. I think the output of 'md5sum' is right and so a valid reference. So for I know the Makefile of 'md5sum' runs some basic tests after compilation.
I was also sending a but report to the author Nicholas Harbour <nicholasharbour@yahoo.com>
Created attachment 70418 [details, diff] Fix for wrong MD5 sums with 64bit binaries for AMD64
I checked the source code today and I was able to locate the problem very fast: the MD5 code (md5.c, md5.h) is using a constant typedef for UINT4 for a 32bit unsigned integer type. The correct working SHA1 has the correct including of <stdint.h> and usage of uint32_t as 32bit unsigned integer type. I made a small patch by adding the include of <stdint.h> and typedef'ing of UINT4 to uint32_t. It's now working correctly at my system.
please don't close bugs before the patch is in the tree
Martin thankyou. 1.2.4-r1 includes your patch. Can you submit your patch to the developers of dcfldd too please http://sourceforge.net/tracker/?group_id=115587&atid=672103 AT's can you please test the 1.2.4-r1 specifically the md5 functionality as I've -amd64 masked the stable version. bad md5 generation in forensics package isn't really good at all.
I was submiting my patch to the developers of dcfldd at sourceforge now. I send the patch already to the author Nicholas Harbour per e-mail on tuesday.
1.2.4-r1 works fine