wolfssl/tests
Tobias Frauenschläger 16cc1f28bb Resume the TLS 1.3 certificate chain send after a WANT_WRITE
SendTls13Certificate keeps its chain walk cursor in the function locals len,
idx, offset and p, but the only state that survives the WANT_WRITE return of a
non-blocking send is ssl->fragOffset, and that is consulted for the leaf
certificate alone. A send that blocked part way through the chain therefore
re-primed the walk on the next call and copied the chain from its first byte
again. The byte count still matched the announced payload size, so the message
stayed well formed on the wire while the tail of the chain was replaced by a
repeat of its head, and the peer rejected it with BUFFER_ERROR.

Rebuild the cursor from ssl->fragOffset when a resume lands inside the chain.
NextCert reads each entry's three byte length prefix and skips it, so passing
over the entries already sent costs one hop per certificate and only happens on
a resume. Guard the extension index bump the same way the send loop does, so
builds without certificate status request keep the leaf extension size.

Track the size of the chain entry being written in its own variable rather than
folding the extension size into len once the entry completes. The send loop
detected completion with offset == len + OPAQUE16_LEN and kept that check
honest by adding extSz[extIdx] - OPAQUE16_LEN to len at the end of an entry, so
until then len held the raw certificate length and the check read as complete
whenever a fragment boundary landed exactly OPAQUE16_LEN bytes into a real
extension. The walk then jumped to the next certificate in the middle of the
current one. entrySz records len + extSz[extIdx] when the entry is picked up,
len keeps the raw certificate length AddCertExt expects, and both the resume
and the ordinary multi fragment path test the same condition.

The stapled chain in scripts/ocsp-stapling_tls13multi.test reproduces the entry
size case with the server records held to 1482 bytes: the boundary falls two
bytes into an 1837 byte OCSP extension and the handshake fails, while 1480,
1481, 1483 and 1484 all pass.

Reaching this needs a certificate message larger than one record, which is why
it stayed dormant with classic certificates. Add SLH-DSA scenarios with
simulated WANT_WRITE, for server and for mutual authentication, to
tests/test-tls13-slhdsa-entity-128s.conf.

The same resume path mishandles the stapled OCSP responses. WriteCSRToBuffer
fills extSz[] only for the entries whose buffer it allocates, so on a resumed
call every entry that still held a buffer, the one being written and all that
follow it, kept the OPAQUE16_LEN default of an empty extension. The message
length, the entry sizes and the extension bytes written for those entries were
all derived from that default. Recover the size from the extension length
already written into the buffer instead.

SetupOcspResp appends a fresh request per certificate on every call, so a
message that resumed often enough exhausted the extension array and the
handshake ended with MAX_CERT_EXTENSIONS_ERR. Look the responses up once, when
the message starts, and reuse them for the rest of it.

A resumed call also reallocates the extension buffers of the entries it has
already sent, and the walk passes over those entries without writing them
again, so free them there. Free the array in wolfSSL_ResourceFree as well:
nothing released it when a connection ended part way through a Certificate
message, which leaked one OCSP response per unsent entry.

