Re: [PATCH v6 0/7] treewide cleanup of random integer usage

2022-10-11 Thread Jakub Kicinski
On Mon, 10 Oct 2022 17:06:06 -0600 Jason A. Donenfeld wrote: > - If you want a secure or an insecure random u64, use get_random_u64(). > - If you want a secure or an insecure random u32, use get_random_u32(). > * The old function prandom_u32() has been deprecated for a while now > and is just

Re: [PATCH v6 5/7] treewide: use get_random_u32() when possible

2022-10-11 Thread Heiko Carstens
On Mon, Oct 10, 2022 at 05:06:11PM -0600, Jason A. Donenfeld wrote: > The prandom_u32() function has been a deprecated inline wrapper around > get_random_u32() for several releases now, and compiles down to the > exact same code. Replace the deprecated wrapper with a direct call to > the real funct

Re: [PATCH v6 4/7] treewide: use get_random_{u8,u16}() when possible, part 2

2022-10-11 Thread Heiko Carstens
On Mon, Oct 10, 2022 at 05:06:10PM -0600, Jason A. Donenfeld wrote: > Rather than truncate a 32-bit value to a 16-bit value or an 8-bit value, > simply use the get_random_{u8,u16}() functions, which are faster than > wasting the additional bytes from a 32-bit value. This was done by hand, > identif

Re: [PATCH v6 1/7] treewide: use prandom_u32_max() when possible, part 1

2022-10-11 Thread Heiko Carstens
On Mon, Oct 10, 2022 at 05:06:07PM -0600, Jason A. Donenfeld wrote: > Rather than incurring a division or requesting too many random bytes for > the given range, use the prandom_u32_max() function, which only takes > the minimum required bytes from the RNG and avoids divisions. This was ... > Revie