From 2df7f11fad886cf54c98a17e95932d9b5987f488 Mon Sep 17 00:00:00 2001 From: jrmarino Date: Fri, 21 Oct 2016 08:48:31 -0500 Subject: Fix support for DragonFly BSD The __DragonFly__ macros were introduced in issue #1546 along with a function naming fix, but it was decided they should be handled separately. Reviewed-by: Richard Levitte Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/1765) --- config | 5 +++++ crypto/engine/eng_all.c | 2 +- crypto/engine/eng_cryptodev.c | 4 ++-- crypto/init.c | 4 ++-- crypto/uid.c | 2 +- include/openssl/engine.h | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config b/config index 6504143150..b8a787cc53 100755 --- a/config +++ b/config @@ -187,6 +187,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0 ;; + DragonFly:*) + echo "${MACHINE}-whatever-dragonfly"; exit 0 + ;; + FreeBSD:*) echo "${MACHINE}-whatever-freebsd"; exit 0 ;; @@ -697,6 +701,7 @@ case "$GUESSOS" in powerpc64-*-*bsd*) OUT="BSD-generic64"; options="$options -DB_ENDIAN" ;; sparc64-*-*bsd*) OUT="BSD-sparc64" ;; ia64-*-*bsd*) OUT="BSD-ia64" ;; + x86_64-*-dragonfly*) OUT="BSD-x86_64" ;; amd64-*-*bsd*) OUT="BSD-x86_64" ;; *86*-*-*bsd*) # mimic ld behaviour when it's looking for libc... if [ -L /usr/lib/libc.so ]; then # [Free|Net]BSD diff --git a/crypto/engine/eng_all.c b/crypto/engine/eng_all.c index ebe0277370..50fe4cba9e 100644 --- a/crypto/engine/eng_all.c +++ b/crypto/engine/eng_all.c @@ -18,7 +18,7 @@ void ENGINE_load_builtin_engines(void) OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_ALL_BUILTIN, NULL); } -#if (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) && !defined(OPENSSL_NO_DEPRECATED) +#if (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(HAVE_CRYPTODEV)) && !defined(OPENSSL_NO_DEPRECATED) void ENGINE_setup_bsd_cryptodev(void) { static int bsd_cryptodev_default_loaded = 0; diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c index d63c918c7f..cb242291ea 100644 --- a/crypto/engine/eng_cryptodev.c +++ b/crypto/engine/eng_cryptodev.c @@ -42,9 +42,9 @@ #include #if (defined(__unix__) || defined(unix)) && !defined(USG) && \ - (defined(OpenBSD) || defined(__FreeBSD__)) + (defined(OpenBSD) || defined(__FreeBSD__) || defined(__DragonFly__)) # include -# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) +# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) || defined(__DragonFly__) # define HAVE_CRYPTODEV # endif # if (OpenBSD >= 200110) diff --git a/crypto/init.c b/crypto/init.c index 7423eccb1b..93ec7bbc69 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -198,7 +198,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_openssl) return 1; } # if !defined(OPENSSL_NO_HW) && \ - (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) + (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(HAVE_CRYPTODEV)) static CRYPTO_ONCE engine_cryptodev = CRYPTO_ONCE_STATIC_INIT; DEFINE_RUN_ONCE_STATIC(ossl_init_engine_cryptodev) { @@ -525,7 +525,7 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) && !RUN_ONCE(&engine_openssl, ossl_init_engine_openssl)) return 0; # if !defined(OPENSSL_NO_HW) && \ - (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) + (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(HAVE_CRYPTODEV)) if ((opts & OPENSSL_INIT_ENGINE_CRYPTODEV) && !RUN_ONCE(&engine_cryptodev, ossl_init_engine_cryptodev)) return 0; diff --git a/crypto/uid.c b/crypto/uid.c index 12df8a4e87..9756d51850 100644 --- a/crypto/uid.c +++ b/crypto/uid.c @@ -10,7 +10,7 @@ #include #include -#if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) +#if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) || defined(__DragonFly__) # include OPENSSL_UNISTD diff --git a/include/openssl/engine.h b/include/openssl/engine.h index 319371e425..3bafa188e6 100644 --- a/include/openssl/engine.h +++ b/include/openssl/engine.h @@ -745,7 +745,7 @@ typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, */ void *ENGINE_get_static_state(void); -# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) +# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(HAVE_CRYPTODEV) DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) # endif -- cgit v1.2.3