comparison random.c @ 446:2cd2edfa11ee

Just use /dev/urandom since that's what everyone ends up using anyway. Make -u a nop.
author Matt Johnston <matt@ucc.asn.au>
date Thu, 19 Jul 2007 15:47:32 +0000
parents d82a2a44c684
children c1e9c81d1d27 76097ec1a29a
comparison
equal deleted inserted replaced
445:edbee0596531 446:2cd2edfa11ee
24 24
25 #include "includes.h" 25 #include "includes.h"
26 #include "buffer.h" 26 #include "buffer.h"
27 #include "dbutil.h" 27 #include "dbutil.h"
28 #include "bignum.h" 28 #include "bignum.h"
29
30 #ifdef DROPBEAR_RANDOM_DEV
31 const char* random_dev = DROPBEAR_RANDOM_DEV;
32 #else
33 const char* random_dev = NULL;
34 #endif
35
36 29
37 static int donerandinit = 0; 30 static int donerandinit = 0;
38 31
39 /* this is used to generate unique output from the same hashpool */ 32 /* this is used to generate unique output from the same hashpool */
40 static uint32_t counter = 0; 33 static uint32_t counter = 0;
67 struct sockaddr_un egdsock; 60 struct sockaddr_un egdsock;
68 char egdcmd[2]; 61 char egdcmd[2];
69 #endif 62 #endif
70 63
71 #ifdef DROPBEAR_RANDOM_DEV 64 #ifdef DROPBEAR_RANDOM_DEV
72 readfd = open(random_dev, O_RDONLY); 65 readfd = open(DROPBEAR_RANDOM_DEV, O_RDONLY);
73 if (readfd < 0) { 66 if (readfd < 0) {
74 dropbear_exit("couldn't open %s", random_dev); 67 dropbear_exit("couldn't open random device");
75 } 68 }
76 #endif 69 #endif
77 70
78 #ifdef DROPBEAR_PRNGD_SOCKET 71 #ifdef DROPBEAR_PRNGD_SOCKET
79 memset((void*)&egdsock, 0x0, sizeof(egdsock)); 72 memset((void*)&egdsock, 0x0, sizeof(egdsock));