From 85d3f29ce384dea6cfbaa80215ce86d2d0358eba Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 16 Oct 2016 15:47:32 +0000 Subject: Unconditionally switch s6-ftrigrd to surf (avoid boot stalling problems, and nobody cares about that RNG not being CS) --- src/libs6/ftrig1_make.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/libs6/ftrig1_make.c') diff --git a/src/libs6/ftrig1_make.c b/src/libs6/ftrig1_make.c index 83ffca9..8352e64 100644 --- a/src/libs6/ftrig1_make.c +++ b/src/libs6/ftrig1_make.c @@ -9,9 +9,26 @@ #include #include #include +#include #include #include "ftrig1.h" +static SURFSchedule surf_ctx = SURFSCHEDULE_ZERO ; + +void ftrig1_init (void) +{ + char seed[160] ; + random_makeseed(seed) ; + surf_init(&surf_ctx, seed) ; +} + +static inline void surfname (char *s, unsigned int n) +{ + static char const oklist[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZghijklmnopqrstuvwxyz-_0123456789abcdef" ; + surf(&surf_ctx, s, n) ; + while (n--) s[n] = oklist[s[n] & 63] ; +} + int ftrig1_make (ftrig1_t *f, char const *path) { ftrig1_t ff = FTRIG1_ZERO ; @@ -25,7 +42,7 @@ int ftrig1_make (ftrig1_t *f, char const *path) tmp[pathlen + 2 + FTRIG1_PREFIXLEN] = ':' ; if (!timestamp(tmp + pathlen + 3 + FTRIG1_PREFIXLEN)) return 0 ; tmp[pathlen + 28 + FTRIG1_PREFIXLEN] = ':' ; - random_name(tmp + pathlen + 29 + FTRIG1_PREFIXLEN, 16) ; + surfname(tmp + pathlen + 29 + FTRIG1_PREFIXLEN, 16) ; tmp[pathlen + 45 + FTRIG1_PREFIXLEN] = 0 ; { -- cgit v1.2.3