Browse Source

[multiple] include wolfssl/options.h after select

include wolfssl/options.h crypto lib config
after selecting crypto lib to use

wolfSSL does not prefix its defines with a wolfSSL-specific namespace
(so we would like to avoid unnecessarily polluting preproc namespace)

This commit further isolates wolfSSL after split from mod_openssl.
Cleans up some preprocessor logic that was put in place when using
the wolfSSL compatibility layer for openssl, before creating a
dedicated mod_wolfssl.
master
Glenn Strauss 6 months ago
parent
commit
8187e98897
  1. 2
      src/mod_openssl.c
  2. 13
      src/mod_wolfssl.c
  3. 8
      src/sys-crypto-md.h
  4. 25
      src/sys-crypto.h

2
src/mod_openssl.c

@ -49,8 +49,6 @@
#endif
#endif
#include "sys-crypto.h"
#ifdef BORINGSSL_API_VERSION
#undef OPENSSL_NO_STDIO /* for X509_STORE_load_locations() */
#endif

13
src/mod_wolfssl.c

@ -41,7 +41,18 @@
* (wolfSSL provides an OpenSSL compatibility layer)
*/
#include "sys-crypto.h"
/* wolfSSL needs to be built with ./configure --enable-lighty for lighttpd.
* Doing so defines OPENSSL_EXTRA and HAVE_LIGHTY in <wolfssl/options.h>, and
* these defines are necessary for wolfSSL headers to expose sufficient openssl
* compatibility layer for wolfSSL to be able to provide an openssl substitute
* for use by lighttpd */
/* workaround fragile code in wolfssl/wolfcrypto/types.h */
#if !defined(SIZEOF_LONG) || !defined(SIZEOF_LONG_LONG)
#undef SIZEOF_LONG
#undef SIZEOF_LONG_LONG
#endif
#include <wolfssl/options.h>
#include <wolfssl/ssl.h>

8
src/sys-crypto-md.h

@ -227,7 +227,7 @@ SHA256_Update(SHA256_CTX *ctx, const void *data, size_t length)
}
#endif
#elif defined(USE_WOLFSSL_CRYPTO) && !defined(USE_OPENSSL_CRYPTO)
#elif defined(USE_WOLFSSL_CRYPTO)
/* WolfSSL compatibility API for OpenSSL unnecessarily bounces through an extra
* layer of indirection. However, to avoid conflicting typedefs when includers
@ -236,6 +236,12 @@ SHA256_Update(SHA256_CTX *ctx, const void *data, size_t length)
* (undef of OPENSSL_EXTRA and NO_OLD_WC_NAMES not sufficient, and not friendly
* to do in a header when others might rely on them) */
/* workaround fragile code in wolfssl/wolfcrypto/types.h */
#if !defined(SIZEOF_LONG) || !defined(SIZEOF_LONG_LONG)
#undef SIZEOF_LONG
#undef SIZEOF_LONG_LONG
#endif
#ifndef NO_MD4
#include <wolfssl/wolfcrypt/md4.h>
#include <wolfssl/openssl/md4.h>

25
src/sys-crypto.h

@ -7,34 +7,9 @@
#define USE_OPENSSL_CRYPTO
#endif
#ifndef USE_OPENSSL_CRYPTO
#ifdef HAVE_WOLFSSL_SSL_H
#define USE_LIB_CRYPTO
#define USE_WOLFSSL_CRYPTO
/* wolfSSL needs to be built with ./configure --enable-lighty for lighttpd.
* Doing so defines OPENSSL_EXTRA and HAVE_LIGHTY in <wolfssl/options.h>, and
* these defines are necessary for wolfSSL headers to expose sufficient openssl
* compatibility layer for wolfSSL to be able to provide an openssl substitute
* for use by lighttpd */
#include <wolfssl/options.h>
/* workaround fragile code in wolfssl/wolfcrypto/types.h */
#ifdef __SIZEOF_LONG__
#ifndef SIZEOF_LONG
#define SIZEOF_LONG __SIZEOF_LONG__
#endif
#endif
#ifdef __SIZEOF_LONG_LONG__
#ifndef SIZEOF_LONG_LONG
#define SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__
#endif
#endif
#if !defined(SIZEOF_LONG) || !defined(SIZEOF_LONG_LONG)
#undef SIZEOF_LONG
#undef SIZEOF_LONG_LONG
#endif
#endif
#endif
#ifdef HAVE_LIBMBEDCRYPTO

Loading…
Cancel
Save