- LoadRootCaPemBuffer() loads every block a PEM CA buffer holds as a
root CA, skipping the ones that fail. It returns WS_SUCCESS when
any loaded, WS_PARSE_E when all failed, and WS_BAD_FILE_E when the
buffer holds no block.
- A block runs header to footer with the next header capping the
footer search, so wc_PemToDer() gets the block rather than the rest
of the buffer. A header that nothing closes is skipped and the walk
resumes at its end; each form's header is re-sought only from
behind the one just read.
- A block takes the plain or the trusted form, whichever header leads
picking the type. FindInBuffer() searches a length-delimited
buffer, so an embedded NUL does not end the search.
- wolfSSH_ProcessBuffer() routes a PEM BUFTYPE_CA there and, like
DoPemCert(), gives WS_BAD_FILETYPE_E for the trusted form as a
certificate; SniffCertForm() reads its header as X.509 PEM.
- internal.h defines WOLFSSH_HAVE_TRUSTED_CERT_PEM under
WOLFSSH_CERTS with wolfSSL 5.8.0 or newer and declares
IsTrustedCertPem(); ssh.h documents the cert buffer calls.
- tests/api.c adds catBuffers(), makeTrustedPem() and
assertCaInstalled(), with tests for the bundle, trusted file and
trusted ReadCert paths.
- Assemble the split offset with wResolveOffset() in the Harmony wPread
and wPwrite, and seek with the resolved value.
- Assemble the split offset with wResolveOffset() in the Zephyr wPread
and wPwrite, and seek with the resolved value.
- Define WOLFSSH_MAX_FILE_OFFSET as 0x7FFFFFFF in the Harmony block, so
the ceiling comes from SYS_FS_FileSeek's int32_t offset rather than
from off_t.
- Add test_PreadPwriteOffsetCeiling() covering ports whose seek type
cannot reach 4 GiB, including a read back at an in-range offset.
- Add test_ResolveOffset() covering offset assembly, both sides of the
ceiling, and the NULL guards.
Issue: F-8823
- test.h's static Base16_Decode collides with wolfSSL's public one
when coding.h lands first, breaking --enable-tpm builds.
- Include coding.h in test.h, keeping the local copy only when
WOLFSSL_BASE16 is absent; --enable-wolfssh alone does not set it.
- api.c includes coding.h too, dropping its hand-declared
Base64_Encode_NoNl, which would now be a duplicate.
- No job compiled a wolfSSH test binary with WOLFSSH_TPM defined, so a
test guarded on it compiled out everywhere and could not gate a
merge. This job enables TPM but only builds; the jobs that run make
check do not enable it.
- Add a make check step. automake's check-am builds every check_PROGRAM
regardless of the TESTS override, so this is the only job that
compiles wolfSSH's tests with TPM support.
- Override TESTS to run only tests/api.test, the one suite with
TPM-specific tests. kex.test also aborts in the example client, which
demands -K in a TPM build.
- Restrict it to one matrix cell. The 2x2x2 matrix varies the simulator
and the host key, neither of which these tests touch.
- Assert -DWOLFSSH_TPM in AM_CPPFLAGS first. A build without it
compiles the guarded tests out and still exits 0, a hollow pass.
- Dump tests/api.log on failure and archive it.
- sftpclient passes userEcc to ClientUsePubKey(), and scpclient to
both ClientSetPrivateKey() and ClientUsePubKey(), in place of a
hardcoded 0.
- scpclient gains a userEcc; it and client default it to 1 under
WOLFSSH_NO_RSA, as sftpclient already did.
- ClientSetPrivateKey() and ClientUsePubKey() name the missing
algorithm on stderr and return WS_NOT_COMPILED when the built-in
key they select is compiled out.
- Both skip the built-in load entirely when neither RSA nor ECC is
compiled in, clearing the key size and type and returning success
so password-only authentication still runs. ClientUsePubKey()'s
buffer pointer moves inside the guard so it is not left unused.
Issue: F-8829
- keepOpen was hardcoded to 1, so the TERMINAL channel type was always
set right after EXEC, freeing the command and reverting to a shell.
- Derive keepOpen from whether a command was given.
- Gate MODES_CLEAR() the same way. A remote command runs with no pty,
so its LF terminated output needs OPOST left on.
- The SINGLE_THREADED guard is now unconditional, matching what it did
when keepOpen was always 1.
- Remove -N. It was parsed into config.noCommand and read nowhere, and
making it work needs a way to request no session at all.
- Add the optional command to the usage line.
- Reject a command of WOLFSSH_MAX_CHN_NAMESZ or longer. SetChannelType
discards it and still returns WS_SUCCESS, so the client would send an
exec request with no command string at all.
- Drop the I/O thread guard. With keepOpen derived from config.command,
the condition was true for every input.
Issue: F-8816
- The byte-count branch of HighwaterCheck() had no coverage. Exercise
the boundary at the mark, the once-per-epoch flag that keeps the
callback from firing a second time, the receive side, and a mark of
0 disabling the check.
Issue: F-6978
- DoUserAuthRequestEcc() skipped the curve name in the public key blob
and imported the point with wc_ecc_import_x963(), which picks the
curve from the point length, so the key did not have to be on the
curve the declared algorithm names.
- Derive the curve from pk->publicKeyType with NameToId() and
wcPrimeForId(), require the blob's curve name to equal
PrimeNameForId() for that id, and import with
wc_ecc_import_x963_ex() pinned to that curve.
- The import's error check sat outside the success guard, so it
rewrote any earlier error as WS_CRYPTO_FAILED. Scope it to the
import itself so the parse and algorithm-match errors keep their
own codes.
- Add test_EccUserAuthCurveMismatch, which offers a blob naming one
curve under another algorithm and expects the request to fail.
Issue: F-6979
- The callback is the client's only defense against a man in the
middle, and 0 accepts the server host key, so a stub that defaults
to "return 0" trusts whatever key is presented.
- State that the callback must match the key against a trust store,
and point at ClientPublicKeyCheck() in the examples.
- Record that with no callback registered the host key is rejected
with WS_PUBKEY_REJECTED_E.
Issue: F-6976
- WOLFSSH_USERAUTH_SUCCESS is 0, the same value as WS_SUCCESS and the
C "no error" idiom, so a bare "return 0", a forwarded WS_SUCCESS, or
a fall-through default of 0 silently authenticates the client.
- Spell out that the callback must fail closed: return
WOLFSSH_USERAUTH_FAILURE for any authType or code path it does not
explicitly handle.
- Note that for WOLFSSH_USERAUTH_PUBLICKEY the library verifies the
signature but not the key's authorization, so the callback has to
check the offered key against the user's authorized keys.
Issue: F-6815
- IsMessageAllowedClient() gated the post-userauth rejection on
connectState >= CONNECT_KEYED, so every state below it allowed
msgid 80 and above.
- A client in the pre-key-exchange DoReceive() loops accepted an
unencrypted CHANNEL_OPEN, created the channel and replied with
CHANNEL_OPEN_CONF.
- Add a state sweep over the connection-protocol range and a full
DoReceive() of a plaintext CHANNEL_OPEN from a pre-auth state.
Issue: F-7628
- read TCPIP_TCP_PutIsReady() before comparing, and cast so the
clamp is not a signed/unsigned comparison
- no behaviour change, the API returns uint16_t
Issue: F-7509
- cover the ID_OSSH_CERT_* key IDs in wolfSSH_KEY_clean
- zeroize the key signature struct before freeing it
- add a unit test for the RSA OpenSSH-certificate ID
Issue: F-7519
- store select()'s result in an int so an error is not read
as a large positive count
- retry on EINTR, bail out on any other error
- re-arm the descriptor sets on every pass
Issue: F-7508
- zero the response arrays and stop filling after the first
failed read, tracking only the slots populated
- release the previous round's responses on each INFO_REQUEST
- add auth.test coverage for EOF stdin and a second round
Issue: F-7515, F-7516
- fail ParseCertChain when the peer sends a zero cert count
- only set isCert when a leaf was actually parsed
- add a ParseLeafCert test hook and zero-count unit test
Issue: F-7517
- add ChannelRequestIs() comparing the type length as well
- use it for all nine handled request types, so truncated,
empty and NUL-padded types are rejected
- cover "sh", "sub", empty and "shell\0AAAA" in unit tests
Issue: F-7217
- gate the multi-block loop on ret so the first wc_HashFinal
result is not discarded
- add a SHA-256 two-block key expansion known-answer test
Issue: F-7507
- handleSz is the handle buffer size going into wolfSSH_SFTP_Open(), so
a failed open left it non-zero and STATE_PUT_CLOSE_REMOTE closed a
zeroed handle for a file that was never opened.
- The stray close overwrote ret and ssh->error, hiding the real cause.
Without WOLFSSH_SMALL_STACK dCert is the address of a stack variable, so
the NULL check could never fire. Keep the check under the small stack
build where the WMALLOC can actually fail.
Issue: CID-573006
The drain after waitpid ignored the send return, so on a non-blocking
socket the tail of a command's output was dropped on a full window, a
rekey or a would block. Retry a bounded number of times and log when
the data still can not be sent.
Issue: CID-572907
The leftover-data drain after waitpid ignored both fcntl calls. Check
the get and the set, and skip the drain read for a pipe that could not
be made non-blocking so the read cannot hang the connection process.
Issue: CID-572931
The loop condition already guarantees a want-read or want-write error,
so the select_ret arms of the retry test and the else chain could never
run. Retry unconditionally; tcp_select still throttles the loop. Same
change applied to the copy in apps/wolfssh/wolfssh.c.
Issue: CID-572884
Both loop exits in readInput() returned early, leaving the per-thread
ECC cache cleanup after the loop unreachable. Break out of the loop
instead.
wolfSSH_stream_send() reports a rekey in progress by returning
WS_FATAL_ERROR with the ssh error set to WS_REKEYING, so testing the
return value against WS_REKEYING never matches. Read the code with
wolfSSH_get_error() and resend the same buffer once the rekey
finishes, in both the app and the example client. Looping back to
read() instead would drop the input already taken from stdin.
Issue: CID-572833
The useAgent flag was never set, so both agent setup blocks in
wolfSSH_Client were dead code. Add the -a option to the parser and
carry it through the config struct, matching examples/client/client.c.
Issue: CID-572857