diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2020-10-22 00:48:40 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2020-10-22 00:48:40 -0400 |
commit | 033209393e69206f3eeef61d629f5ecc2ea98f17 (patch) | |
tree | 6ed76f2c905ca4710783a319feb69b93d281f0eb | |
parent | fef1a9450976769d6645437b462e8075dffd3542 (diff) | |
download | lighttpd-git-033209393e69206f3eeef61d629f5ecc2ea98f17.tar.gz |
[multiple] test for nss includes
some distro packages deploy NSS includes under nss/, others nss3/
(and similar for nspr/ vs nspr4/)
-rw-r--r-- | src/mod_nss.c | 8 | ||||
-rw-r--r-- | src/mod_secdownload.c | 4 | ||||
-rw-r--r-- | src/rand.c | 5 | ||||
-rw-r--r-- | src/sys-crypto-md.h | 8 | ||||
-rw-r--r-- | src/sys-crypto.h | 5 |
5 files changed, 29 insertions, 1 deletions
diff --git a/src/mod_nss.c b/src/mod_nss.c index ebcb75c1..6329eed6 100644 --- a/src/mod_nss.c +++ b/src/mod_nss.c @@ -78,7 +78,13 @@ #include <stdio.h> /* vsnprintf() */ #include <string.h> -#if defined(__CYGWIN__) +#ifdef __has_include +#if __has_include(<nss3/nss.h>) +#define NSS_VER_INCLUDE +#endif +#endif + +#ifndef NSS_VER_INCLUDE #include <nspr/nspr.h> #include <nspr/private/pprio.h> /* see mod_nss_io_ctor() comments */ #include <nss/nss.h> diff --git a/src/mod_secdownload.c b/src/mod_secdownload.c index ddd1661a..5398c2ea 100644 --- a/src/mod_secdownload.c +++ b/src/mod_secdownload.c @@ -25,7 +25,11 @@ #elif defined(USE_WOLFSSL_CRYPTO) #include <wolfssl/wolfcrypt/hmac.h> #elif defined(USE_NSS_CRYPTO) +#ifdef NSS_VER_INCLUDE #include <nss3/alghmac.h> +#else +#include <nss/alghmac.h> +#endif #endif #endif @@ -56,8 +56,13 @@ #include <gnutls/crypto.h> #endif #ifdef USE_NSS_CRYPTO +#ifdef NSS_VER_INCLUDE #include <nss3/nss.h> #include <nss3/pk11pub.h> +#else +#include <nss/nss.h> +#include <nss/pk11pub.h> +#endif #endif #ifdef HAVE_GETENTROPY #include <sys/random.h> diff --git a/src/sys-crypto-md.h b/src/sys-crypto-md.h index db1247dd..555b47cd 100644 --- a/src/sys-crypto-md.h +++ b/src/sys-crypto-md.h @@ -575,7 +575,11 @@ SHA256_Update(SHA256_CTX *ctx, const void *data, size_t length) * lighttpd defers initialization of rand and crypto until first use * to attempt to avoid long, blocking init at startup while waiting * for sufficient system entropy to become available */ +#ifdef NSS_VER_INCLUDE #include <nss3/nss.h> /* NSS_IsInitialized() NSS_NoDB_Init() */ +#else +#include <nss/nss.h> /* NSS_IsInitialized() NSS_NoDB_Init() */ +#endif #include <stdlib.h> /* abort() */ __attribute_cold__ static inline void @@ -585,7 +589,11 @@ nss_requires_explicit_init_for_basic_crypto_wth(void) abort(); } +#ifdef NSS_VER_INCLUDE #include <nss3/sechash.h> +#else +#include <nss/sechash.h> +#endif #define NSS_gen_hashfuncs(name, typ) \ static inline int \ diff --git a/src/sys-crypto.h b/src/sys-crypto.h index 81ab28fb..26c14af0 100644 --- a/src/sys-crypto.h +++ b/src/sys-crypto.h @@ -29,6 +29,11 @@ #ifdef HAVE_NSS3_NSS_H #define USE_LIB_CRYPTO #define USE_NSS_CRYPTO +#ifdef __has_include +#if __has_include(<nss3/nss.h>) +#define NSS_VER_INCLUDE +#endif +#endif #endif #ifdef HAVE_NETTLE_NETTLE_TYPES_H |