Mercurial > dropbear
comparison dbrandom.c @ 1295:750ec4ec4cbe
Convert #ifdef to #if, other build changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 04 May 2016 15:33:40 +0200 |
parents | 9da3e7b4fe55 |
children | 3fdd8c5a0195 ead816a63549 |
comparison
equal
deleted
inserted
replaced
1294:56aba7dedbea | 1295:750ec4ec4cbe |
---|---|
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 #ifdef DROPBEAR_PRNGD_SOCKET | 62 #if 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 #ifdef DROPBEAR_PRNGD_SOCKET | 110 #if 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; |
183 /* hash in the new seed data */ | 183 /* hash in the new seed data */ |
184 sha1_init(&hs); | 184 sha1_init(&hs); |
185 /* existing state */ | 185 /* existing state */ |
186 sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); | 186 sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); |
187 | 187 |
188 #ifdef DROPBEAR_PRNGD_SOCKET | 188 #if DROPBEAR_PRNGD_SOCKET |
189 if (process_file(&hs, DROPBEAR_PRNGD_SOCKET, INIT_SEED_SIZE, 1) | 189 if (process_file(&hs, DROPBEAR_PRNGD_SOCKET, INIT_SEED_SIZE, 1) |
190 != DROPBEAR_SUCCESS) { | 190 != DROPBEAR_SUCCESS) { |
191 dropbear_exit("Failure reading random device %s", | 191 dropbear_exit("Failure reading random device %s", |
192 DROPBEAR_PRNGD_SOCKET); | 192 DROPBEAR_PRNGD_SOCKET); |
193 } | 193 } |