From 3d0cc250b97a7bc5e649178dc99635908806ba22 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Fri, 6 Dec 2024 16:35:21 -0600 Subject: [PATCH] Add sanity check for configuration method --- .wolfssl_known_macro_extras | 1 + examples/echoclient/echoclient.c | 2 +- sslSniffer/sslSnifferTest/snifftest.c | 3 +++ tests/srp.c | 3 +++ testsuite/testsuite.c | 2 +- wolfssl/wolfcrypt/settings.h | 8 ++++++++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.wolfssl_known_macro_extras b/.wolfssl_known_macro_extras index e691433d8..8d1f4a995 100644 --- a/.wolfssl_known_macro_extras +++ b/.wolfssl_known_macro_extras @@ -599,6 +599,7 @@ WOLFSSL_CLANG_TIDY WOLFSSL_COMMERCIAL_LICENSE WOLFSSL_CONTIKI WOLFSSL_CRL_ALLOW_MISSING_CDP +WOLFSSL_CUSTOM_CONFIG WOLFSSL_DILITHIUM_ASSIGN_KEY WOLFSSL_DILITHIUM_MAKE_KEY_SMALL_MEM WOLFSSL_DILITHIUM_NO_ASN1 diff --git a/examples/echoclient/echoclient.c b/examples/echoclient/echoclient.c index a7dd0ad2f..7173963cf 100644 --- a/examples/echoclient/echoclient.c +++ b/examples/echoclient/echoclient.c @@ -24,10 +24,10 @@ #include #endif -#include #ifndef WOLFSSL_USER_SETTINGS #include #endif +#include /* Force enable the compatibility macros for this example */ #undef TEST_OPENSSL_COEXIST diff --git a/sslSniffer/sslSnifferTest/snifftest.c b/sslSniffer/sslSnifferTest/snifftest.c index de586f959..f8f8cb6c5 100644 --- a/sslSniffer/sslSnifferTest/snifftest.c +++ b/sslSniffer/sslSnifferTest/snifftest.c @@ -24,6 +24,9 @@ #include #endif +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif #include #include #include diff --git a/tests/srp.c b/tests/srp.c index 649a86efc..36fe93e80 100644 --- a/tests/srp.c +++ b/tests/srp.c @@ -24,6 +24,9 @@ #include #endif +#ifndef WOLFSSL_USER_SETTINGS + #include +#endif #include #include diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index 186a4f9e5..b85ddf66d 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -24,10 +24,10 @@ #include #endif -#include #ifndef WOLFSSL_USER_SETTINGS #include #endif +#include #undef TEST_OPENSSL_COEXIST /* can't use this option with this example */ #undef OPENSSL_COEXIST /* can't use this option with this example */ diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index d5459ae3b..9c939da85 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -28,6 +28,8 @@ * * ./configure CFLAGS="-DFEATURE_FLAG_TO_DEFINE -UFEATURE_FLAG_TO_CLEAR [...]" * + * To build using a custom configuration method, define WOLFSSL_CUSTOM_CONFIG + * * For more information see: * * https://www.wolfssl.com/how-do-i-manage-the-build-configuration-of-wolfssl/ @@ -326,6 +328,12 @@ /* NOTE: cyassl_nucleus_defs.h is akin to user_settings.h */ #include "nucleus.h" #include "os/networking/ssl/lite/cyassl_nucleus_defs.h" +#elif !defined(BUILDING_WOLFSSL) && !defined(WOLFSSL_OPTIONS_H) && \ + !defined(WOLFSSL_CUSTOM_CONFIG) + /* This error indicates that the settings header may not be included before + * other wolfSSL headers. If you are using a custom configuration method, + * define WOLFSSL_CUSTOM_CONFIG to override this error. */ + #error "No configuration for wolfSSL detected, check header order" #endif #include