comparison dbrandom.c @ 1439:8d24733026c5 coverity

merge
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Jun 2017 23:33:16 +0800
parents ead816a63549
children 798854f62430 06d52bcb8094
comparison
equal deleted inserted replaced
1400:238a439670f5 1439:8d24733026c5
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;
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 #if DROPBEAR_PRNGD_SOCKET 188 #ifdef 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 }