summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-10-29 16:42:55 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-10-29 16:42:55 -0400
commit8187e988971725039364d685ab446bc11c859d40 (patch)
tree895b7d3a86fde16875f1c401446eac85316232da
parent6fb63fa8d61bdacdc0041f954db860a66c1120a6 (diff)
downloadlighttpd-git-8187e988971725039364d685ab446bc11c859d40.tar.gz
[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.
-rw-r--r--src/mod_openssl.c2
-rw-r--r--src/mod_wolfssl.c13
-rw-r--r--src/sys-crypto-md.h8
-rw-r--r--src/sys-crypto.h25
4 files changed, 19 insertions, 29 deletions
diff --git a/src/mod_openssl.c b/src/mod_openssl.c
index 3f16ac84..d3267f94 100644
--- a/src/mod_openssl.c
+++ b/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
diff --git a/src/mod_wolfssl.c b/src/mod_wolfssl.c
index 2311c93a..a22b0ebe 100644
--- a/src/mod_wolfssl.c
+++ b/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>
diff --git a/src/sys-crypto-md.h b/src/sys-crypto-md.h
index 34960cc3..80bc7aef 100644
--- a/src/sys-crypto-md.h
+++ b/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>
diff --git a/src/sys-crypto.h b/src/sys-crypto.h
index 8fda44d0..a84047b4 100644
--- a/src/sys-crypto.h
+++ b/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