Test case 8 of scripts/ocsp-stapling_tls13multi.test covers all three. A
maximum fragment length of 512 bytes splits the stapled message over about
twenty records and the server blocks on every one of them; without these fixes
the handshake fails with MAX_CERT_EXTENSIONS_ERR.
2026-08-07 08:14:25 +02:00
..
api ssl.c split: cleanup 2026-08-07 09:30:56 +10:00
emnet Restore IP_SOCK_getsockopt emNET error lookup 2026-04-30 18:01:16 +01:00
freertos-mem-track-repro Fix mem_track.h compile failure on multi-threaded non-Linux builds 2026-05-11 16:20:35 +01:00
swdev wolfcrypt/src/sha256.c, wolfcrypt/src/sha512.c: clean up and fix up gating around WC_C_DYNAMIC_FALLBACK: use WC_SHA{256,512}_RAW_BE_BUFFER to indicate big-endian buffer. 2026-08-05 13:53:47 -05:00
unit-mcdc tests: re-enable ascon inSz=0 and rsa prime-check OOM cases (PR 10973) 2026-07-31 13:16:41 +02:00
CONF_FILES_README.md
NCONF_test.cnf
README
TXT_DB.txt
api.c ssl.c split: cleanup 2026-08-07 09:30:56 +10:00
include.am Add SLH-DSA support for the TLS 1.3 and DTLS 1.3 handshake 2026-08-04 22:23:03 +02:00
quic.c Declare QUIC record length from bytes remaining 2026-08-05 14:12:26 +09:00
srp.c
suites.c wolfssl/test.h: convert err_sys() and err_sys_with_errno() to err_sys_func() / 2026-08-05 13:53:46 -05:00
test-altchains.conf
test-chains.conf
test-dhprime.conf
test-dtls-downgrade.conf
test-dtls-fails-cipher.conf
test-dtls-fails.conf
test-dtls-group.conf
test-dtls-mtu.conf
test-dtls-reneg-client.conf
test-dtls-reneg-server.conf
test-dtls-resume.conf
test-dtls-sha2.conf
test-dtls-srtp-fails.conf
test-dtls-srtp.conf
test-dtls.conf
test-dtls13-cid.conf
test-dtls13-downgrade-fails.conf
test-dtls13-downgrade.conf
test-dtls13-pq-hybrid-extra-frag.conf
test-dtls13-pq-hybrid-extra.conf
test-dtls13-pq-hybrid-frag.conf
test-dtls13-pq-standalone-frag.conf
test-dtls13-pq-standalone.conf
test-dtls13-psk.conf
test-dtls13-slhdsa-entity-128s.conf Add SLH-DSA support for the TLS 1.3 and DTLS 1.3 handshake 2026-08-04 22:23:03 +02:00
test-dtls13-slhdsa-entity.conf Add SLH-DSA support for the TLS 1.3 and DTLS 1.3 handshake 2026-08-04 22:23:03 +02:00
test-dtls13.conf
test-ecc-cust-curves.conf
test-ed448.conf
test-ed25519.conf
test-enckeys.conf
test-fails.conf Allow RSA client certs on ECDHE-ECDSA mutual auth 2026-06-08 15:10:27 +02:00
test-maxfrag-dtls.conf
test-maxfrag.conf
test-p521.conf
test-psk-no-id-sha2.conf
test-psk-no-id.conf
test-psk.conf
test-rsapss.conf
test-sctp-sha2.conf
test-sctp.conf
test-sha2.conf
test-sig.conf
test-sm2.conf
test-tls-downgrade.conf
test-tls13-down.conf
test-tls13-ecc.conf
test-tls13-pq-hybrid-extra.conf
test-tls13-pq-hybrid.conf
test-tls13-pq-standalone.conf
test-tls13-psk-certs.conf Add RFC8773bis cert_with_extern_psk support 2026-04-17 15:12:04 +02:00
test-tls13-psk.conf
test-tls13-slhdsa-entity-128s.conf Resume the TLS 1.3 certificate chain send after a WANT_WRITE 2026-08-07 08:14:25 +02:00
test-tls13-slhdsa-entity-sha2-128s.conf Add SLH-DSA support for the TLS 1.3 and DTLS 1.3 handshake 2026-08-04 22:23:03 +02:00
test-tls13-slhdsa-entity-sha2.conf Add SLH-DSA support for the TLS 1.3 and DTLS 1.3 handshake 2026-08-04 22:23:03 +02:00
test-tls13-slhdsa-entity.conf Add SLH-DSA support for the TLS 1.3 and DTLS 1.3 handshake 2026-08-04 22:23:03 +02:00
test-tls13-slhdsa-fail.conf Replace liboqs SPHINCS+ with SLH-DSA in certificate layer 2026-04-30 18:32:07 +02:00
test-tls13-slhdsa-sha2.conf Replace liboqs SPHINCS+ with SLH-DSA in certificate layer 2026-04-30 18:32:07 +02:00
test-tls13-slhdsa-shake.conf Replace liboqs SPHINCS+ with SLH-DSA in certificate layer 2026-04-30 18:32:07 +02:00
test-tls13.conf
test-trustpeer.conf
test.conf
unit.c fixes and improvements from AI review: 2026-08-05 13:53:47 -05:00
unit.h tests/unit.h: pull in wolfssl/wolfcrypt/fips_test.h, for the WOLFSSL_FIPS_DEV_NO_POST stubs. 2026-08-05 13:53:45 -05:00
utils.c Intel QAT: add async hybrid PQC server key share regression test 2026-07-07 09:54:04 -07:00
utils.h Cover the DTLS 1.3 scheduled work API in the tests 2026-08-01 12:04:57 +02:00
w64wrapper.c

README

Before creating any new configure files (.conf) read the CONF_FILES_README.md