From 22e783a378bb9c57e8fe261a0e7790c3c39dd67d Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 30 Jan 2018 21:05:55 -0500 Subject: [PATCH] Switch to posix_memalign when available It is easier to defer to the runtime for aligned allocations. We found the preprocessor macros needed to identitify the availability. Also see https://forum.kde.org/viewtopic.php?p=66274 --- config.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index 1e9dd9c7..0b9b064d 100644 --- a/config.h +++ b/config.h @@ -690,12 +690,13 @@ NAMESPACE_END #define CRYPTOPP_BOOL_ALIGN16 0 #endif -// how to allocate 16-byte aligned memory (for SSE2) +// How to allocate 16-byte aligned memory (for SSE2) +// posix_memalign see https://forum.kde.org/viewtopic.php?p=66274 #if defined(_MSC_VER) #define CRYPTOPP_MM_MALLOC_AVAILABLE #elif defined(__APPLE__) #define CRYPTOPP_APPLE_MALLOC_AVAILABLE -#elif defined(_AIX) || defined(__FreeBSD__) +#elif defined(_GNU_SOURCE) || ((_XOPEN_SOURCE + 0) >= 600) || defined(_AIX) #define CRYPTOPP_POSIX_MEMALIGN_AVAILABLE #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16