comparison dbrandom.c @ 1411:798854f62430 fuzz

merge from main
author Matt Johnston <matt@ucc.asn.au>
date Wed, 14 Jun 2017 23:31:42 +0800
parents ddfcadca3c4c ead816a63549
children 5916af64acd4
comparison
equal deleted inserted replaced
1408:27e65d3aed5f 1411:798854f62430
57 static int already_blocked = 0; 57 static int already_blocked = 0;
58 int readfd; 58 int readfd;
59 unsigned int readcount; 59 unsigned int readcount;
60 int ret = DROPBEAR_FAILURE; 60 int ret = DROPBEAR_FAILURE;
61 61
62 #if DROPBEAR_PRNGD_SOCKET 62 #ifdef DROPBEAR_PRNGD_SOCKET
63 if (prngd) 63 if (prngd)
64 { 64 {
65 readfd = connect_unix(filename); 65 readfd = connect_unix(filename);
66 } 66 }
67 else 67 else
105 else 105 else
106 { 106 {
107 wantread = MIN(sizeof(readbuf), len-readcount); 107 wantread = MIN(sizeof(readbuf), len-readcount);
108 } 108 }
109 109
110 #if DROPBEAR_PRNGD_SOCKET 110 #ifdef DROPBEAR_PRNGD_SOCKET
111 if (prngd) 111 if (prngd)
112 { 112 {
113 char egdcmd[2]; 113 char egdcmd[2];
114 egdcmd[0] = 0x02; /* blocking read */ 114 egdcmd[0] = 0x02; /* blocking read */
115 egdcmd[1] = (unsigned char)wantread; 115 egdcmd[1] = (unsigned char)wantread;
213 sha1_init(&hs); 213 sha1_init(&hs);
214 214
215 /* existing state */ 215 /* existing state */
216 sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); 216 sha1_process(&hs, (void*)hashpool, sizeof(hashpool));
217 217
218 #if DROPBEAR_PRNGD_SOCKET 218 #ifdef DROPBEAR_PRNGD_SOCKET
219 if (process_file(&hs, DROPBEAR_PRNGD_SOCKET, INIT_SEED_SIZE, 1) 219 if (process_file(&hs, DROPBEAR_PRNGD_SOCKET, INIT_SEED_SIZE, 1)
220 != DROPBEAR_SUCCESS) { 220 != DROPBEAR_SUCCESS) {
221 dropbear_exit("Failure reading random device %s", 221 dropbear_exit("Failure reading random device %s",
222 DROPBEAR_PRNGD_SOCKET); 222 DROPBEAR_PRNGD_SOCKET);
223 } 223 }