Browse Source

[multiple] test for nss includes

some distro packages deploy NSS includes under nss/, others nss3/
(and similar for nspr/ vs nspr4/)
master
Glenn Strauss 3 months ago
parent
commit
033209393e
5 changed files with 29 additions and 1 deletions
  1. +7
    -1
      src/mod_nss.c
  2. +4
    -0
      src/mod_secdownload.c
  3. +5
    -0
      src/rand.c
  4. +8
    -0
      src/sys-crypto-md.h
  5. +5
    -0
      src/sys-crypto.h

+ 7
- 1
src/mod_nss.c 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>


+ 4
- 0
src/mod_secdownload.c 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


+ 5
- 0
src/rand.c 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>


+ 8
- 0
src/sys-crypto-md.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 \


+ 5
- 0
src/sys-crypto.h 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


Loading…
Cancel
Save