[multiple] test for nss includes

some distro packages deploy NSS includes under nss/, others nss3/
(and similar for nspr/ vs nspr4/)
personal/stbuehler/tests-path
Glenn Strauss 2020-10-22 00:48:40 -04:00
parent fef1a94509
commit 033209393e
5 changed files with 29 additions and 1 deletions

View File

@ -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>

View File

@ -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

View File

@ -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>

View File

@ -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 \

View File

@ -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