diff options
Diffstat (limited to 'rsa.c')
-rw-r--r-- | rsa.c | 19 |
1 files changed, 4 insertions, 15 deletions
@@ -35,28 +35,15 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$Id: rsa.c,v 1.11 2000/03/17 12:40:16 damien Exp $"); | 38 | RCSID("$Id: rsa.c,v 1.12 2000/04/03 04:50:46 damien Exp $"); |
39 | 39 | ||
40 | #include "rsa.h" | 40 | #include "rsa.h" |
41 | #include "ssh.h" | 41 | #include "ssh.h" |
42 | #include "xmalloc.h" | 42 | #include "xmalloc.h" |
43 | #include "random.h" | 43 | #include "entropy.h" |
44 | 44 | ||
45 | int rsa_verbose = 1; | 45 | int rsa_verbose = 1; |
46 | 46 | ||
47 | /* | ||
48 | * Seed OpenSSL's random number generator | ||
49 | */ | ||
50 | void | ||
51 | seed_rng() | ||
52 | { | ||
53 | char buf[64]; | ||
54 | |||
55 | get_random_bytes(buf, sizeof(buf)); | ||
56 | RAND_seed(buf, sizeof(buf)); | ||
57 | memset(buf, 0, sizeof(buf)); | ||
58 | } | ||
59 | |||
60 | int | 47 | int |
61 | rsa_alive() | 48 | rsa_alive() |
62 | { | 49 | { |
@@ -109,6 +96,8 @@ rsa_generate_key(RSA *prv, RSA *pub, unsigned int bits) | |||
109 | if (key == NULL) | 96 | if (key == NULL) |
110 | fatal("rsa_generate_key: key generation failed."); | 97 | fatal("rsa_generate_key: key generation failed."); |
111 | 98 | ||
99 | seed_rng(); | ||
100 | |||
112 | /* Copy public key parameters */ | 101 | /* Copy public key parameters */ |
113 | pub->n = BN_new(); | 102 | pub->n = BN_new(); |
114 | BN_copy(pub->n, key->n); | 103 | BN_copy(pub->n, key->n); |