1. Rewrite GetString() and GetStringAlloc() in terms of GetStringRef().
2. Change GetStringRef() to allow for 0 length strings.
3. Update DoChannelRequest() to use GetStringAlloc() when reading the
modes from the packet.
Handle receive-before-send in wolfSSH_worker so window-adjust packets
are processed when the send path is back-pressured, preventing SFTP
stalls with small-window clients.
Add regression that forces WANT_WRITE/WANT_READ paths without relying
on a TTY to guard against deadlock.
Fixed ZD 20958
1. Always set the expected message right before sending. If the send
fails, it is either because the socket is closing, or it is wanting
to block. If it is wanting to block, we still want to check the next
message as expected.
1. Exclude the file regress.c from the Zephyr testing sample. The test
is covered in many other environments already. The test needs some
retooling to fit in with the Zephyr build, as it is a standalone
application with a main() function and it depends on a testing build
of libwolfssh.
2. Whitespace.
1. Add macro for logging an expected message.
2. Add an expected message ID to the HandshakeInfo.
3. Add a message ID for "none (0)".
4. Add a check in IsMessageAllowedClient() for the expected message ID.
Clear it if successful.
5. The KEXDH messages sent to the server have expected responses. Set
them if sending the message is successful.
6. Add the set of message ID ranges and macros for testing if a message
ID is in a specific range.
7. Add flags for having sent the kexinit message and received it. Tweak
the checks for isKeying and these flags.
8. IsMessageAllowedClient() to check for appropriate messages at the
appropriate time during the connect.
Historically, some systems have used <sys/errno.h> in place of <errno.h>, but the C standard,
all the way back to C89/Ansi C, specifies that the correct name is `errno.h` -
and most modern compilers create a sys/errno.h compatibility shim sys/errno.h -
but musl-gcc does not have this compatibility shim,
reasoning that sys/errno.h is non-standard, and fails to compile:
```
$ CC=musl-gcc ./configure --enable-static --disable-shared --enable-scp --enable-sftp --enable-shell --with-wolfssl=wolfssl/install-musl
(...)
$ make
make -j17 all-am
make[1]: Entering directory '/home/hans/projects/wolfssh'
CC examples/client/common.o
CC examples/client/client.o
CC src/libwolfssh_la-ssh.lo
CC src/libwolfssh_la-internal.lo
CC src/libwolfssh_la-log.lo
CC src/libwolfssh_la-port.lo
CC src/libwolfssh_la-io.lo
CC src/libwolfssh_la-wolfscp.lo
CC src/libwolfssh_la-wolfsftp.lo
CC examples/echoserver/echoserver.o
CC src/libwolfssh_la-wolfterm.lo
CC examples/sftpclient/sftpclient.o
CC examples/scpclient/scpclient.o
In file included from examples/echoserver/echoserver.c:91:
/usr/include/x86_64-linux-musl/sys/errno.h:1:2: error: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Werror=cpp]
1 | #warning redirecting incorrect #include <sys/errno.h> to <errno.h>
| ^~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1452: examples/echoserver/echoserver.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/hans/projects/wolfssh'
make: *** [Makefile:1020: all] Error 2
```
so, unless we need to support pre-C89 (35+ year old C) compilers,
we can just replace sys/errno.h with errno.h.
Instantiate a wolfSSH_AGENT_CTX before invoking wolfSSH_AGENT_SignRequest so the regression tests exercise the intended paths instead of failing with WS_AGENT_NULL_E.
Exercise agent write failures, non-signature responses, oversized signatures, and the happy path to cover the recent wolfSSH_AGENT_SignRequest hardening.
Track the last agent message id, reject non-signature replies, reset the failure flag, and ensure the agent write completes before trusting the returned signature.
Treat *sigSz as the caller-provided capacity, raise WS_BUFFER_E if the agent response is larger, and clear the size on failure to avoid buffer overruns.