Two test-strength gaps surfaced during pre-PR review of #47 (OpenSSL 4.0 support). Both are pre-existing — not introduced by that change — but worth tracking.
1. SHAKE XOF output-length tests assert on the wrong dimension
`ssl/crypto/_test.pony` — `_TestShake128OutputLength`, `_TestShake256OutputLength`, `_TestShake128XofPrefix`, `_TestShake256XofPrefix`.
The output-length tests assert `d.final().size() == sample`. The returned array's size comes from the Pony-side allocation (`@pony_alloc(ctx, size)`), not from what `EVP_DigestFinalXOF` actually wrote. A silent no-op (zero bytes written, buffer left zeroed) would pass these assertions.
The XOF-prefix tests are similarly weak — if the XOF returned all-zero output, `small == large.trim(0, small_size)` would still be true.
2. `SSL_get1_peer_certificate` has no runtime test coverage
`ssl/net/ssl.pony:265-271` picks between `SSL_get1_peer_certificate` (OpenSSL 3.0.x / 4.0.x) and `SSL_get_peer_certificate` (OpenSSL 1.1.x / LibreSSL). Every existing net test uses `set_client_verify(false)` or no hostname, so `_verify_hostname` never runs and the FFI bindings are only verified at link time.
Suggested improvements
- Known-answer tests for SHAKE at two distinct non-default lengths, or pre-zero the buffer and assert non-zero output.
- A net test that completes a full TLS handshake with `client_verify = true` and a known-good hostname, using an `assets/cert.pem` with a matching SAN.
Two test-strength gaps surfaced during pre-PR review of #47 (OpenSSL 4.0 support). Both are pre-existing — not introduced by that change — but worth tracking.
1. SHAKE XOF output-length tests assert on the wrong dimension
`ssl/crypto/_test.pony` — `_TestShake128OutputLength`, `_TestShake256OutputLength`, `_TestShake128XofPrefix`, `_TestShake256XofPrefix`.
The output-length tests assert `d.final().size() == sample`. The returned array's size comes from the Pony-side allocation (`@pony_alloc(ctx, size)`), not from what `EVP_DigestFinalXOF` actually wrote. A silent no-op (zero bytes written, buffer left zeroed) would pass these assertions.
The XOF-prefix tests are similarly weak — if the XOF returned all-zero output, `small == large.trim(0, small_size)` would still be true.
2. `SSL_get1_peer_certificate` has no runtime test coverage
`ssl/net/ssl.pony:265-271` picks between `SSL_get1_peer_certificate` (OpenSSL 3.0.x / 4.0.x) and `SSL_get_peer_certificate` (OpenSSL 1.1.x / LibreSSL). Every existing net test uses `set_client_verify(false)` or no hostname, so `_verify_hostname` never runs and the FFI bindings are only verified at link time.
Suggested improvements