Mercurial > dropbear
comparison genrsa.c @ 687:167fdc091c05
Improve RNG seeding.
Try to read from /dev/urandom multiple times, take input from extra sources,
and use /dev/random when generating private keys
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 29 Jun 2012 23:19:43 +0800 |
parents | a98a2138364a |
children | c3de235d9506 |
comparison
equal
deleted
inserted
replaced
683:63f8d6c469cf | 687:167fdc091c05 |
---|---|
54 | 54 |
55 m_mp_init_multi(key->e, key->n, key->d, key->p, key->q, | 55 m_mp_init_multi(key->e, key->n, key->d, key->p, key->q, |
56 &pminus, &lcm, &qminus, NULL); | 56 &pminus, &lcm, &qminus, NULL); |
57 | 57 |
58 seedrandom(); | 58 seedrandom(); |
59 seedstrongrandom(); | |
59 | 60 |
60 if (mp_set_int(key->e, RSA_E) != MP_OKAY) { | 61 if (mp_set_int(key->e, RSA_E) != MP_OKAY) { |
61 fprintf(stderr, "RSA generation failed\n"); | 62 fprintf(stderr, "RSA generation failed\n"); |
62 exit(1); | 63 exit(1); |
63 } | 64 } |