Skip to content

Commit 4833238

Browse files
Merge pull request #726 from ejohnstown/release-v1.4.18
Prepare Release v1.4.18
2 parents 995a047 + a4f860d commit 4833238

File tree

10 files changed

+119
-49
lines changed

10 files changed

+119
-49
lines changed

ChangeLog.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,65 @@
1+
# wolfSSH v1.4.18 (July 20, 2024)
2+
3+
## New Features
4+
5+
- Add wolfSSL style static memory pool allocation support.
6+
- Add Ed25519 public key support.
7+
- Add Banner option to wolfSSHd configuration.
8+
- Add non-blocking socket support to the example SCP client.
9+
10+
## Improvements
11+
12+
- Documentation updates.
13+
- Update the Zephyr test action.
14+
- Add a no-filesystem build to the Zephyr port.
15+
- Update the macOS test action.
16+
- Refactor certificate processing. Only verify certificates when a signature
17+
is present.
18+
- Update the Kyber test action.
19+
- Refactor the Curve25519 Key Agreement support.
20+
- Update the STM32Cube Pack.
21+
- Increase the memory that Zephyr uses for a heap for testing.
22+
- Add a macro wrapper to replace the ReadDir function.
23+
- Add callback hook for keying completion.
24+
- Add function to return strings for the names of algorithms.
25+
- Add asynchronous server side user authentication.
26+
- Add ssh-rsa (SHA-1) to the default user auth algorithm list when
27+
sha1-soft-disable is disabled.
28+
- Update Espressif examples using Managed Components.
29+
- Add SCP test case.
30+
- Refactor RSA sign and verify.
31+
- Refresh the example echoserver with updates from wolfSSHd.
32+
- Add callback hooks for most channel messages including open, close, success,
33+
fail, and requests.
34+
- Reduce the number of memory allocations SCP makes.
35+
- Improve wolfSSHd’s behavior on closing a connection. It closes channels and
36+
waits for the peer to close the channels.
37+
38+
## Fixes
39+
40+
- Refactor wolfSSHd service support for Windows to fix PowerShell
41+
Write-Progress.
42+
- Fix partial success case with public key user authentication.
43+
- Fix the build guards with respect to cannedKeyAlgoNames.
44+
- Error if unable to open the local file when doing a SCP send.
45+
- Fix some IPv6 related build issues.
46+
- Add better checks for SCP error returns for closed channels.
47+
- In the example SCP client, move the public key check context after the
48+
WOLFSSH object is created.
49+
- Fix error reporting for wolfSSH_SFTP_STAT.
50+
- In the example SCP client, fix error code checking on shutdown.
51+
- Change return from wolfSSH_shutdown() to WS_CHANNEL_CLOSED.
52+
- Fix SFTP symlink handling.
53+
- Fix variable initialization warnings for Zephyr builds.
54+
- Fix wolfSSHd case of non-console output handles.
55+
- Fix testsuite for single threaded builds. Add single threaded test action.
56+
- Fix wolfSSHd shutting down on fcntl() failure.
57+
- Fix wolfSSHd on Windows handling virtual terminal sequences using exec
58+
commands.
59+
- Fix possible null dereference when matching MAC algos during key exchange.
60+
61+
---
62+
163
# wolfSSH v1.4.17 (March 25, 2024)
264

365
## Vulnerabilities

apps/wolfsshd/wolfsshd.c

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ typedef struct WOLFSSHD_CONNECTION {
110110
WOLFSSHD_AUTH* auth;
111111
int fd;
112112
int listenFd;
113-
char ip[INET_ADDRSTRLEN];
113+
char ip[INET6_ADDRSTRLEN];
114114
byte isThreaded;
115115
} WOLFSSHD_CONNECTION;
116116

@@ -151,6 +151,7 @@ static void SyslogCb(enum wolfSSH_LogLevel level, const char *const msgStr)
151151

