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: <YhMM1C7n4ipZcQE3@sol.localdomain>
Date:   Sun, 20 Feb 2022 19:53:56 -0800
From:   Eric Biggers <ebiggers@...nel.org>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     linux-kernel@...r.kernel.org, Theodore Ts'o <tytso@....edu>,
        Dominik Brodowski <linux@...inikbrodowski.net>,
        Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH v2] random: make more consistent use of integer types

This looks good in general, but a few comments below.

On Wed, Feb 09, 2022 at 07:05:07PM +0100, Jason A. Donenfeld wrote:
> Cc: Theodore Ts'o <tytso@....edu>
> Cc: Dominik Brodowski <linux@...inikbrodowski.net>
> Reviewed-by: Jann Horn <jannh@...gle.com>
> Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
> -static void _mix_pool_bytes(const void *in, int nbytes)
> +static void _mix_pool_bytes(const void *in, size_t nbytes)
>  {
>  	blake2s_update(&input_pool.hash, in, nbytes);
>  }
>  
> -static void mix_pool_bytes(const void *in, int nbytes)
> +static void mix_pool_bytes(const void *in, size_t nbytes)

The committed version of this patch removes the __mix_pool_bytes() function as
well, and it's not clear how it is related to the rest of the patch.  Perhaps
that part belongs in the patch that removes all the tracepoints?

> -static size_t crng_fast_load(const u8 *cp, size_t len)
> +static size_t crng_fast_load(const void *cp, size_t len)
>  {
>  	unsigned long flags;
> -	u8 *p;
> +	u8 *src = (u8 *)cp;

This should use 'const u8 *'.

>  int __init rand_initialize(void)
>  {
> -	int i;
> +	size_t i;
>  	ktime_t now = ktime_get_real();

This introduces an assumption that BLAKE2S_BLOCK_SIZE % sizeof(unsigned long) ==
0.  That happens to always be true, but it would be better to either not change
this, or rewrite the loop to 'i = 0; i < BLAKE2S_BLOCK_SIZE; i += sizeof(rv)'

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