From f18a84b6c9a0948eea7f3b0f862a9dddc48558c3 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 8 May 2022 16:11:52 +0200 Subject: [PATCH] Enable explicit_bzero() and getentropy() on DragonFly platform + enable explicit_bzero() on Haiku platform (requires linking against libbsd). --- Makefile | 4 ++++ libslunkcrypt/src/junk.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a5009f6..84bf675 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,10 @@ ifneq (,$(firstword $(filter %-w64-mingw32 %w64-windows-gnu,$(MACHINE)))) LDFLGS += -mconsole -municode endif +ifneq (,$(firstword $(filter %-unknown-haiku,$(MACHINE)))) + LDFLGS += -lbsd +endif + # --------------------------------------------------------------------------- # File names # --------------------------------------------------------------------------- diff --git a/libslunkcrypt/src/junk.c b/libslunkcrypt/src/junk.c index 310916a..70064ee 100644 --- a/libslunkcrypt/src/junk.c +++ b/libslunkcrypt/src/junk.c @@ -51,7 +51,7 @@ static INLINE size_t MIN_SIZE(const size_t a, const size_t b) { return (a > b) ? #undef HAVE_WIN32RTLGENRANDOM #if defined(_WIN32) # define HAVE_WIN32RTLGENRANDOM 1 -#elif (defined(__linux__) && !defined(__UCLIBC__)) || (defined(__FreeBSD__) && (__FreeBSD__ >= 12)) || defined(__OpenBSD__) || (defined(__sun) && defined(__SVR4)) +#elif (defined(__linux__) && !defined(__UCLIBC__)) || (defined(__FreeBSD__) && (__FreeBSD__ >= 12)) || defined(__DragonFly__) || defined(__OpenBSD__) || (defined(__sun) && defined(__SVR4)) # define HAVE_GETENTROPY 1 #else # pragma message("Function getentropy() is *not* available -> using fallback!") @@ -61,7 +61,7 @@ static INLINE size_t MIN_SIZE(const size_t a, const size_t b) { return (a > b) ? #undef EXPLICIT_BZERO #if defined(_WIN32) && defined(SecureZeroMemory) # define EXPLICIT_BZERO SecureZeroMemory -#elif (defined(__linux__) && !defined(__UCLIBC__)) || (defined(__FreeBSD__) && (__FreeBSD__ >= 11)) || defined(__OpenBSD__) || (defined(__sun) && defined(__SVR4)) +#elif (defined(__linux__) && !defined(__UCLIBC__)) || (defined(__FreeBSD__) && (__FreeBSD__ >= 11)) || defined(__DragonFly__) || defined(__OpenBSD__) || (defined(__sun) && defined(__SVR4)) || defined(__HAIKU__) # define EXPLICIT_BZERO explicit_bzero #else # pragma message("Function explicit_bzero() is *not* available -> using fallback!")