… | |
… | |
48 | |
48 | |
49 | #if ENABLE_PTHREADS |
49 | #if ENABLE_PTHREADS |
50 | # include <pthread.h> |
50 | # include <pthread.h> |
51 | #endif |
51 | #endif |
52 | |
52 | |
|
|
53 | #include <openssl/rand.h> |
|
|
54 | |
53 | #include "netcompat.h" |
55 | #include "netcompat.h" |
54 | |
56 | |
55 | #include "gettext.h" |
57 | #include "gettext.h" |
56 | #include "pidfile.h" |
58 | #include "pidfile.h" |
57 | #include "dropin.h" |
59 | #include "dropin.h" |
… | |
… | |
379 | p[4] = 0xff; |
381 | p[4] = 0xff; |
380 | p[5] = 0xff; |
382 | p[5] = 0xff; |
381 | } |
383 | } |
382 | } |
384 | } |
383 | |
385 | |
|
|
386 | /*****************************************************************************/ |
|
|
387 | |
|
|
388 | void rand_fill (void *data, int len) |
|
|
389 | { |
|
|
390 | int l = RAND_bytes ((unsigned char *)data, len); |
|
|
391 | |
|
|
392 | if (l > 0) |
|
|
393 | return; |
|
|
394 | else if (l == 0) |
|
|
395 | slog (L_WARN, _("Not enough random entropy to generate secure keys. Using weaker pseudo-random session keys.")); |
|
|
396 | else |
|
|
397 | fatal (_("RAND_bytes failed, aborting.")); |
|
|
398 | } |
|
|
399 | |