Refactor crypto RNG; add getrandom() support
[tinc] / test / unit / test_random_noinit.c
1 // Test that randomize() kills the process when called without initialization
2
3 #include "unittest.h"
4
5 #ifdef HAVE_GETRANDOM
6 int main(void) {
7         return 1;
8 }
9 #else
10 #include "../../src/random.h"
11
12 static void on_abort(int sig) {
13         (void)sig;
14         exit(1);
15 }
16
17 int main(void) {
18         signal(SIGABRT, on_abort);
19         u_int8_t buf[16];
20         randomize(buf, sizeof(buf));
21         return 0;
22 }
23 #endif // HAVE_GETRANDOM