Skip to contentSkip to conversation

wolfssl: include "ssl.h" by "src/openvpn/ssl.h"

PATCH NAK Juliusz Sosinowicz 4 participants 8 messages Feb 9, 2024 – Feb 12, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wolfssl: include "ssl.h" by "src/openvpn/ssl.h"

Including "ssl.h" conflicts with the wolfSSL ssl.h header file. The include/wolfssl directory is included before openvpn/src. include/wolfssl needs to be included so that openvpn can pick up wolfSSL compatibility headers instead of OpenSSL headers without changing the paths.

---
 src/openvpn/auth_token.c                         | 2 +-
 src/openvpn/dco_linux.c                          | 2 +-
 src/openvpn/manage.c                             | 2 +-
 src/openvpn/openvpn.h                            | 2 +-
 src/openvpn/options.c                            | 2 +-
 src/openvpn/ps.h                                 | 2 +-
 src/openvpn/push.c                               | 2 +-
 src/openvpn/ssl.c                                | 2 +-
 src/openvpn/tls_crypt.c                          | 2 +-
 tests/unit_tests/openvpn/mock_ssl_dependencies.c | 2 +-
 tests/unit_tests/openvpn/test_pkcs11.c           | 2 +-
 tests/unit_tests/openvpn/test_ssl.c              | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)
src/openvpn/auth_token.c +1 -1
index 6787ea7d..e020bdcb 100644
@@ -12,7 +12,7 @@
 #include "auth_token.h"
 #include "push.h"
 #include "integer.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "ssl_verify.h"
 #include <inttypes.h>
 
src/openvpn/dco_linux.c +1 -1
index 3c91606b..eac81924 100644
@@ -37,7 +37,7 @@
 
 #include "socket.h"
 #include "tun.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "fdmisc.h"
 #include "multi.h"
 #include "ssl_verify.h"
src/openvpn/manage.c +1 -1
index 27b6f90e..11c922c5 100644
@@ -37,7 +37,7 @@
 #include "otime.h"
 #include "integer.h"
 #include "misc.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "common.h"
 #include "manage.h"
 #include "openvpn.h"
src/openvpn/openvpn.h +1 -1
index dabc5be4..3a3d1733 100644
@@ -28,7 +28,7 @@
 #include "options.h"
 #include "socket.h"
 #include "crypto.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "packet_id.h"
 #include "comp.h"
 #include "tun.h"
src/openvpn/options.c +1 -1
index 2c79a1ec..cb06063e 100644
@@ -42,7 +42,7 @@
 #include "run_command.h"
 #include "shaper.h"
 #include "crypto.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "ssl_ncp.h"
 #include "options.h"
 #include "misc.h"
src/openvpn/ps.h +1 -1
index 2fe0c4c5..21427480 100644
@@ -28,7 +28,7 @@
 
 #include "basic.h"
 #include "buffer.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 
 typedef void (*post_fork_cleanup_func_t)(void *arg);
 
src/openvpn/push.c +1 -1
index 22494340..854bf471 100644
@@ -29,7 +29,7 @@
 
 #include "push.h"
 #include "options.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "ssl_verify.h"
 #include "ssl_ncp.h"
 #include "manage.h"
src/openvpn/ssl.c +1 -1
index 33c86704..ac077a1c 100644
@@ -54,7 +54,7 @@
 #include "route.h"
 #include "tls_crypt.h"
 
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "ssl_verify.h"
 #include "ssl_backend.h"
 #include "ssl_ncp.h"
src/openvpn/tls_crypt.c +1 -1
index 975d31fa..3df2bc61 100644
@@ -33,7 +33,7 @@
 #include "platform.h"
 #include "run_command.h"
 #include "session_id.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 
 #include "tls_crypt.h"
 
tests/unit_tests/openvpn/mock_ssl_dependencies.c +1 -1
index 9231d655..da22bbfe 100644
@@ -34,7 +34,7 @@
 #include <cmocka.h>
 
 
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "ssl_verify.h"
 
 int
tests/unit_tests/openvpn/test_pkcs11.c +1 -1
index 81cdf882..76cb80e5 100644
@@ -33,7 +33,7 @@
 #include "xkey_common.h"
 #include "cert_data.h"
 #include "pkcs11.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 
 #include <setjmp.h>
 #include <cmocka.h>
tests/unit_tests/openvpn/test_ssl.c +1 -1
index 8c1fb5b2..893bf8ec 100644
@@ -44,7 +44,7 @@
 #include "ssl_verify_backend.h"
 #include "win32.h"
 #include "test_common.h"
-#include "ssl.h"
+#include "src/openvpn/ssl.h"
 #include "buffer.h"
 #include "packet_id.h"
 
Signature · 1 line
2.34.1
#1 lore raw

Hi,

Quoted 1 line · Juliusz Sosinowicz

Including "ssl.h" conflicts with the wolfSSL ssl.h header file. The include/wolfssl directory is included before openvpn/src. include/wolfssl needs to be included so that openvpn can pick up wolfSSL compatibility headers instead of OpenSSL headers without changing the paths.

NAK.

All our local includes are included without path, so we're not starting "full path" for a single include now.

