Skip to content

Commit 774573b

Browse files
committed
Address PR review comments
- Use $(DefaultPlatformToolset) in vcxproj instead of hard-coded v145 - Remove toolset detection step from Windows CI (no longer needed) - Disable Python tests when Python 3 not found instead of failing build - Add -noservername flag to s_client (SNI on by default, matching openssl) - Fix wolfclu_test.py paths to be __file__-relative for location independence - Add trailing newline to pkcs12 stdin password inputs - Redirect s_server stdout/stderr to DEVNULL to prevent pipe deadlock
1 parent f5d97d0 commit 774573b

9 files changed

Lines changed: 35 additions & 29 deletions

File tree

.github/workflows/windows-check.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,12 @@ jobs:
3232
- name: Replace user_settings.h
3333
run: cp wolfclu/ide/winvs/user_settings.h wolfssl/IDE/WIN/user_settings.h
3434

35-
- name: Detect platform toolset
36-
id: toolset
37-
run: |
38-
$major = (vswhere -latest -property installationVersion).Split('.')[0]
39-
$ts = @{ "16" = "v142"; "17" = "v143"; "18" = "v144" }[$major]
40-
echo "value=$ts" >> $env:GITHUB_OUTPUT
41-
4235
- name: Build wolfSSL
43-
run: msbuild /m /p:PlatformToolset=${{ steps.toolset.outputs.value }} /p:Platform=${{ env.BUILD_PLATFORM }} /p:Configuration=${{ env.BUILD_CONFIGURATION }} wolfssl/wolfssl64.sln
36+
run: msbuild /m /p:Platform=${{ env.BUILD_PLATFORM }} /p:Configuration=${{ env.BUILD_CONFIGURATION }} wolfssl/wolfssl64.sln
4437

4538
- name: Build wolfCLU
4639
working-directory: wolfclu
47-
run: msbuild /m /p:PlatformToolset=${{ steps.toolset.outputs.value }} /p:Platform=${{ env.BUILD_PLATFORM }} /p:Configuration=${{ env.BUILD_CONFIGURATION }} wolfclu.sln
40+
run: msbuild /m /p:Platform=${{ env.BUILD_PLATFORM }} /p:Configuration=${{ env.BUILD_CONFIGURATION }} wolfclu.sln
4841

4942
- name: Run tests
5043
working-directory: wolfclu

Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ man_MANS+= manpages/wolfssl.1
4848

4949
include src/include.am
5050
include wolfclu/include.am
51+
if HAVE_PYTHON
5152
include tests/dh/include.am
5253
include tests/dsa/include.am
5354
include tests/pkey/include.am
@@ -65,6 +66,7 @@ include tests/bench/include.am
6566
include tests/client/include.am
6667
include tests/server/include.am
6768
include tests/testEncDec/include.am
69+
endif
6870
include ide/include.am
6971
#####include data/include.am
7072

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ AC_PROG_MAKE_SET
5757
AM_PROG_CC_C_O
5858
AM_PATH_PYTHON([3.0],, [:])
5959
AC_SUBST([PYTHON])
60+
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"])
6061

6162
# Checks for headers/libraries
6263
AC_CHECK_HEADERS([sys/time.h string.h termios.h unistd.h])