152152
#ifdef _WIN32
153153
static void ServiceDebugCb(enum wolfSSH_LogLevel level, const char* const msgStr)
154+
#ifdef UNICODE
154155
{
155156
WCHAR* wc;
156157
size_t szWord = WSTRLEN(msgStr) + 3; /* + 3 for null terminator and new
@@ -170,7 +171,13 @@ static void ServiceDebugCb(enum wolfSSH_LogLevel level, const char* const msgStr
170171
}
171172
WOLFSSH_UNUSED(level);
172173
}
174+
#else
175+
{
176+
OutputDebugString(msgStr);
177+
WOLFSSH_UNUSED(level);
178+
}
173179
#endif
180+
#endif /* _WIN32 */
174181

175182
static void ShowUsage(void)
176183
{
@@ -674,7 +681,6 @@ static int SFTP_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
674681
}
675682

676683
if (ret == WS_SUCCESS) {
677-
r[rSz] = '\0';
678684
wolfSSH_Log(WS_LOG_INFO,
679685
"[SSHD] Using directory %s for SFTP connection", r);
680686
if (wolfSSH_SFTP_SetDefaultPath(ssh, r) != WS_SUCCESS) {
@@ -832,7 +838,6 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
832838

833839
/* @TODO check for conpty support LoadLibrary()and GetProcAddress(). */
834840

835-
836841
if (forcedCmd != NULL && WSTRCMP(forcedCmd, "internal-sftp") == 0) {
837842
wolfSSH_Log(WS_LOG_ERROR,
838843
"[SSHD] Only SFTP connections allowed for user "
@@ -912,6 +917,7 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
912917
if (ret == WS_SUCCESS) {
913918
SECURITY_ATTRIBUTES saAttr;
914919

920+
ZeroMemory(&saAttr, sizeof(saAttr));
915921
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
916922
saAttr.bInheritHandle = TRUE;
917923
saAttr.lpSecurityDescriptor = NULL;
@@ -926,28 +932,30 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
926932
}
927933

928934
if (ret == WS_SUCCESS) {
929-
STARTUPINFO si;
935+
STARTUPINFOW si;
930936
PCWSTR conCmd = L"wolfsshd.exe -r ";
931937
PWSTR conCmdPtr;
932-
int conCmdSz;
938+
size_t conCmdSz;
933939

934940
SetHandleInformation(ptyIn, HANDLE_FLAG_INHERIT, 0);
935941
SetHandleInformation(ptyOut, HANDLE_FLAG_INHERIT, 0);
936942

937943
wolfSSH_SetTerminalResizeCtx(ssh, (void*)&ptyIn);
938944

939-
conCmdSz = (int)(wcslen(conCmd) + cmdSz + 2); /* +1 for terminator */
940-
conCmdPtr = (PWSTR)WMALLOC(sizeof(wchar_t) * conCmdSz, NULL, DYNTYPE_SSHD);
945+
conCmdSz = wcslen(conCmd) + cmdSz + 3;
946+
/* +1 for terminator, +2 for quotes */
947+
conCmdPtr = (PWSTR)WMALLOC(sizeof(wchar_t) * conCmdSz,
948+
NULL, DYNTYPE_SSHD);
941949
if (conCmdPtr == NULL) {
942950
ret = WS_MEMORY_E;
943951
}
944952
else {
945-
memset(conCmdPtr, 0, conCmdSz * sizeof(wchar_t));
946-
_snwprintf(conCmdPtr, conCmdSz * sizeof(wchar_t), L"wolfsshd.exe -r \"%s\"", cmd);
953+
_snwprintf_s(conCmdPtr, conCmdSz, conCmdSz,
954+
L"wolfsshd.exe -r \"%s\"", cmd);
947955
}
948956

949-
ZeroMemory(&si, sizeof(STARTUPINFO));
950-
si.cb = sizeof(STARTUPINFO);
957+
ZeroMemory(&si, sizeof(si));
958+
si.cb = sizeof(si);
951959

952960
si.hStdInput = cnslIn;
953961
si.hStdOutput = cnslOut;
@@ -967,7 +975,6 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
967975
CloseHandle(cnslOut);
968976

969977
WFREE(conCmdPtr, NULL, DYNTYPE_SSHD);
970-
CloseHandle(processInfo.hThread);
971978
}
972979

973980
if (ret == WS_SUCCESS) {
@@ -2374,21 +2381,21 @@ static int StartSSHD(int argc, char** argv)
23742381
wolfSSH_Log(WS_LOG_ERROR, "[SSHD] Issue updating service status");
23752382
}
23762383
}
2377-
2378-
/* Create a stop event to watch on */
2379-
serviceStop = CreateEvent(NULL, TRUE, FALSE, NULL);
2380-
if (serviceStop == NULL) {
2381-
serviceStatus.dwControlsAccepted = 0;
2382-
serviceStatus.dwCurrentState = SERVICE_STOPPED;
2383-
serviceStatus.dwWin32ExitCode = GetLastError();
2384-
serviceStatus.dwCheckPoint = 1;
2385-
2386-
if (SetServiceStatus(serviceStatusHandle, &serviceStatus) == FALSE) {
2387-
wolfSSH_Log(WS_LOG_ERROR, "[SSHD] Issue updating service status");
2384+
if (ret == WS_SUCCESS) {
2385+
/* Create a stop event to watch on */
2386+
serviceStop = CreateEvent(NULL, TRUE, FALSE, NULL);
2387+
if (serviceStop == NULL) {
2388+
serviceStatus.dwControlsAccepted = 0;
2389+
serviceStatus.dwCurrentState = SERVICE_STOPPED;
2390+
serviceStatus.dwWin32ExitCode = GetLastError();
2391+
serviceStatus.dwCheckPoint = 1;
2392+
2393+
if (SetServiceStatus(serviceStatusHandle, &serviceStatus) == FALSE) {
2394+
wolfSSH_Log(WS_LOG_ERROR, "[SSHD] Issue updating service status");
2395+
}
2396+
return;
23882397
}
2389-
return;
23902398
}
2391-
23922399
if (cmdArgs != NULL) {
23932400
LocalFree(cmdArgs);
23942401
}
@@ -2550,8 +2557,8 @@ static int SetupConsole(char* inCmd)
25502557
HANDLE sOut;
25512558
HANDLE sIn;
25522559
HPCON pCon = 0;
2553-
COORD cord;
2554-
STARTUPINFOEX ext;
2560+
COORD cord = { 80,24 }; /* Default to 80x24. Updated later. */
2561+
STARTUPINFOEXW ext;
25552562
int ret = WS_SUCCESS;
25562563
PWSTR cmd = NULL;
25572564
size_t cmdSz = 0;
@@ -2564,10 +2571,6 @@ static int SetupConsole(char* inCmd)
25642571
return -1;
25652572
}
25662573

2567-
/* defautl 80x24 with setup, screen size will get set by VT command after started */
2568-
cord.X = 80;
2569-
cord.Y = 24;
2570-
25712574
sIn = GetStdHandle(STD_INPUT_HANDLE);
25722575

25732576
if (WSTRCMP(shellCmd, inCmd) != 0) {

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# All right reserved.
44

55
AC_COPYRIGHT([Copyright (C) 2014-2024 wolfSSL Inc.])
6-
AC_INIT([wolfssh],[1.4.17],[support@wolfssl.com],[wolfssh],[https://www.wolfssl.com])
6+
AC_INIT([wolfssh],[1.4.18],[support@wolfssl.com],[wolfssh],[https://www.wolfssl.com])
77
AC_PREREQ([2.63])
88
AC_CONFIG_AUX_DIR([build-aux])
99

@@ -18,7 +18,7 @@ AC_ARG_PROGRAM
1818
AC_CONFIG_MACRO_DIR([m4])
1919
AC_CONFIG_HEADERS([config.h])
2020

21-
WOLFSSH_LIBRARY_VERSION=16:0:9
21+
WOLFSSH_LIBRARY_VERSION=17:0:10
2222
# | | |
2323
# +-----+ | +----+
2424
# | | |
@@ -313,7 +313,7 @@ AM_CONDITIONAL([BUILD_KEYGEN],[test "x$ENABLED_KEYGEN" = "xyes"])
313313
AM_CONDITIONAL([BUILD_SCP],[test "x$ENABLED_SCP" = "xyes"])
314314
AM_CONDITIONAL([BUILD_SFTP],[test "x$ENABLED_SFTP" = "xyes"])
315315
AM_CONDITIONAL([BUILD_FWD],[test "x$ENABLED_FWD" = "xyes"])
316-
AM_CONDITIONAL([BUILD_TERM],[test "x$ENABLED_PTERM" = "xyes"])
316+
AM_CONDITIONAL([BUILD_TERM],[test "x$ENABLED_TERM" = "xyes"])
317317
AM_CONDITIONAL([BUILD_SHELL],[test "x$ENABLED_SHELL" = "xyes"])
318318
AM_CONDITIONAL([BUILD_AGENT],[test "x$ENABLED_AGENT" = "xyes"])
319319
AM_CONDITIONAL([BUILD_SSHD],[test "x$ENABLED_SSHD" = "xyes"])

examples/echoserver/echoserver.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,21 +1609,19 @@ static int load_file(const char* fileName, byte* buf, word32* bufSz)
16091609
fileSz = (word32)WFTELL(NULL, file);
16101610
WREWIND(NULL, file);
16111611

1612-
if (fileSz > *bufSz) {
1613-
if (buf == NULL)
1614-
*bufSz = fileSz;
1612+
if (buf == NULL || fileSz > *bufSz) {
1613+
*bufSz = fileSz;
16151614
WFCLOSE(NULL, file);
16161615
return 0;
16171616
}
16181617

16191618
readSz = (word32)WFREAD(NULL, buf, 1, fileSz, file);
1619+
WFCLOSE(NULL, file);
1620+
16201621
if (readSz < fileSz) {
1621-
WFCLOSE(NULL, file);
1622-
return 0;
1622+
fileSz = 0;
16231623
}
16241624

1625-
WFCLOSE(NULL, file);
1626-
16271625
return fileSz;
16281626
}
16291627
#endif /* NO_FILESYSTEM */

scripts/scp.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ create_port
141141
./examples/scpclient/wolfscp -u jill -P upthehill -p $port -L $PWD/does-not-exist:$PWD/empty
142142
RESULT=$?
143143
remove_ready_file
144+
rm -f $PWD/scripts/empty
144145

145146
if test $RESULT -eq 0; then
146147
echo -e "\n\nshould fail out sending a file that does not exist"

src/wolfsftp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4538,9 +4538,9 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr,
45384538

45394539
atr->flags |= WOLFSSH_FILEATRB_PERM;
45404540
atr->per = 0555 |
4541-
(stats.dwFileAttributes | FILE_ATTRIBUTE_READONLY ? 0 : 0200);
4542-
atr->per |= (stats.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? 0x4000:
4543-
FILEATRB_PER_FILE;
4541+
((stats.dwFileAttributes | FILE_ATTRIBUTE_READONLY) ? 0 : 0200);
4542+
atr->per |= ((stats.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
4543+
? FILEATRB_PER_DIR : FILEATRB_PER_FILE);
45444544

45454545
#if 0
45464546
/* @TODO handle the constellation of possible Windows FILETIMEs */

tests/api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <wolfssl/options.h>
2929
#endif
3030
#include <wolfssl/wolfcrypt/wc_port.h>
31+
#include <wolfssh/port.h>
3132

3233
#include <stdio.h>
3334
#include <wolfssh/ssh.h>
@@ -955,7 +956,7 @@ static void test_wolfSSH_SFTP_SendReadPacket(void)
955956
func_args ser;
956957
tcp_ready ready;
957958
int argsCount;
958-
int clientFd;
959+
WS_SOCKET_T clientFd;
959960

960961
const char* args[10];
961962
WOLFSSH_CTX* ctx = NULL;
@@ -1066,7 +1067,7 @@ static void test_wolfSSH_SFTP_SendReadPacket(void)
10661067

10671068
/* close client socket down */
10681069
clientFd = wolfSSH_get_fd(ssh);
1069-
close(clientFd);
1070+
WCLOSESOCKET(clientFd);
10701071

10711072
wolfSSH_free(ssh);
10721073
wolfSSH_CTX_free(ctx);

tests/sftp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ int wolfSSH_SftpTest(int flag)
186186
int argsCount;
187187

188188
const char* args[10];
189+
#ifndef USE_WINDOWS_API
189190
char portNumber[8];
191+
#endif
190192

191193
THREAD_TYPE serThread;
192194

wolfssh/test.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221

222222
#ifdef USE_WINDOWS_API
223223
#define WCLOSESOCKET(s) closesocket(s)
224-
#define WSTARTTCP() do { WSADATA wsd; WSAStartup(0x0002, &wsd); } while(0)
224+
#define WSTARTTCP() do { WSADATA wsd; (void)WSAStartup(0x0002, &wsd); } while(0)
225225
#elif defined(MICROCHIP_TCPIP) || defined(MICROCHIP_MPLAB_HARMONY)
226226
#ifdef MICROCHIP_MPLAB_HARMONY
227227
#define WCLOSESOCKET(s) TCPIP_TCP_Close((s))
@@ -1136,6 +1136,9 @@ static int Base16_Decode(const byte* in, word32 inLen,
11361136
word32 inIdx = 0;
11371137
word32 outIdx = 0;
11381138

1139+
if (in == NULL || out == NULL || outLen == NULL)
1140+
return WS_BAD_ARGUMENT;
1141+
11391142
if (inLen == 1 && *outLen && in) {
11401143
byte b = in[inIdx] - 0x30; /* 0 starts at 0x30 */
11411144

wolfssh/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
extern "C" {
3636
#endif
3737

38-
#define LIBWOLFSSH_VERSION_STRING "1.4.17"
39-
#define LIBWOLFSSH_VERSION_HEX 0x01004017
38+
#define LIBWOLFSSH_VERSION_STRING "1.4.18"
39+
#define LIBWOLFSSH_VERSION_HEX 0x01004018
4040

4141
#ifdef __cplusplus
4242
}

0 commit comments

Comments
 (0)