If this conflicts with WolfSSL, I'd be willing to consider a Makefile patch that puts WolfSSL includes behind openvpn/src (so our ssl.h is picked first).

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#2 lore raw
In reply to Juliusz Sosinowicz
Quoted 1 line · Juliusz Sosinowicz

Including "ssl.h" conflicts with the wolfSSL ssl.h header file. The include/wolfssl directory is included before openvpn/src. include/wolfssl needs to be included so that openvpn can pick up wolfSSL compatibility headers instead of OpenSSL headers without changing the paths.

This breaks out-of-tree builds. Currently we only add top_buildir to CFLAGS (for config.h) but NOT top_srcdir. For in-tree builds these are identical so the patch might appear to work. But it breaks otherwise. Further changes to buildsystem configuration would be required.

Regards,

Signature · 1 line
  Frank Lichtenheld
#3 lore raw

Hi Frank,

thank you for the explanation. I did not test out-of-tree builds before submitting the patch. I'll try to implement Gert's solution and write a Makefile patch instead.

Sincerely
Juliusz Sosinowicz

Quoted 8 lines · Frank Lichtenheld
Quoted 1 line · Juliusz Sosinowicz

Including "ssl.h" conflicts with the wolfSSL ssl.h header file. The include/wolfssl directory is included before openvpn/src. include/wolfssl needs to be included so that openvpn can pick up wolfSSL compatibility headers instead of OpenSSL headers without changing the paths.

This breaks out-of-tree builds. Currently we only add top_buildir to CFLAGS (for config.h) but NOT top_srcdir. For in-tree builds these are identical so the patch might appear to work. But it breaks otherwise. Further changes to buildsystem configuration would be required.

Regards,

#4 lore raw
In reply to Juliusz Sosinowicz

Am 09.02.24 um 16:51 schrieb Juliusz Sosinowicz:

Quoted 1 line

Including "ssl.h" conflicts with the wolfSSL ssl.h header file. The include/wolfssl directory is included before openvpn/src. include/wolfssl needs to be included so that openvpn can pick up wolfSSL compatibility headers instead of OpenSSL headers without changing the paths.

Neither the ssl.h (2005, so forever) in OpenVPN nor the ssl.h in wolfssl (2014 according to git blame) are particulary new. Why is this now a problem when it was never before?

Arne

#5 lore raw

Hi Arne,

commit 70b39f2bea9fd6e57f31e32b2041246731140cb2 has added the use of ACK_SIZE and RELIABLE_ACK_SIZE in test_ssl.c. These are defined in reliable.h which should be included through your ssl.h. Since our ssl.h is being picked up, these never get defined and make check results in the following error:

test_ssl.c: In function ‘init_frame_parameters’:
test_ssl.c:160:17: warning: implicit declaration of function ‘ACK_SIZE’ [-Wimplicit-function-declaration] 160 |     overhead += ACK_SIZE(RELIABLE_ACK_SIZE);
      |                 ^~~~~~~~
test_ssl.c:160:26: error: ‘RELIABLE_ACK_SIZE’ undeclared (first use in this function) 160 |     overhead += ACK_SIZE(RELIABLE_ACK_SIZE);
      |                          ^~~~~~~~~~~~~~~~~

Somehow, this has never come up as an issue.

Sincerely
Juliusz Sosinowicz

Quoted 7 lines · Arne Schwabe

Am 09.02.24 um 16:51 schrieb Juliusz Sosinowicz:

Quoted 1 line

Including "ssl.h" conflicts with the wolfSSL ssl.h header file. The include/wolfssl directory is included before openvpn/src. include/wolfssl needs to be included so that openvpn can pick up wolfSSL compatibility headers instead of OpenSSL headers without changing the paths.

Neither the ssl.h (2005, so forever) in OpenVPN nor the ssl.h in wolfssl (2014 according to git blame) are particulary new. Why is this now a problem when it was never before?

Arne

#6 lore raw

Hi,

Quoted 5 lines · Juliusz Sosinowicz

commit 70b39f2bea9fd6e57f31e32b2041246731140cb2 has added the use of ACK_SIZE and RELIABLE_ACK_SIZE in test_ssl.c. These are defined in reliable.h which should be included through your ssl.h. Since our ssl.h is being picked up, these never get defined and make check results in the following error:

Seems the unit test compile flags could use a bit of shuffling to have our local include first... and that should solve it (if nothing else breaks, just test_ssl.c)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#7 lore raw

Hi Gert,

that is the direction I went with the latest patch I sent over.

Sincerely
Juliusz Sosinowicz

Quoted 13 lines · Gert Doering

Hi,

Quoted 5 lines · Juliusz Sosinowicz

commit 70b39f2bea9fd6e57f31e32b2041246731140cb2 has added the use of ACK_SIZE and RELIABLE_ACK_SIZE in test_ssl.c. These are defined in reliable.h which should be included through your ssl.h. Since our ssl.h is being picked up, these never get defined and make check results in the following error:

Seems the unit test compile flags could use a bit of shuffling to have our local include first... and that should solve it (if nothing else breaks, just test_ssl.c)

gert