You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

83 lines
1.9 KiB

commit 4fc78878e01451d6465e2072f3f0653182f885c1
Author: Wayne Davison <wayned@samba.org>
Date: Sun May 1 16:29:34 2016 -0700
Tweak indentation only.
diff --git a/checksum.c b/checksum.c
index 6ebb56b..bac775d 100644
--- a/checksum.c
+++ b/checksum.c
@@ -188,32 +188,31 @@ void sum_update(const char *p, int32 len)
{
if (protocol_version >= 30) {
md5_update(&md, (uchar *)p, len);
- return;
- }
+ } else {
+ if (len + sumresidue < CSUM_CHUNK) {
+ memcpy(md.buffer + sumresidue, p, len);
+ sumresidue += len;
+ return;
+ }
- if (len + sumresidue < CSUM_CHUNK) {
- memcpy(md.buffer + sumresidue, p, len);
- sumresidue += len;
- return;
- }
+ if (sumresidue) {
+ int32 i = CSUM_CHUNK - sumresidue;
+ memcpy(md.buffer + sumresidue, p, i);
+ mdfour_update(&md, (uchar *)md.buffer, CSUM_CHUNK);
+ len -= i;
+ p += i;
+ }
- if (sumresidue) {
- int32 i = CSUM_CHUNK - sumresidue;
- memcpy(md.buffer + sumresidue, p, i);
- mdfour_update(&md, (uchar *)md.buffer, CSUM_CHUNK);
- len -= i;
- p += i;
- }
+ while (len >= CSUM_CHUNK) {
+ mdfour_update(&md, (uchar *)p, CSUM_CHUNK);
+ len -= CSUM_CHUNK;
+ p += CSUM_CHUNK;
+ }
- while (len >= CSUM_CHUNK) {
- mdfour_update(&md, (uchar *)p, CSUM_CHUNK);
- len -= CSUM_CHUNK;
- p += CSUM_CHUNK;
+ sumresidue = len;
+ if (sumresidue)
+ memcpy(md.buffer, p, sumresidue);
}
-
- sumresidue = len;
- if (sumresidue)
- memcpy(md.buffer, p, sumresidue);
}
int sum_end(char *sum)
@@ -221,12 +220,12 @@ int sum_end(char *sum)
if (protocol_version >= 30) {
md5_result(&md, (uchar *)sum);
return MD5_DIGEST_LEN;
- }
-
- if (sumresidue || protocol_version >= 27)
- mdfour_update(&md, (uchar *)md.buffer, sumresidue);
+ } else {
+ if (sumresidue || protocol_version >= 27)
+ mdfour_update(&md, (uchar *)md.buffer, sumresidue);
- mdfour_result(&md, (uchar *)sum);
+ mdfour_result(&md, (uchar *)sum);
- return MD4_DIGEST_LEN;
+ return MD4_DIGEST_LEN;
+ }
}