[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
cron2 has uploaded a new patch set (#10) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe Acked-by: Gert Doering Message-Id: <20240116214152.27316-1-g...@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28028.html Signed-off-by: Gert Doering --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 322 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/471/10 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51100c3..cc98813 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, ssl, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f370c3..6a1895a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,6 +595,7 @@ "test_packet_id" "test_pkt" "test_provider" +"test_ssl" ) if (WIN32) @@ -699,6 +700,32 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +tests/unit_tests/openvpn/mock_win32_execve.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/crypto.c +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/cryptoapi.c +src/openvpn/env_set.c +src/openvpn/mss.c +src/openvpn/mtu.c +src/openvpn/options_util.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/run_command.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_util.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/xkey_helper.c +src/openvpn/xkey_provider.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index cecf4dc..f81a10f 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -9,7 +9,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -69,6 +70,40 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(OPTIONAL_CRYPTO_LIBS) +ssl_testdriver_SOURCES = test_ssl.c mock_msg.c mock_msg.h \ + mock_management.c mock_ssl_dependencies.c mock_win32_execve.c \ + $(top_srcdir)/src/openvpn/argv.c \ + $(top_srcdir)/src/openvpn/base64.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/compat/compat-strsep.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/cryptoapi.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/mss.c \ + $(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/options_util.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/run_command.c \ +
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe Acked-by: Gert Doering Message-Id: <20240116214152.27316-1-g...@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28028.html Signed-off-by: Gert Doering --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 322 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51100c3..cc98813 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, ssl, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f370c3..6a1895a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,6 +595,7 @@ "test_packet_id" "test_pkt" "test_provider" +"test_ssl" ) if (WIN32) @@ -699,6 +700,32 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +tests/unit_tests/openvpn/mock_win32_execve.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/crypto.c +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/cryptoapi.c +src/openvpn/env_set.c +src/openvpn/mss.c +src/openvpn/mtu.c +src/openvpn/options_util.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/run_command.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_util.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/xkey_helper.c +src/openvpn/xkey_provider.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index cecf4dc..f81a10f 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -9,7 +9,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -69,6 +70,40 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(OPTIONAL_CRYPTO_LIBS) +ssl_testdriver_SOURCES = test_ssl.c mock_msg.c mock_msg.h \ + mock_management.c mock_ssl_dependencies.c mock_win32_execve.c \ + $(top_srcdir)/src/openvpn/argv.c \ + $(top_srcdir)/src/openvpn/base64.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/compat/compat-strsep.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/cryptoapi.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/mss.c \ + $(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/options_util.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/ssl_openssl.c \ + $(top_srcdir)/src/openvpn/ssl_mbedtls.c \ + $(top_srcdir)/src/openvpn/ssl_util.c \ + $(top_srcdir)/src/openvpn/ssl_verify_mbedtls.c \ +
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: flichtenheld, plaisthos. cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 9: Code-Review+2 (1 comment) Patchset: PS9: now it passes mingw/autoconf builds as well -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 9 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Comment-Date: Tue, 16 Jan 2024 21:41:25 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: cron2, flichtenheld, plaisthos. Hello cron2, flichtenheld, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email to look at the new patch set (#9). Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 322 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/471/9 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51100c3..cc98813 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, ssl, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f370c3..6a1895a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,6 +595,7 @@ "test_packet_id" "test_pkt" "test_provider" +"test_ssl" ) if (WIN32) @@ -699,6 +700,32 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +tests/unit_tests/openvpn/mock_win32_execve.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/crypto.c +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/cryptoapi.c +src/openvpn/env_set.c +src/openvpn/mss.c +src/openvpn/mtu.c +src/openvpn/options_util.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/run_command.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_util.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/xkey_helper.c +src/openvpn/xkey_provider.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index cecf4dc..f81a10f 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -9,7 +9,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -69,6 +70,40 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(OPTIONAL_CRYPTO_LIBS) +ssl_testdriver_SOURCES = test_ssl.c mock_msg.c mock_msg.h \ + mock_management.c mock_ssl_dependencies.c mock_win32_execve.c \ + $(top_srcdir)/src/openvpn/argv.c \ + $(top_srcdir)/src/openvpn/base64.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/compat/compat-strsep.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/cryptoapi.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/mss.c \ + $(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/options_util.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/ssl_openssl.c \ + $(top_srcdir)/src/openvpn/ssl_mbedtls.c \ + $(top_srcdir)/src/openvpn/ssl_util.c \ +
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: cron2, flichtenheld, plaisthos. Hello cron2, flichtenheld, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email to look at the new patch set (#8). Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 322 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/471/8 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51100c3..cc98813 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, ssl, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f370c3..6a1895a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,6 +595,7 @@ "test_packet_id" "test_pkt" "test_provider" +"test_ssl" ) if (WIN32) @@ -699,6 +700,32 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +tests/unit_tests/openvpn/mock_win32_execve.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/crypto.c +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/cryptoapi.c +src/openvpn/env_set.c +src/openvpn/mss.c +src/openvpn/mtu.c +src/openvpn/options_util.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/run_command.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_util.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/xkey_helper.c +src/openvpn/xkey_provider.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index cecf4dc..f410a78 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -9,7 +9,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -69,6 +70,40 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(OPTIONAL_CRYPTO_LIBS) +ssl_testdriver_SOURCES = test_ssl.c mock_msg.c mock_msg.h \ + mock_management.c mock_ssl_dependencies.c mock_win32_execve.c \ + $(top_srcdir)/src/openvpn/argv.c \ + $(top_srcdir)/src/openvpn/base64.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/compat/compat-strsep.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/cryptoapi.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/mss.c \ + $(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/options_util.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/ssl_openssl.c \ + $(top_srcdir)/src/openvpn/ssl_mbedtls.c \ + $(top_srcdir)/src/openvpn/ssl_util.c \ +
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: cron2, flichtenheld, plaisthos. Hello cron2, flichtenheld, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email to look at the new patch set (#7). Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 324 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/471/7 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51100c3..cc98813 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, ssl, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f370c3..b38e6ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,6 +595,7 @@ "test_packet_id" "test_pkt" "test_provider" +"test_ssl" ) if (WIN32) @@ -699,6 +700,33 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +tests/unit_tests/openvpn/mock_win32_execve.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/block_dns.c +src/openvpn/crypto.c +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/cryptoapi.c +src/openvpn/env_set.c +src/openvpn/mss.c +src/openvpn/mtu.c +src/openvpn/options_util.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/run_command.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_util.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/xkey_helper.c +src/openvpn/xkey_provider.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index cecf4dc..638aaed 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -9,7 +9,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -69,6 +70,41 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(OPTIONAL_CRYPTO_LIBS) +ssl_testdriver_SOURCES = test_ssl.c mock_msg.c mock_msg.h \ + mock_management.c mock_ssl_dependencies.c mock_win32_execve.c \ + $(top_srcdir)/src/openvpn/argv.c \ + $(top_srcdir)/src/openvpn/base64.c \ + $(top_srcdir)/src/openvpn/block_dns.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/compat/compat-strsep.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/cryptoapi.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/mss.c \ + $(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/options_util.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/ssl_openssl.c \ + $(top_srcdir)/src/openvpn/ssl_mbedtls.c \ +
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: cron2, flichtenheld, plaisthos. Hello cron2, flichtenheld, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email to look at the new patch set (#6). The following approvals got outdated and were removed: Code-Review+2 by flichtenheld, Code-Review-1 by cron2 The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now. Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 325 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/471/6 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51100c3..cc98813 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, ssl, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f370c3..b38e6ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,6 +595,7 @@ "test_packet_id" "test_pkt" "test_provider" +"test_ssl" ) if (WIN32) @@ -699,6 +700,33 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +tests/unit_tests/openvpn/mock_win32_execve.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/block_dns.c +src/openvpn/crypto.c +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/cryptoapi.c +src/openvpn/env_set.c +src/openvpn/mss.c +src/openvpn/mtu.c +src/openvpn/options_util.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/run_command.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_util.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/xkey_helper.c +src/openvpn/xkey_provider.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index cecf4dc..35e25bb 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -9,7 +9,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -69,6 +70,42 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(OPTIONAL_CRYPTO_LIBS) +ssl_testdriver_SOURCES = test_ssl.c mock_msg.c mock_msg.h \ + mock_management.c mock_ssl_dependencies.c mock_win32_execve.c \ + $(top_srcdir)/src/openvpn/argv.c \ + $(top_srcdir)/src/openvpn/base64.c \ +$(top_srcdir)/src/openvpn/block_dns.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/compat/compat-strsep.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/cryptoapi.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/env_set.c \ +$(top_srcdir)/src/openvpn/mss.c \ +$(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/options_util.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ +
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: plaisthos. cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 5: Code-Review-1 (1 comment) Patchset: PS5: Something is weird here. The unit test passes on "unixy" platforms, and msbuild in GHA has no complaints (but might not build it either). mingw+cmake fails with an error related to pulling in wfp ``` [115/296] Linking C executable Debug/test_pkt.exe 364 [116/296] Building C object CMakeFiles/test_ssl.dir/Debug/src/openvpn/block_dns.c.obj 365 FAILED: CMakeFiles/test_ssl.dir/Debug/src/openvpn/block_dns.c.obj ``` while building autoconf-based mingw compiles the bits fine, and fails linking ``` CC ../../../src/openvpn/ssl_testdriver-xkey_helper.o CC ../../../src/openvpn/ssl_testdriver-ssl_util.o CC ../../../src/openvpn/ssl_testdriver-base64.o CC ../../../src/openvpn/ssl_testdriver-cryptoapi.o CCLD ssl_testdriver.exe /usr/bin/i686-w64-mingw32-ld: ../../../src/openvpn/ssl_testdriver-cryptoapi.o:cryptoapi.c:(.text+0x27c): undefined reference to `NCryptFreeObject@4' /usr/bin/i686-w64-mingw32-ld: ../../../src/openvpn/ssl_testdriver-cryptoapi.o:cryptoapi.c:(.text+0x2b2): undefined reference to `_imp__CertFreeCertificateContext@4' ... /usr/bin/i686-w64-mingw32-ld: ../../../src/openvpn/ssl_testdriver-cryptoapi.o:cryptoapi.c:(.text+0xf9a): undefined reference to `tls_libctx' ``` -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 5 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Tue, 16 Jan 2024 11:41:29 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: plaisthos. Hello cron2, flichtenheld, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email to look at the new patch set (#5). The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now. Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 311 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/471/5 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51100c3..cc98813 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, ssl, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index bc46c27..96328a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -592,6 +592,7 @@ "test_packet_id" "test_pkt" "test_provider" +"test_ssl" ) if (WIN32) @@ -696,6 +697,34 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +tests/unit_tests/openvpn/mock_win32_execve.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/block_dns.c +src/openvpn/crypto.c +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/cryptoapi.c +src/openvpn/env_set.c +src/openvpn/env_set.c +src/openvpn/mss.c +src/openvpn/mtu.c +src/openvpn/options_util.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/run_command.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_util.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/xkey_helper.c +src/openvpn/xkey_provider.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index cecf4dc..6667626 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -9,7 +9,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -69,6 +70,28 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ +ssl_testdriver_SOURCES = test_crypto.c mock_msg.c mock_msg.h \ + mock_management.c mock_ssl_dependencies.c mock_win32_execve.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/mss.c \ + $(top_srcdir)/src/openvpn/xkey_provider.c \ + $(top_srcdir)/src/openvpn/xkey_helper.c \ + $(top_srcdir)/src/openvpn/ssl_util.c \ + $(top_srcdir)/src/openvpn/base64.c \ + $(top_srcdir)/src/openvpn/cryptoapi.c + + packet_id_testdriver_CFLAGS = @TEST_CFLAGS@ \ -I$(top_srcdir)/include -I$(top_srcdir)/src/compat
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: plaisthos. cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 4: Code-Review+2 (1 comment) Patchset: PS4: Ah, now I understand where I got confused - this cannot be applied before #466, because otherwise there plainly is no backend function to call. Sorry for confusing everbody. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 4 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Sat, 06 Jan 2024 16:14:59 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: cron2. plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 3: (1 comment) Patchset: PS3: > this fails the GHA mingw builds with […] That is really strange. test_ssl.c includes ssl_verify_backend.h that defines that function. I need to see if I can reproduce this. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: cron2 Gerrit-Comment-Date: Tue, 02 Jan 2024 11:35:14 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: cron2 Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: plaisthos. cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) The change is no longer submittable: Code-Review is unsatisfied now. Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 3: Code-Review-2 (1 comment) Patchset: PS3: this fails the GHA mingw builds with ``` /home/runner/work/openvpn/openvpn/tests/unit_tests/openvpn/test_ssl.c: In function ‘crypto_pem_encode_certificate’: Error: /home/runner/work/openvpn/openvpn/tests/unit_tests/openvpn/test_ssl.c:112:5: error: implicit declaration of function ‘backend_x509_write_pem’ [-Werror=implicit-function-declaration] 112 | backend_x509_write_pem(cert, tmpfile); | ^~ cc1: all warnings being treated as errors ``` (see https://github.com/cron2/openvpn/actions/runs/7365003797/job/20045892888) so it can't go in yet. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Sat, 30 Dec 2023 16:00:04 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: plaisthos. flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 3: Code-Review+2 -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Mon, 18 Dec 2023 11:25:02 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: flichtenheld. plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 2: (3 comments) File tests/unit_tests/openvpn/Makefile.am: http://gerrit.openvpn.net/c/openvpn/+/471/comment/2bd17b5f_bc89de26 : PS2, Line 86: $(top_srcdir)/src/openvpn/xkey_provider.c \ > indent Done File tests/unit_tests/openvpn/mock_management.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/2c367b9e_17b39eb9 : PS2, Line 49: (void) man; > inconsistent (void), used it in one function, but not the other Done File tests/unit_tests/openvpn/test_ssl.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/1f8780a6_702527f1 : PS2, Line 47: /* Mock function to be allowed to include win32.c which is required for > You originally created win32-util. […] I didn't like the idea of pulling the dependency of msg() to that file. Currently that util file is standalone. I modified the approach to avoid that dependency. -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-Comment-Date: Wed, 13 Dec 2023 14:11:20 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: flichtenheld Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: flichtenheld, plaisthos. Hello flichtenheld, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Code-Review-1 by flichtenheld Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 311 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/471/3 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4393f5c..bdb30c8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, ssl, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cbee56..6ac453c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -588,6 +588,7 @@ "test_packet_id" "test_pkt" "test_provider" +"test_ssl" ) if (WIN32) @@ -697,6 +698,34 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +tests/unit_tests/openvpn/mock_win32_execve.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/block_dns.c +src/openvpn/crypto.c +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/cryptoapi.c +src/openvpn/env_set.c +src/openvpn/env_set.c +src/openvpn/mss.c +src/openvpn/mtu.c +src/openvpn/options_util.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/run_command.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_util.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/xkey_helper.c +src/openvpn/xkey_provider.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index ef45b11..eb8ccc8 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -7,7 +7,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -67,6 +68,28 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ +ssl_testdriver_SOURCES = test_crypto.c mock_msg.c mock_msg.h \ + mock_management.c mock_ssl_dependencies.c mock_win32_execve.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/mss.c \ + $(top_srcdir)/src/openvpn/xkey_provider.c \ + $(top_srcdir)/src/openvpn/xkey_helper.c \ + $(top_srcdir)/src/openvpn/ssl_util.c \ + $(top_srcdir)/src/openvpn/base64.c \ + $(top_srcdir)/src/openvpn/cryptoapi.c + + packet_id_testdriver_CFLAGS = @TEST_CFLAGS@ \ -I$(top_srcdir)/include -I$(top_srcdir)/src/compat
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: plaisthos. flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 2: Code-Review-1 (3 comments) File tests/unit_tests/openvpn/Makefile.am: http://gerrit.openvpn.net/c/openvpn/+/471/comment/0c7d5a64_4d9a9d5c : PS2, Line 86: $(top_srcdir)/src/openvpn/xkey_provider.c \ indent File tests/unit_tests/openvpn/mock_management.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/1c9c81df_b412d262 : PS2, Line 49: (void) man; inconsistent (void), used it in one function, but not the other File tests/unit_tests/openvpn/test_ssl.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/f87f0957_64554c69 : PS2, Line 47: /* Mock function to be allowed to include win32.c which is required for You originally created win32-util.c for the purpose of UT (see commit 5a571fb0f68ce6961cddfa495af2cedf3ee0e216). Maybe just move the win_get_tempdir to that? -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Tue, 12 Dec 2023 13:10:50 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: flichtenheld. plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 1: (6 comments) File CMakeLists.txt: http://gerrit.openvpn.net/c/openvpn/+/471/comment/0db70bef_074e855b : PS1, Line 560: "test_ssl" > Those are sorted alphabetically Done http://gerrit.openvpn.net/c/openvpn/+/471/comment/e741cdb3_5a0aaaff : PS1, Line 675: target_sources(test_ssl PRIVATE > also sorted alphabetically I sorted them like the other ones that include mock files and have the test/mock files first and not strictly alphabetical which would have put them at the end. File tests/unit_tests/openvpn/mock_management.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/5b10dbd9_9e007792 : PS1, Line 8: * Copyright (C) 2017-2021 Fox Crypto B.V. > Copy & paste error? Or intentional? Done File tests/unit_tests/openvpn/mock_ssl_dependencies.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/979d7c62_638080d7 : PS1, Line 8: * Copyright (C) 2017-2021 Fox Crypto B.V. > intentional? Done http://gerrit.openvpn.net/c/openvpn/+/471/comment/96b5a578_3c274b81 : PS1, Line 24: /* Minimal set of mocked management function/globals to get unit tests to > "management" is probably copy Done File tests/unit_tests/openvpn/test_ssl.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/8b19f7d6_6a5c48d6 : PS1, Line 8: * Copyright (C) 2016-2021 Fox Crypto B.V. > probably not intentional Done -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-Comment-Date: Mon, 11 Dec 2023 13:59:24 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: flichtenheld Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: plaisthos. flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/471?usp=email ) Change subject: Add test_ssl unit test and test export of PEM to file .. Patch Set 1: Code-Review-1 (6 comments) File CMakeLists.txt: http://gerrit.openvpn.net/c/openvpn/+/471/comment/7cbe21a6_5ded543e : PS1, Line 560: "test_ssl" Those are sorted alphabetically http://gerrit.openvpn.net/c/openvpn/+/471/comment/fb6707f8_9e4c3991 : PS1, Line 675: target_sources(test_ssl PRIVATE also sorted alphabetically File tests/unit_tests/openvpn/mock_management.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/013fb9b0_9685277c : PS1, Line 8: * Copyright (C) 2017-2021 Fox Crypto B.V. Copy & paste error? Or intentional? File tests/unit_tests/openvpn/mock_ssl_dependencies.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/e183659b_a49b0182 : PS1, Line 8: * Copyright (C) 2017-2021 Fox Crypto B.V. intentional? http://gerrit.openvpn.net/c/openvpn/+/471/comment/8366d424_83a92832 : PS1, Line 24: /* Minimal set of mocked management function/globals to get unit tests to "management" is probably copy File tests/unit_tests/openvpn/test_ssl.c: http://gerrit.openvpn.net/c/openvpn/+/471/comment/c8cca67b_59a239d1 : PS1, Line 8: * Copyright (C) 2016-2021 Fox Crypto B.V. probably not intentional -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Gerrit-Change-Number: 471 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Comment-Date: Fri, 08 Dec 2023 16:40:22 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [L] Change in openvpn[master]: Add test_ssl unit test and test export of PEM to file
Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/471?usp=email to review the following change. Change subject: Add test_ssl unit test and test export of PEM to file .. Add test_ssl unit test and test export of PEM to file This introduces a number of mock function to be able to compile ssl_verify_*.c and ssl_mbedtls.c/ssl_openssl.c into a unit and adds quite a number of files to that unit. But it allows similar unit tests (in term of dependencies) to be added in the future. Change-Id: Ie248d35d063bb6878f3dd42840c77ba0d6fa3381 Signed-off-by: Arne Schwabe --- M .github/workflows/build.yaml M CMakeLists.txt M tests/unit_tests/openvpn/Makefile.am A tests/unit_tests/openvpn/mock_management.c A tests/unit_tests/openvpn/mock_ssl_dependencies.c A tests/unit_tests/openvpn/test_ssl.c 6 files changed, 315 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/471/1 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4393f5c..39ecef9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -85,7 +85,7 @@ fail-fast: false matrix: arch: [x86, x64] -test: [argv, auth_token, buffer, cryptoapi, crypto, misc, ncp, packet_id, pkt, provider, tls_crypt] +test: [argv, auth_token, buffer, cryptoapi, crypto, ssl, misc, ncp, packet_id, pkt, provider, tls_crypt] runs-on: windows-latest name: "mingw unittest ${{ matrix.test }} - ${{ matrix.arch }} - OSSL" diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c24cca..24fd9cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -557,6 +557,7 @@ "test_auth_token" "test_buffer" "test_crypto" +"test_ssl" "test_misc" "test_ncp" "test_packet_id" @@ -671,6 +672,34 @@ src/openvpn/mss.c ) +target_sources(test_ssl PRIVATE +src/openvpn/crypto_mbedtls.c +src/openvpn/crypto_openssl.c +src/openvpn/ssl_openssl.c +src/openvpn/ssl_mbedtls.c +src/openvpn/ssl_verify_openssl.c +src/openvpn/ssl_verify_mbedtls.c +src/openvpn/crypto.c +src/openvpn/argv.c +src/openvpn/base64.c +src/openvpn/env_set.c +src/openvpn/run_command.c +src/openvpn/otime.c +src/openvpn/packet_id.c +src/openvpn/mtu.c +src/openvpn/mss.c +src/openvpn/env_set.c +src/openvpn/options_util.c +tests/unit_tests/openvpn/mock_management.c +tests/unit_tests/openvpn/mock_ssl_dependencies.c +src/openvpn/xkey_provider.c +src/openvpn/xkey_helper.c +src/openvpn/ssl_util.c +src/openvpn/cryptoapi.c +src/openvpn/win32.c +src/openvpn/block_dns.c +) + target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c src/openvpn/options_util.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index ef45b11..5d3eb70 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -7,7 +7,8 @@ endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver + pkt_testdriver ssl_testdriver + if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver @@ -67,6 +68,29 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/mss.c +ssl_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn +ssl_testdriver_LDFLAGS = @TEST_LDFLAGS@ +ssl_testdriver_SOURCES = test_crypto.c mock_msg.c mock_msg.h \ +mock_management.c mock_ssl_dependencies.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/mtu.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/mss.c \ +$(top_srcdir)/src/openvpn/xkey_provider.c \ +$(top_srcdir)/src/openvpn/xkey_helper.c \ +$(top_srcdir)/src/openvpn/ssl_util.c \ +$(top_srcdir)/src/openvpn/base64.c \ +$(top_srcdir)/src/openvpn/cryptoapi.c \ +$(top_srcdir)/src/openvpn/win32.c + + packet_id_testdriver_CFLAGS = @TEST_CFLAGS@ \ -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn packet_id_testdriver_LDFLAGS = @TEST_LDFLAGS@ diff --git