From: Kovarththanan Rajaratnam Date: Mon, 22 Feb 2010 21:23:20 +0000 (+0100) Subject: Remove disabled md4 test code X-Git-Tag: v3.0pre0~55^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fdbd384f29679e41a902d28a47d9294d0638ae20;p=thirdparty%2Fccache.git Remove disabled md4 test code This piece of test code was dead and in addition we don't have any framework for testing it. Any test of this module should probably be done upstream instead (Samba) --- diff --git a/mdfour.c b/mdfour.c index 581865b9b..c3483f6eb 100644 --- a/mdfour.c +++ b/mdfour.c @@ -200,87 +200,3 @@ void mdfour(unsigned char *out, const unsigned char *in, int n) mdfour_update(&md, NULL, 0); mdfour_result(&md, out); } - -#ifdef TEST_MDFOUR -static void file_checksum1(char *fname) -{ - int fd, i; - struct mdfour md; - unsigned char buf[1024], sum[16]; - unsigned chunk; - - fd = open(fname,O_RDONLY|O_BINARY); - if (fd == -1) { - perror("fname"); - exit(1); - } - - chunk = 1 + random() % (sizeof(buf) - 1); - - mdfour_begin(&md); - - while (1) { - int n = read(fd, buf, chunk); - if (n >= 0) { - mdfour_update(&md, buf, n); - } - if (n < chunk) break; - } - - close(fd); - - mdfour_update(&md, NULL, 0); - - mdfour_result(&md, sum); - - for (i=0;i<16;i++) - printf("%02x", sum[i]); - printf("\n"); -} - -#if 0 -#include "../md4.h" - -static void file_checksum2(char *fname) -{ - int fd, i; - MDstruct md; - unsigned char buf[64], sum[16]; - - fd = open(fname,O_RDONLY|O_BINARY); - if (fd == -1) { - perror("fname"); - exit(1); - } - - MDbegin(&md); - - while (1) { - int n = read(fd, buf, sizeof(buf)); - if (n <= 0) break; - MDupdate(&md, buf, n*8); - } - - if (!md.done) { - MDupdate(&md, buf, 0); - } - - close(fd); - - memcpy(sum, md.buffer, 16); - - for (i=0;i<16;i++) - printf("%02x", sum[i]); - printf("\n"); -} -#endif - -int main(int argc, char *argv[]) -{ - file_checksum1(argv[1]); -#if 0 - file_checksum2(argv[1]); -#endif - return 0; -} -#endif