summaryrefslogtreecommitdiff
path: root/rsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'rsa.c')
-rw-r--r--rsa.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/rsa.c b/rsa.c
index babbf2b74..19160902a 100644
--- a/rsa.c
+++ b/rsa.c
@@ -35,28 +35,15 @@
35*/ 35*/
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$Id: rsa.c,v 1.11 2000/03/17 12:40:16 damien Exp $"); 38RCSID("$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
45int rsa_verbose = 1; 45int rsa_verbose = 1;
46 46
47/*
48 * Seed OpenSSL's random number generator
49 */
50void
51seed_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
60int 47int
61rsa_alive() 48rsa_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);