Mercurial > dropbear
comparison dbrandom.c @ 1355:3fdd8c5a0195 fuzz
merge main to fuzz
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 18 May 2017 23:45:10 +0800 |
parents | 5c2899e35b63 750ec4ec4cbe |
children | 08f4fa4dc6a0 |
comparison
equal
deleted
inserted
replaced
1354:7618759e9327 | 1355:3fdd8c5a0195 |
---|---|
59 static int already_blocked = 0; | 59 static int already_blocked = 0; |
60 int readfd; | 60 int readfd; |
61 unsigned int readcount; | 61 unsigned int readcount; |
62 int ret = DROPBEAR_FAILURE; | 62 int ret = DROPBEAR_FAILURE; |
63 | 63 |
64 #ifdef DROPBEAR_PRNGD_SOCKET | 64 #if DROPBEAR_PRNGD_SOCKET |
65 if (prngd) | 65 if (prngd) |
66 { | 66 { |
67 readfd = connect_unix(filename); | 67 readfd = connect_unix(filename); |
68 } | 68 } |
69 else | 69 else |
107 else | 107 else |
108 { | 108 { |
109 wantread = MIN(sizeof(readbuf), len-readcount); | 109 wantread = MIN(sizeof(readbuf), len-readcount); |
110 } | 110 } |
111 | 111 |
112 #ifdef DROPBEAR_PRNGD_SOCKET | 112 #if DROPBEAR_PRNGD_SOCKET |
113 if (prngd) | 113 if (prngd) |
114 { | 114 { |
115 char egdcmd[2]; | 115 char egdcmd[2]; |
116 egdcmd[0] = 0x02; /* blocking read */ | 116 egdcmd[0] = 0x02; /* blocking read */ |
117 egdcmd[1] = (unsigned char)wantread; | 117 egdcmd[1] = (unsigned char)wantread; |
214 sha1_init(&hs); | 214 sha1_init(&hs); |
215 | 215 |
216 /* existing state */ | 216 /* existing state */ |
217 sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); | 217 sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); |
218 | 218 |
219 #ifdef DROPBEAR_PRNGD_SOCKET | 219 #if DROPBEAR_PRNGD_SOCKET |
220 if (process_file(&hs, DROPBEAR_PRNGD_SOCKET, INIT_SEED_SIZE, 1) | 220 if (process_file(&hs, DROPBEAR_PRNGD_SOCKET, INIT_SEED_SIZE, 1) |
221 != DROPBEAR_SUCCESS) { | 221 != DROPBEAR_SUCCESS) { |
222 dropbear_exit("Failure reading random device %s", | 222 dropbear_exit("Failure reading random device %s", |
223 DROPBEAR_PRNGD_SOCKET); | 223 DROPBEAR_PRNGD_SOCKET); |
224 } | 224 } |