Differences From
Artifact [a0f03f1e22]:
11 11 * → mkpw is unlikely to be portable to non-POSIX
12 12 * systems, but should run fine on Linux as well
13 13 * as BSDs with getrandom() support.
14 14 */
15 15
16 16 #include <unistd.h>
17 17 #include <sys/random.h>
18 +#include <sys/syscall.h>
18 19 #include <stddef.h>
19 20 #include <stdint.h>
20 21 #include <string.h>
21 22 #define sz(a) ( sizeof (a) / sizeof (a) [0] )
22 23 #define say(x) (write(2, (x), sizeof (x)))
23 24
24 25 #ifdef _CLIPBOARD
................................................................................
193 194
194 195 char buf[len+1];
195 196 /* *buf = 0; */
196 197
197 198 unsigned char noise[len];
198 199 for (size_t i = 0; i<q; ++i) {
199 200 unsigned char* cur = noise;
200 - getrandom(noise, len, 0);
201 + syscall(SYS_getrandom, noise, len, 0);
202 + /* getrandom(noise, len, 0); // android doesnt like it */
201 203
202 204 for(char* ptr = buf; ptr < buf + len; ++ptr, ++cur) {
203 205 *ptr = tbl[*cur % chars]; /* such a waste of entropy… :( */
204 206 }
205 207
206 208 buf[len] = '\n';
207 209 write(1, buf, len + 1);