Ilya Maximets <[email protected]> writes:

> On 10/12/26 5:11 PM, Aaron Conole wrote:
>> Until now, utilities wishing access to a quality source of
>> cryptographically secure random numbers would have to either
>> forego security and just use the xorshift, or use one of a
>> few very slow entropy options like get_entropy_or_die or
>> OpenSSL's RAND_bytes() calls.  Both of these are quality
>> tested mechanisms, but the drawback is a very long time to
>> execute (measured 10m iterations of rand_bytes taking
>> roughly 5.14s to complete).
>> 
>> This change adds a ChaCha20 based CSPRNG, which is known
>> to be a high quality CSPRNG.  The benefits are very fast
>> execution time (the same 10m iterations only take 0.059s
>> vs. the PRNG taking 0.018s).
>> 
>> The implementation heavily relies on referencing the
>> following:
>>  * RFC 8439, "ChaCha20 and Poly1305 for IETF Protocols"
>>  * libevent/arc4random.c, "Arc4 random number generator for OpenBSD."
>>  * glibc/stdlib/arc4random.c, "Psuedo random number generator"
>>  * Ben Tasker, "Writing (and backdooring) a ChaCha20 based CSPRNG"
>> 
>> Signed-off-by: Aaron Conole <[email protected]>
>> ---
>>  lib/random.c        | 157 ++++++++++++++++++++++++++++++++++++++++++++
>>  lib/random.h        |  15 +++++
>>  tests/library.at    |   1 +
>>  tests/test-random.c |  67 +++++++++++++++++++
>>  4 files changed, 240 insertions(+)
>> 
>
> [...]
>
>> +/* This is the 32-bit CSPRNG adapted from the ChaCha20 algorithm from
>> + * arc4random(3) and from the Linux kernel's get_random_u32().
> What does that mean for licensing of this code?  Do we need to bring
> here both GPL and the LGPL?

It shouldn't - I sortof misremembered the way we described the conntrack
adaptation from FreeBSD and had it in my head as 'based on', 'from',
etc.  Really, all three implementations are incredibly different, and
all are really based on RFC 8439 (or 7539 in the case of Linux), and
shouldn't matter for licensing.  I can reword the comment to:

 This is a 32-bit CSPRNG adapted from the ChaCha20 algorithm described
 in RFC 7539 and RFC 8439, similar to arc4random(3) and the Linux
 kernel's get_random_u32()

That should be quite a bit clearer.

> Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to