wolfSSL / wolfssl

The wolfSSL library is a small, fast, portable implementation of TLS/SSL for embedded devices to the cloud. wolfSSL supports up to TLS 1.3 and DTLS 1.3!
https://www.wolfssl.com
GNU General Public License v2.0
2.31k stars 822 forks source link

[Bug]: presence of sessionCtxSz in structures controlled by different variables -> compilation errors #7134

Open sanja-byelkin opened 8 months ago

sanja-byelkin commented 8 months ago

Contact Details

sanja@mariadb.com

Version

5.6.6

Description

10.4/extra/wolfssl/wolfssl/src/internal.c:36597:31: error: ‘WOLFSSL’ has no member named ‘sessionCtxSz’
36597 |         it->sessionCtxSz = ssl->sessionCtxSz;
      |                               ^~

above happened because one controlled by OPENSSL_EXTRA only, the other by WOLFSSL_SESSION_ID_CTX only and OPENSSL_EXTRA can be defined without WOLFSSL_SESSION_ID_CTX.

Reproduction steps

take Mariadb version 10.4.32, change wolfssl to 5.6.6 , compile as cmake ./ -GNinja -DCMAKE_BUILD_TYPE=Debug -DWITH_VALGRIND=OFF -DWITH_ASAN:BOOL=OFF -DWITH_UBSAN:BOOL=OFF -DWITH_MSAN:BOOL=OFF -DWITH_EMBEDDED_SERVER:BOOL=OFF -DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_S3=NO -DPLUGIN_COLUMNSTORE=NO -DPLUGIN_SPIDER=YES -DPLUGIN_CONNECT=NO -DPLUGIN_XPAND=NO -DPLUGIN_TOKUDB=YES -DMAX_INDEXES=64 -DSECURITY_HARDENED=OFF -DWITH_PCRE=bundled -DWITH_SSL=bundled -DWITH_PROTECT_STATEMENT_MEMROOT:BOOL=OFF -DWITH_SAFEMALLOC=OFF -DWITH_PROTECT_STATEMENT_MEMROOT:BOOL=OFF && ninja

workaround:

diff --git a/extra/wolfssl/user_settings.h.in b/extra/wolfssl/user_settings.h.in
index 425f6f154b9f..baa64fcdfbe3 100644
--- a/extra/wolfssl/user_settings.h.in
+++ b/extra/wolfssl/user_settings.h.in
@@ -28,6 +28,11 @@
 #define NO_OLD_TIMEVAL_NAME
 #define HAVE_SECURE_RENEGOTIATION
 #define HAVE_EXTENDED_MASTER
+/*
+  Following is workaround about a WolfSSL 5.6.6 bug.
+  The bug is about undefined sessionCtxSz during compilation.
+*/
+#define WOLFSSL_SESSION_ID_CTX

 /* TLSv1.3 definitions (all needed to build) */
 #define WOLFSSL_TLS13

Relevant log output

No response

lealem47 commented 8 months ago

Hi @sanja-byelkin,

Thanks for the detailed report. WOLFSSL_SESSION_ID_CTX should always be defined internally when OPENSSL_EXTRA is defined (see below)

https://github.com/wolfSSL/wolfssl/blob/0b167faa564cbc0dc7eea210348fce068beafc2b/wolfssl/wolfcrypt/settings.h#L343

One way I could see this happening is if you have both OPENSSL_EXTRA and OPENSSL_COEXIST defined, and this is not something we support. Do you have both of these macros defined?

Thanks, Lealem @ wolfSSL