lkml.org 
[lkml]   [2022]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/7] random: cleanup poolinfo abstraction
Am Thu, Jan 13, 2022 at 04:44:07PM +0100 schrieb Jason A. Donenfeld:
> Now that we're only using one polynomial, we can cleanup its
> representation into constants, instead of passing around pointers
> dynamically to select different polynomials. This improves the codegen
> and makes the code a bit more straightforward.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

> -} poolinfo_table[] = {
> - /* was: x^128 + x^103 + x^76 + x^51 +x^25 + x + 1 */
> +enum poolinfo {
> + POOL_WORDS = 128,
> + POOL_WORDMASK = POOL_WORDS - 1,
> + POOL_BYTES = POOL_WORDS * sizeof(u32),
> + POOL_BITS = POOL_BYTES * 8,
> + POOL_BITSHIFT = ilog2(POOL_WORDS) + 5,
> + POOL_FRACBITS = POOL_WORDS << (ENTROPY_SHIFT + 5),
> +
> /* x^128 + x^104 + x^76 + x^51 +x^25 + x + 1 */
> - { S(128), 104, 76, 51, 25, 1 },
> + POOL_TAP1 = 104,
> + POOL_TAP2 = 76,

The only information lost seems to be that POOL_TAP1 used to be 103. But
that comment is still available in git history, so feel free to add:

Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>

Thanks,
Dominik

\
 
 \ /
  Last update: 2022-01-16 14:46    [W:0.110 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site