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] [day] [month] [year] [list]
Message-ID: <1392248633.2214.6.camel@joe-AO722>
Date:	Wed, 12 Feb 2014 15:43:53 -0800
From:	Joe Perches <joe@...ches.com>
To:	Daniel Borkmann <dborkman@...hat.com>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH akpm-next] random32: minor cleanups and kdoc fix

On Wed, 2014-02-12 at 23:43 +0100, Daniel Borkmann wrote:
> These are just some very minor and misc cleanups in the PRNG.

trivia:

> diff --git a/lib/random32.c b/lib/random32.c
[]
> @@ -30,7 +30,6 @@
>  
>     This affects the seeding procedure by imposing the requirement
>     s1 > 1, s2 > 7, s3 > 15, s4 > 127.
> -
>  */

Using normal comment block style

	/*
	 *
	 */

might be nicer
 
>  #include <linux/types.h>
> @@ -75,15 +74,17 @@ EXPORT_SYMBOL(prandom_u32_state);
>   */
>  u32 prandom_u32(void)
>  {
> -	unsigned long r;
>  	struct rnd_state *state = &get_cpu_var(net_rand_state);
> -	r = prandom_u32_state(state);
> +	u32 res;
> +
> +	res = prandom_u32_state(state);

Maybe:

	u32 res = prandom_u32_state(state);

> @@ -201,9 +202,10 @@ static int __init prandom_init(void)
>  	for_each_possible_cpu(i) {
>  		struct rnd_state *state = &per_cpu(net_rand_state,i);
>  
> -		prandom_seed_very_weak(state, (i + jiffies) ^ random_get_entropy());
> +		prandom_seed_very_weak(state, (i + jiffies) ^ (u32)random_get_entropy());

This (u32) cast is not necessary.

On 64 bit machines, the high 32 bits of random_get_entropy
are unnecessarily dropped/masked.

The compiler will cast the unsigned long result of the xor
back to u32 anyway.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