src/client/clu_client_setup.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static const struct option client_options[] = {
3535
{"-CAfile", required_argument, 0, WOLFCLU_CAFILE },
3636
{"-verify_return_error", no_argument, 0, WOLFCLU_VERIFY_RETURN_ERROR},
3737
{"-disable_stdin_check", no_argument, 0, WOLFCLU_DISABLE_STDINCHK },
38+
{"-noservername", no_argument, 0, WOLFCLU_NOSERVERNAME },
3839
{"-help", no_argument, 0, WOLFCLU_HELP },
3940
{"-h", no_argument, 0, WOLFCLU_HELP },
4041

@@ -54,7 +55,8 @@ static void wolfCLU_ClientHelp(void)
5455
WOLFCLU_LOG(WOLFCLU_L0, "\t-starttls <proto, i.e. smtp>");
5556
WOLFCLU_LOG(WOLFCLU_L0, "\t-CAfile <ca file name>");
5657
WOLFCLU_LOG(WOLFCLU_L0, "\t-verify_return_error close connection on verification error");
57-
WOLFCLU_LOG(WOLFCLU_L0, "\t-disable_stdin_check ")
58+
WOLFCLU_LOG(WOLFCLU_L0, "\t-disable_stdin_check ");
59+
WOLFCLU_LOG(WOLFCLU_L0, "\t-noservername do not send Server Name Indication");
5860
}
5961

6062
static const char hostFlag[] = "-h";
@@ -100,6 +102,7 @@ int wolfCLU_Client(int argc, char** argv)
100102
int idx = 0;
101103
/* Don't verify peer by default (same as OpenSSL). */
102104
int verify = 0;
105+
int noservername = 0;
103106
char* ipv6 = NULL;
104107

105108
int clientArgc = 0;
@@ -195,8 +198,9 @@ int wolfCLU_Client(int argc, char** argv)
195198
}
196199
}
197200

198-
/* Set SNI hostname so modern servers accept the connection */
199-
if (ret == WOLFCLU_SUCCESS && host != NULL) {
201+
/* Set SNI hostname so modern servers accept the connection.
202+
* Matches openssl s_client default; use -noservername to disable. */
203+
if (ret == WOLFCLU_SUCCESS && host != NULL && !noservername) {
200204
ret = _addClientArg(clientArgv, sniFlag, &clientArgc);
201205
if (ret == WOLFCLU_SUCCESS) {
202206
ret = _addClientArg(clientArgv, host, &clientArgc);
@@ -234,6 +238,10 @@ int wolfCLU_Client(int argc, char** argv)
234238
&clientArgc);
235239
}
236240
break;
241+
242+
case WOLFCLU_NOSERVERNAME:
243+
noservername = 1;
244+
break;
237245
case WOLFCLU_HELP:
238246
wolfCLU_ClientHelp();
239247
return WOLFCLU_SUCCESS;

tests/pkcs/pkcs12-test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_nocerts(self):
4040
r = subprocess.run(
4141
[WOLFSSL_BIN, "pkcs12", "-nodes", "-nocerts",
4242
"-passin", "stdin", "-passout", "pass:", "-in", P12_FILE],
43-
input=b"wolfSSL test", capture_output=True, text=False,
43+
input=b"wolfSSL test\n", capture_output=True, text=False,
4444
timeout=60,
4545
)
4646
self.assertEqual(r.returncode, 0, r.stderr)
@@ -50,7 +50,7 @@ def test_nokeys(self):
5050
r = subprocess.run(
5151
[WOLFSSL_BIN, "pkcs12", "-nokeys",
5252
"-passin", "stdin", "-passout", "pass:", "-in", P12_FILE],
53-
input=b"wolfSSL test", capture_output=True, text=False,
53+
input=b"wolfSSL test\n", capture_output=True, text=False,
5454
timeout=60,
5555
)
5656
self.assertEqual(r.returncode, 0, r.stderr)
@@ -65,7 +65,7 @@ def test_nocerts_with_passout(self):
6565
r = subprocess.run(
6666
[WOLFSSL_BIN, "pkcs12", "-passin", "stdin", "-passout", "pass:",
6767
"-in", P12_FILE, "-nocerts"],
68-
input=b"wolfSSL test", capture_output=True, text=False,
68+
input=b"wolfSSL test\n", capture_output=True, text=False,
6969
timeout=60,
7070
)
7171
self.assertEqual(r.returncode, 0, r.stderr)

tests/server/server-test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_server_client(self):
3636
"-key", os.path.join(CERTS_DIR, "server-key.pem"),
3737
"-cert", os.path.join(CERTS_DIR, "server-cert.pem"),
3838
"-noVerify", "-readyFile", readyfile],
39-
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
39+
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
4040
stdin=subprocess.DEVNULL,
4141
)
4242

