Skip to content

Commit

Permalink
use_wolfssl: Adjust headers
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoftsm committed Apr 25, 2024
1 parent 78b29ea commit bb54f38
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 7 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ mark_as_advanced(FORCE_LEGACY_LIBBPF)

if(ENABLE_WOLFSSL)
set(ENABLE_OPENSSL False)
# two features are incompatible
set(ENABLE_PLUGIN_LOGS_MANAGEMENT False)
set(ENABLE_H2O False)
# OSSL_DECODER_CTX does not exist in WolfSSL
set(ENABLE_ACLK False)
else()
set(ENABLE_OPENSSL True)
option(ENABLE_H2O "Enable H2O web server (experimental)" True)
Expand Down Expand Up @@ -1323,7 +1326,7 @@ set(NETDATA_FILES
${WEB_PLUGIN_FILES}
${CLAIM_PLUGIN_FILES}
${SPAWN_PLUGIN_FILES}
${ACLK_ALWAYS_BUILD}
"$<$<BOOL:${ENABLE_OPENSSL}>:${ACLK_ALWAYS_BUILD}>"
${PROFILE_PLUGIN_FILES}
)

Expand Down Expand Up @@ -1631,7 +1634,9 @@ if (ENABLE_WOLFSSL)
message(STATUS "Compiling Netdata with WolfSSL")

target_include_directories(libnetdata BEFORE PUBLIC ${WOLFSSL_INCLUDE_DIRS})
target_compile_options(libnetdata PUBLIC ${WOLFSSL_CFLAGS_OTHER})
target_compile_options(libnetdata PUBLIC ${WOLFSSL_CFLAGS_OTHER}
-DENABLE_WOLFSSL
-DWOLFSSL_BASE64_ENCODE)
target_link_libraries(libnetdata PUBLIC ${WOLFSSL_LDFLAGS})
endif()

Expand Down
6 changes: 5 additions & 1 deletion src/aclk/mqtt_websockets/mqtt_wss_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
#include <netinet/tcp.h> //TCP_NODELAY
#include <netdb.h>

#if defined(ENABLE_OPENSSL)
#if defined(ENABLE_WOLFSSL)
#include <wolfssl/options.h>
#include <wolfssl/openssl/err.h>
#include <wolfssl/openssl/ssl.h>
#elif defined(ENABLE_OPENSSL)
#include <openssl/err.h>
#include <openssl/ssl.h>
#endif
Expand Down
5 changes: 4 additions & 1 deletion src/aclk/mqtt_websockets/mqtt_wss_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ struct mqtt_wss_stats {
struct mqtt_wss_stats mqtt_wss_get_stats(mqtt_wss_client client);

#ifdef MQTT_WSS_DEBUG
#if defined(ENABLE_OPENSSL)
#if defined(ENABLE_WOLFSSL)
#include <wolfssl/options.h>
#include <wolfssl/openssl/ssl.h>
#elif defined(ENABLE_OPENSSL)
#include <openssl/ssl.h>
#endif
void mqtt_wss_set_SSL_CTX_keylog_cb(mqtt_wss_client client, void (*ssl_ctx_keylog_cb)(const SSL *ssl, const char *line));
Expand Down
5 changes: 4 additions & 1 deletion src/aclk/mqtt_websockets/ws_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
#include <errno.h>
#include <ctype.h>

#if defined(ENABLE_OPENSSL)
#if defined(ENABLE_WOLFSSL)
#include <wolfssl/options.h>
#include <wolfssl/openssl/evp.h>
#elif defined(ENABLE_OPENSSL)
#include <openssl/evp.h>
#endif

Expand Down
6 changes: 5 additions & 1 deletion src/database/engine/rrdengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include <fcntl.h>
#include <lz4.h>
#include <Judy.h>
#if defined(ENABLE_OPENSSL)
#if defined(ENABLE_WOLFSSL)
#include <wolfssl/options.h>
#include <wolfssl/openssl/sha.h>
#include <wolfssl/openssl/evp.h>
#elif defined(ENABLE_OPENSSL)
#include <openssl/sha.h>
#include <openssl/evp.h>
#endif
Expand Down
11 changes: 10 additions & 1 deletion src/libnetdata/socket/security.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ typedef enum __attribute__((packed)) {

# ifdef ENABLE_HTTPS

#if defined(ENABLE_OPENSSL)
#if defined(ENABLE_WOLFSSL)
#include <wolfssl/options.h>
#include <wolfssl/version.h>
#include <wolfssl/ssl.h>
#include <wolfssl/error-ssl.h>

#include <wolfssl/openssl/ssl.h>
#include <wolfssl/openssl/sha.h>
#include <wolfssl/openssl/evp.h>
#elif defined(ENABLE_OPENSSL)
#define OPENSSL_VERSION_095 0x00905100L
#define OPENSSL_VERSION_097 0x0907000L
#define OPENSSL_VERSION_110 0x10100000L
Expand Down

0 comments on commit bb54f38

Please sign in to comment.