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:
@ -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)) {
|
||||
/*
|
||||
|
Reference in New Issue
Block a user