From 942c3a07ee48e2135d0f0ba27920e66ed82f2f58 Mon Sep 17 00:00:00 2001 From: Andras Fekete Date: Fri, 22 Nov 2024 09:57:55 -0500 Subject: [PATCH 1/2] Fix Renesas test In PR #8182 this line was accidentally wrapped in `#ifdef OPENSSL_EXTRA` --- wolfssl/ssl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index ee9b2fbf3c..212512cc33 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -3051,12 +3051,12 @@ WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_set_peer_cert_chain(WOLFSSL* ss WOLFSSL_API int wolfSSL_want_read(WOLFSSL* ssl); WOLFSSL_API int wolfSSL_want_write(WOLFSSL* ssl); +#include /* var_arg */ #ifdef OPENSSL_EXTRA WOLFSSL_API int wolfSSL_want(WOLFSSL* ssl); WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_CTX_get0_privatekey(const WOLFSSL_CTX* ctx); -#include /* var_arg */ WOLFSSL_API int wolfSSL_BIO_vprintf(WOLFSSL_BIO* bio, const char* format, va_list args); WOLFSSL_API int wolfSSL_BIO_printf(WOLFSSL_BIO* bio, const char* format, ...); From 401a64d11245d5bff0bf0b68ded664c2e77d17ac Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 22 Nov 2024 08:11:32 -0800 Subject: [PATCH 2/2] Improve stdarg.h around uses of var_arg. Cleanup warning for XFREE/XMALLOC redef. --- .../e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c | 2 ++ IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c | 1 + .../RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c | 4 +--- wolfcrypt/benchmark/benchmark.c | 1 + wolfssl/ssl.h | 5 ++++- wolfssl/wolfcrypt/settings.h | 8 ++++++-- wolfssl/wolfcrypt/types.h | 11 ++++++----- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c b/IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c index eb025be711..f5f5375128 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c +++ b/IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c @@ -18,6 +18,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + +#include #include "SEGGER_RTT.h" #define SEGGER_INDEX (0) diff --git a/IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c b/IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c index 19c523f6c9..67dc25983c 100644 --- a/IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c +++ b/IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c @@ -23,6 +23,7 @@ #include #include +#include /* var_arg */ #include #include "wolfssl/wolfcrypt/settings.h" #include "wolfssl/ssl.h" diff --git a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c index 73c001457b..b5771d4b42 100644 --- a/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c +++ b/IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c @@ -23,9 +23,7 @@ #include #include #include - - - +#include #include #include "wolfssl/ssl.h" diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 8c29bc4329..daf9a228b8 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -476,6 +476,7 @@ #endif #elif defined(WOLFSSL_ZEPHYR) #include + #include #define BENCH_EMBEDDED #define printf printfk static int printfk(const char *fmt, ...) diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 212512cc33..1921b012d1 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -3051,15 +3051,18 @@ WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_set_peer_cert_chain(WOLFSSL* ss WOLFSSL_API int wolfSSL_want_read(WOLFSSL* ssl); WOLFSSL_API int wolfSSL_want_write(WOLFSSL* ssl); -#include /* var_arg */ + #ifdef OPENSSL_EXTRA WOLFSSL_API int wolfSSL_want(WOLFSSL* ssl); WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_CTX_get0_privatekey(const WOLFSSL_CTX* ctx); +#include /* var_arg */ WOLFSSL_API int wolfSSL_BIO_vprintf(WOLFSSL_BIO* bio, const char* format, va_list args); WOLFSSL_API int wolfSSL_BIO_printf(WOLFSSL_BIO* bio, const char* format, ...); + + WOLFSSL_API int wolfSSL_BIO_dump(WOLFSSL_BIO *bio, const char* buf, int length); WOLFSSL_API int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO* bio, const WOLFSSL_ASN1_UTCTIME* a); diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 9efaad22c2..da969c0ff9 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -1520,8 +1520,12 @@ extern void uITRON4_free(void *p) ; #ifdef FREERTOS_TCP #if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) && \ !defined(WOLFSSL_STATIC_MEMORY) - #define XMALLOC(s, h, type) pvPortMalloc((s)) /* native heap */ - #define XFREE(p, h, type) vPortFree((p)) /* native heap */ + #ifndef XMALLOC + #define XMALLOC(s, h, type) pvPortMalloc((s)) /* native heap */ + #endif + #ifndef XFREE + #define XFREE(p, h, type) vPortFree((p)) /* native heap */ + #endif #endif #define WOLFSSL_GENSEED_FORTEST diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 23490dad1f..e40e2dc4d3 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -768,7 +768,7 @@ typedef struct w64wrapper { #ifndef USE_WINDOWS_API #if defined(WOLFSSL_ESPIDF) && \ (!defined(NO_ASN_TIME) && defined(HAVE_PKCS7)) - #include + #include /* later gcc than 7.1 introduces -Wformat-truncation */ /* In cases when truncation is expected the caller needs*/ /* to check the return value from the function so that */ @@ -819,17 +819,18 @@ typedef struct w64wrapper { #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) #if defined(_MSC_VER) && (_MSC_VER >= 1900) /* Beginning with the UCRT in Visual Studio 2015 and - Windows 10, snprintf is no longer identical to - _snprintf. The snprintf function behavior is now - C99 standard compliant. */ + * Windows 10, snprintf is no longer identical to + * _snprintf. The snprintf function behavior is now + * C99 standard compliant. */ #include #define XSNPRINTF snprintf #else /* 4996 warning to use MS extensions e.g., _sprintf_s - instead of _snprintf */ + * instead of _snprintf */ #if !defined(__MINGW32__) #pragma warning(disable: 4996) #endif + #include static WC_INLINE int xsnprintf(char *buffer, size_t bufsize, const char *format, ...) {