hid-u2fzero.c - hw_random quality set to 1?

From: Dominik Brodowski
Date: Mon Jan 24 2022 - 17:06:44 EST


Hi,

is there any specific rationale why the quality of the hid-u2fzero.c hw
rng is set to 1, meaning that only 1 bit of entrop is added per 1024 bits
of input (see drivers/char/hw_random/core.c)? That actually means that
currently no entropy is credited at all, as this driver will return not
more than 64 bytes (= rc), and then

rc * current_quality * 8 >> 10

evaluates to 0. While this is addressed by a patch I just submitted,[*]
I'd like to know whether this low quality setting is correct.

Thanks,
Dominik

[*] https://lore.kernel.org/linux-crypto/20220124202951.28579-6-linux@xxxxxxxxxxxxxxxxxxxx/