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:	Thu, 30 Oct 2014 17:09:31 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Or Gerlitz' <>
CC:	"David S. Miller" <>,
	"" <>,
	Matan Barak <>,
	Amir Vadai <>,
	Saeed Mahameed <>,
	Shani Michaeli <>
Subject: RE: [PATCH net-next 7/8] net: Add calaulation of non folded IPV6
 pseudo header checksum

> OK, talking to Matan, hecame up with this super-quick (compile tested
> only) alternative, is
> this what you were advocating for?
>   {
> +       sum = csum_partial(saddr, sizeof(saddr->in6_u.u6_addr32), sum);
> +       sum = csum_partial(saddr, sizeof(daddr->in6_u.u6_addr32), sum);

I'm pretty sure your 'saddr' and 'daddr' are adjacent.
Whether you can prove that is another matter.

> +       sum = csum_add(sum, (__force __wsum)htonl(len));
> +       sum = csum_add(sum, (__force __wsum)htons(proto));
> +
> +       return sum;
> +}

On 64 bit systems you probably want to end up with something akin to:
	__u64 a, b, c, d;

	a = saddr[0] + saddr[1];
	b = saddr[2] + saddr[3];
	c = daddr[0] + daddr[1];
	d = daddr[2] + daddr[3];
	a += b;
	c += d;
	a += c;
and then collapse down the 64bit value.
However if you write the above in proper C, gcc will probably
convert it to long dependence chain.

An architecture specific csum_partial() probably manages to DTRT.


To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists