1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 17:47:33 -05:00

Use a proper PRNG for GTK askpass.

Coverity complained that it was wrong to use rand() in a security
context, and although in this case it's _very_ marginal, I can't
actually disagree that the choice of which light to light up to avoid
giving information about passphrase length is a security context.

So, no more rand(); instead we instantiate a shiny Fortuna PRNG
instance, seed it in more or less the usual way, and use that as an
overkill-level method of choosing which light to light up next.

(Acknowledging that this is a slightly unusual application and less
critical than most, I don't actually put the passphrase characters
themselves into the PRNG, and I don't use a random-seed file.)
This commit is contained in:
Simon Tatham
2019-05-05 20:22:36 +01:00
parent 4fb20b15f3
commit 03aeabfbea
3 changed files with 36 additions and 7 deletions

View File

@ -52,7 +52,6 @@ void uxsel_input_remove(uxsel_id *id) { }
*/
void random_save_seed(void) {}
void random_destroy_seed(void) {}
void noise_ultralight(NoiseSourceId id, unsigned long data) {}
char *platform_default_s(const char *name) { return NULL; }
bool platform_default_b(const char *name, bool def) { return def; }
int platform_default_i(const char *name, int def) { return def; }