Re: [PATCH 1/2] random: use chacha20 for get_random_int/long
From: Jason A. Donenfeld
Date: Fri Jan 20 2017 - 10:47:50 EST
On Fri, Jan 20, 2017 at 3:28 PM, Theodore Ts'o <tytso@xxxxxxx> wrote:
> Compare that to the fact that you're wasting up to 66% of the
> generated words in the batched entropy array, and certainly on average
> you're wasting CPU cycles, even if you are reducing the cost of
> calling get_random_u{32,64} by a handful of cycles....
What do you mean? Nothing is wasted right now. The u64 function only
gets u64s from a dedicated u64 array. The u32 function only gets u32s
from a dedicated u32 array. There are separate batched entropy arrays
for each function.
Perfect respect of alignment rules. Perfect cache line
characteristics. Most optimal instructions used. Zero bytes of entropy
wasted. Clean C code.
Unless I'm misunderstanding your emails, can you please give the
original patch another read?