lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 22 Oct 2007 17:35:45 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	joe@...ches.com
Cc:	acme@...stprotocols.net, netdev@...r.kernel.org
Subject: Re: [PATCH] - trivial - Improve appletalk checksum calculation

From: Joe Perches <joe@...ches.com>
Date: Mon, 22 Oct 2007 12:36:19 -0700

> It's a bit after 2.6.1 now...
> 
> Removes unnecessary if, uses 16 bit rotate left.
> Performance improves ~30%
> 
> Signed-off-by: Joe Perches <joe@...ches.com>

I'm not sure your transformation is equivalent.  Did you
actually test this with appletalk traffic to make sure
the sum is computed correctly?  Or more simply, did you
write a test program to send some test data through the
old and new functions?

Here is what I think the problem is:

>  static unsigned long atalk_sum_partial(const unsigned char *data,
>  				       int len, unsigned long sum)
>  {
> -	/* This ought to be unwrapped neatly. I'll trust gcc for now */
>  	while (len--) {
> -		sum += *data;
> -		sum <<= 1;
> -		if (sum & 0x10000) {
> -			sum++;
> -			sum &= 0xffff;
> -		}
> -		data++;
> +		sum += *data++;
> +		sum = ((sum & 0x8000)>>15) | ((sum & 0x7fff)<<1);
>  	}
>  	return sum;
>  }

The old code is handling overflow, so that when bit 16 gets set by and
addition, that overflow bit gets cleared and then added back into the
sum.

Your code is rotating bit 15 down by one bit and bits 0-14 up by one
bit, my remedial math knowledge tell me that's likely not the same
thing. :-)
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists