1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Windows PuTTYgen: bound entropy input by PRNG state size.

Although I've reinstated the tedious manual mouse input, I can at
least reduce the amount of it that the user is required to provide:
the new PRNG has a hard limit on the size of its seed, so once we've
generated enough entropy to fill that up, there's no point in
collecting more, even if we're generating a particularly large key.
This commit is contained in:
Simon Tatham
2019-02-10 13:43:14 +00:00
parent 4d288dc3e9
commit 22131a51fa
5 changed files with 21 additions and 0 deletions

View File

@ -1166,6 +1166,12 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
else
raw_entropy_required = 256;
/* Bound the entropy collection above by the amount of
* data we can actually fit into the PRNG. Any more
* than that and it's doing no more good. */
if (raw_entropy_required > random_seed_bits())
raw_entropy_required = random_seed_bits();
raw_entropy_buf = snewn(raw_entropy_required, unsigned char);
if (win_read_random(raw_entropy_buf, raw_entropy_required)) {
/*