--- openbsd-compat/openbsd-compat.h +++ openbsd-compat/openbsd-compat.h @@ -179,20 +179,25 @@ int writev(int, struct iovec *, int); int getpeereid(int , uid_t *, gid_t *); #endif -#ifdef HAVE_ARC4RANDOM -# ifndef HAVE_ARC4RANDOM_STIR -# define arc4random_stir() -# endif -#else +#if !defined(HAVE_ARC4RANDOM) || defined(LIBRESSL_VERSION_NUMBER) unsigned int arc4random(void); +#endif + +#if defined(HAVE_ARC4RANDOM_STIR) void arc4random_stir(void); -#endif /* !HAVE_ARC4RANDOM */ +#elif defined(HAVE_ARC4RANDOM) || defined(LIBRESSL_VERSION_NUMBER) +/* Recent system/libressl implementation; no need for explicit stir */ +# define arc4random_stir() +#else +/* openbsd-compat/arc4random.c provides arc4random_stir() */ +void arc4random_stir(void); +#endif -#ifndef HAVE_ARC4RANDOM_BUF +#if !defined(HAVE_ARC4RANDOM_BUF) || defined(LIBRESSL_VERSION_NUMBER) void arc4random_buf(void *, size_t); #endif -#ifndef HAVE_ARC4RANDOM_UNIFORM +#if !defined(HAVE_ARC4RANDOM_UNIFORM) || defined(LIBRESSL_VERSION_NUMBER) u_int32_t arc4random_uniform(u_int32_t); #endif