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  linux-cve-announce  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]
Message-ID: <m3lge7dyfp.fsf@luffy.cx>
Date:   Sun, 01 Apr 2018 12:16:10 +0200
From:   Vincent Bernat <vincent@...nat.im>
To:     Julian Anastasov <ja@....bg>
Cc:     Wensong Zhang <wensong@...ux-vs.org>,
        Simon Horman <horms@...ge.net.au>,
        "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        lvs-devel@...r.kernel.org
Subject: Re: [PATCH net-next v1] ipvs: fix multiplicative hashing in sh/dh/lblc/lblcr algorithms

 ❦  1 avril 2018 11:11 +0300, Julian Anastasov <ja@....bg> :

>> -	return (ntohl(addr_fold)*2654435761UL) & IP_VS_DH_TAB_MASK;
>> +	return ((ntohl(addr_fold)*2654435761U) >>
>> +		(32 - IP_VS_DH_TAB_BITS)) &
>> +		IP_VS_DH_TAB_MASK;
>
> 	Looks like the '& mask' part is not needed, still,
> it does not generate extra code. I see that other code uses
> hash_32(val, bits) from include/linux/hash.h but note that it
> used different ratio before Linux 4.7, in case someone backports
> this patch on old kernels. So, I don't have preference what should
> be used, may be return hash_32(ntohl(addr_fold), IP_VS_DH_TAB_BITS)
> is better.

I didn't notice this macro. I think this is a better option. Let me
amend the patch.
-- 
Don't stop with your first draft.
            - The Elements of Programming Style (Kernighan & Plauger)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