diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-04-24 15:13:52 +0200 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-04-24 15:13:52 +0200 |
commit | 93cd97109b48905baf6154d2e4f5e4c6388fba9c (patch) | |
tree | 623265d7cb2eded77b11d32b5ac5e009c2970125 /mdfour.c | |
parent | 9b43deabc59363bf1cf1857689defc2ab8b88abe (diff) | |
download | ccache-93cd97109b48905baf6154d2e4f5e4c6388fba9c.tar.gz |
mdfour bugfixes pointed out by Richard Rudell
Diffstat (limited to 'mdfour.c')
-rw-r--r-- | mdfour.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -141,8 +141,6 @@ void mdfour_update(struct mdfour *md, const unsigned char *in, int n) { uint32 M[16]; - if (n == 0) mdfour_tail(in, n); - m = md; while (n >= 64) { @@ -153,7 +151,7 @@ void mdfour_update(struct mdfour *md, const unsigned char *in, int n) m->totalN += 64; } - if (n) mdfour_tail(in, n); + mdfour_tail(in, n); } @@ -193,8 +191,10 @@ static void file_checksum1(char *fname) while (1) { int n = read(fd, buf, sizeof(buf)); - if (n <= 0) break; - mdfour_update(&md, buf, n); + if (n >= 0) { + mdfour_update(&md, buf, n); + } + if (n < sizeof(buf)) break; } close(fd); @@ -202,7 +202,7 @@ static void file_checksum1(char *fname) mdfour_result(&md, sum); for (i=0;i<16;i++) - printf("%02X", sum[i]); + printf("%02x", sum[i]); printf("\n"); } @@ -238,7 +238,7 @@ static void file_checksum2(char *fname) memcpy(sum, md.buffer, 16); for (i=0;i<16;i++) - printf("%02X", sum[i]); + printf("%02x", sum[i]); printf("\n"); } #endif |