@@ -64,8 +64,6 @@ def test_server_client(self):
6464
finally:
6565
server.terminate()
6666
server.wait(timeout=5)
67-
server.stdout.close()
68-
server.stderr.close()
6967

7068

7169
if __name__ == "__main__":

tests/wolfclu_test.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44
import platform
55
import subprocess
66

7+
_TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
8+
_PROJECT_ROOT = os.path.dirname(_TESTS_DIR)
9+
710

811
def _find_wolfssl_bin():
912
"""Locate the wolfssl binary, searching common build output paths."""
1013
if platform.system() == "Windows":
1114
candidates = [
12-
os.path.join(".", "x64", "Debug", "wolfssl.exe"),
13-
os.path.join(".", "x64", "Release", "wolfssl.exe"),
14-
os.path.join(".", "Debug", "wolfssl.exe"),
15-
os.path.join(".", "Release", "wolfssl.exe"),
16-
os.path.join(".", "wolfssl.exe"),
15+
os.path.join(_PROJECT_ROOT, "x64", "Debug", "wolfssl.exe"),
16+
os.path.join(_PROJECT_ROOT, "x64", "Release", "wolfssl.exe"),
17+
os.path.join(_PROJECT_ROOT, "Debug", "wolfssl.exe"),
18+
os.path.join(_PROJECT_ROOT, "Release", "wolfssl.exe"),
19+
os.path.join(_PROJECT_ROOT, "wolfssl.exe"),
1720
]
1821
else:
1922
candidates = [
20-
os.path.join(".", "wolfssl"),
23+
os.path.join(_PROJECT_ROOT, "wolfssl"),
2124
]
2225

2326
for path in candidates:
@@ -29,7 +32,7 @@ def _find_wolfssl_bin():
2932

3033

3134
WOLFSSL_BIN = _find_wolfssl_bin()
32-
CERTS_DIR = os.path.join(".", "certs")
35+
CERTS_DIR = os.path.join(_PROJECT_ROOT, "certs")
3336

3437

3538
def run_wolfssl(*args, stdin_data=None, timeout=60):

wolfCLU.vcxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@
2828
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2929
<ConfigurationType>Application</ConfigurationType>
3030
<UseDebugLibraries>true</UseDebugLibraries>
31-
<PlatformToolset>v145</PlatformToolset>
31+
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
3232
</PropertyGroup>
3333
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
3434
<ConfigurationType>Application</ConfigurationType>
3535
<UseDebugLibraries>false</UseDebugLibraries>
36-
<PlatformToolset>v145</PlatformToolset>
36+
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
3737
</PropertyGroup>
3838
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
3939
<ConfigurationType>Application</ConfigurationType>
4040
<UseDebugLibraries>true</UseDebugLibraries>
41-
<PlatformToolset>v145</PlatformToolset>
41+
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
4242
</PropertyGroup>
4343
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4444
<ConfigurationType>Application</ConfigurationType>
4545
<UseDebugLibraries>false</UseDebugLibraries>
46-
<PlatformToolset>v145</PlatformToolset>
46+
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
4747
</PropertyGroup>
4848
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
4949
<ImportGroup Label="ExtensionSettings">

wolfclu/clu_optargs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ enum {
114114
WOLFCLU_CHECK,
115115
WOLFCLU_VERIFY_RETURN_ERROR,
116116
WOLFCLU_DISABLE_STDINCHK,
117+
WOLFCLU_NOSERVERNAME,
117118
WOLFCLU_NOCRYPT,
118119
WOLFCLU_TOPKCS8,
119120
};

0 commit comments

Comments
 (0)