Repository navigation
Add compatibility-layer fixes and workflows for 12 applications - #11499
julek-wolfssl wants to merge 28 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate review findings remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Extends wolfSSL’s OpenSSL compatibility layer and expands CI coverage for multiple application releases.
Changes:
- Adds EVP, X.509, DH, BN, cipher, error-mark, and ASN.1 compatibility fixes with regression tests.
- Updates application feature configuration and workflow matrices.
- Adds tcpdump/libpcap coverage and an iOS device emulator for CI.
File summaries
| File | Reviewed changes and findings |
|---|---|
wolfssl/wolfcrypt/logging.h |
Declares error-mark helpers. |
wolfssl/ssl.h |
Adds compatibility structures and APIs. |
wolfssl/openssl/ssl.h |
Adds SSL/error mappings. Critical (1 vote): direct openssl/err.h users still lack ERR_set_mark/ERR_pop_to_mark declarations and mappings. |
wolfssl/openssl/evp.h |
Adds EVP constants and duplication APIs. |
wolfssl/openssl/bn.h |
Exposes BN_mask_bits. |
wolfssl/internal.h |
Declares anonymous-suite helpers. |
wolfcrypt/test/test.c |
Updates cipher test expectations. |
wolfcrypt/src/logging.c |
Implements error-mark support. |
wolfcrypt/src/evp.c |
Updates EVP state and decryption handling. Moderate (1 vote): partial decrypt output bookkeeping can overwrite completed blocks and undercount output. |
wolfcrypt/src/evp_pk.c |
Adds raw HMAC handling and EVP key duplication. Moderate (2 votes): zero-length HMAC keys are rejected before duplication. Moderate (1 vote): raw Ed25519/Ed448/X25519/X448 keys are incorrectly treated as DER during duplication. |
tests/api/test_ossl_x509_vp.c |
Tests host-flag retrieval. |
tests/api/test_ossl_x509_ext.c |
Tests X.509 extension and AIA behavior. |
tests/api/test_ossl_dh.c |
Tests DH keys without generators. |
tests/api/test_ossl_bn.c |
Tests BN_mask_bits. |
tests/api/test_ossl_asn1.h |
Registers ASN.1 time tests. |
tests/api/test_ossl_asn1.c |
Tests ASN1_TIME_set. |
tests/api/test_evp_pkey.h |
Registers EVP key tests. |
tests/api/test_evp_pkey.c |
Tests EVP key duplication and raw HMAC keys. |
tests/api/test_evp_cipher.h |
Registers cipher tests. |
tests/api/test_evp_cipher.c |
Tests partial decrypt output. |
tests/api.c |
Adds cipher, digest, and error-mark tests. |
src/x509.c |
Implements X.509 compatibility fixes. Critical (2 votes): signed pathLen * 10 can overflow before validation, allowing malformed constraints. |
src/ssl.c |
Enables anonymous cipher suites. |
src/ssl_err.c |
Exposes error-mark APIs. |
src/ssl_bn.c |
Implements BN_mask_bits. Critical (1 vote): no-ECC verify-only builds may reference unavailable sp_mod_2d backend code. |
src/ssl_asn1.c |
Implements ASN1_TIME_set. |
src/pk.c |
Supports DH agreement without generators. |
src/internal.c |
Updates cipher-suite parsing. |
configure.ac |
Enables application-specific CRL and MD5 support. |
.github/workflows/tcpdump.yml |
Adds tcpdump/libpcap CI. |
.github/workflows/softhsm.yml |
Adds SoftHSM workflow coverage. |
.github/workflows/socat.yml |
Adds socat workflow coverage. |
.github/workflows/python.yml |
Adds Python workflow coverage. |
.github/workflows/openldap.yml |
Adds OpenLDAP workflow coverage. |
.github/workflows/net-snmp.yml |
Adds net-snmp matrix handling. |
.github/workflows/msmtp.yml |
Adds msmtp workflow coverage. |
.github/workflows/libvncserver.yml |
Adds libvncserver workflow coverage. |
.github/workflows/libspdm.yml |
Adds libspdm workflow coverage. |
.github/workflows/libimobiledevice.yml |
Adds libimobiledevice emulator CI. |
.github/workflows/krb5.yml |
Updates krb5 workflow coverage. |
.github/workflows/jwt-cpp.yml |
Adds jwt-cpp workflow coverage. |
.github/workflows/bind.yml |
Adds BIND workflow coverage. |
.github/scripts/idevice-emulator.py |
Implements the iOS protocol emulator. |
.github/ci-deps/packages-ubuntu-24.04-full.txt |
Updates CI dependencies. |
Review details
Suppressed comments (2)
wolfcrypt/src/evp.c:1277
- When a decrypt update has complete blocks followed by a partial block, the code above can write those complete blocks without advancing
outl/out; this flush then writes at the start ofoutand counts only the held block. The new 29-byte test chunk exercises this path, so plaintext is overwritten and under-counted; update the output bookkeeping for every completed non-final block before this copy.
wolfcrypt/src/evp_pk.c:1746 - The fallback assumes every non-HMAC
pkey->pkey.ptris DER and sends it tod2i_evp_pkey(), but the raw-key constructors store raw Ed25519/Ed448/X25519/X448 bytes in this field (wolfcrypt/src/evp_pk.c:568-577 and 741-748). ThereforeEVP_PKEY_dup()returns NULL for valid raw public/private keys instead of producing a duplicate; handle raw key types with the corresponding raw constructor before taking the DER path.
- Files reviewed: 44/44 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
1884475 to
aa1ebd5
Compare
|
e8ddcd9 to
a1b26c1
Compare
|
retest this please |
There was a problem hiding this comment.
tests failing
edit: I should learn to read, failures expected until wolfSSL/osp#362 is merged.
a1b26c1 to
a300a3a
Compare
3c3c3ba to
ea30799
Compare
|
retest this please |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11499
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): .github/ci-deps/packages-ubuntu-24.04-full.txt, .github/scripts/idevice-emulator.py, .github/workflows/bind.yml, .github/workflows/codespell.yml, .github/workflows/jwt-cpp.yml, .github/workflows/krb5.yml, .github/workflows/libimobiledevice.yml, .github/workflows/libspdm.yml, .github/workflows/libvncserver.yml, .github/workflows/msmtp.yml, .github/workflows/net-snmp.yml, .github/workflows/openldap.yml, .github/workflows/python.yml, .github/workflows/socat.yml, .github/workflows/softhsm.yml, .github/workflows/tcpdump.yml, configure.ac, tests/api/test_evp_cipher.h, tests/api/test_evp_pkey.h, tests/api/test_ossl_asn1.h
Coverage: 22 of 24 in-scope changed file(s) opened by the reviewer; not opened: tests/api/test_ossl_asn1.c, wolfssl/openssl/ssl.h
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Max
|
@philljj good catch. Addressing. |
net-snmp 5.9.5 and newer has wolfSSL support upstream, so the new entry builds without an OSP patch. The patch file is now a matrix variable.
OpenSSL accepts EVP_PKEY_HMAC there. wolfSSL only accepted Ed25519, Ed448, X25519 and X448. Forward HMAC keys to wolfSSL_EVP_PKEY_new_mac_key(). Add bind9 9.20.23 to the bind workflow matrix.
…te workflow libspdm 3.8.2 calls EVP_PKEY_dup() unconditionally when generating a CSR and builds the CSR's basicConstraints extension from an OpenSSL style string with X509V3_EXT_nconf_nid(). - Record whether an EVP_PKEY holds private key material in a new isPriv flag, set wherever a key is built. The struct is zeroed on creation, so a key that holds nothing reads as public. - Add wolfSSL_EVP_PKEY_dup(): a deep copy that re-decodes the cached DER the same way it was made, so no failed decode is left on the error queue. - Parse "CA:TRUE|FALSE[,pathlen:N]" in createExtFromStr(). The format is OpenSSL's, so the parser lives in src/x509.c next to its only caller. Spaces and tabs around a token are ignored, CA is required, each token may appear once and the path length is capped at WOLFSSL_MAX_PATH_LEN. - Accept the "critical," prefix for every NID in X509V3_EXT_nconf_nid() and X509V3_EXT_nconf(), and only as a prefix, as OpenSSL does. - Add unit tests and libspdm 3.8.2 to the workflow matrix.
The OpenSSL-style "aNULL" keyword only set the anon signature flag, so InitSuites never generated the DH_anon suites (they also need haveDH), and nothing set useAnon from a cipher list, so a server without a certificate that listed anonymous suites failed in wolfSSL_accept with NO_PRIVATE_KEY. Set haveDH for "aNULL" and, in the OpenSSL compat parser, allow anon on the CTX/SSL when the resulting list contains an anonymous suite. socat OPENSSL-LISTEN with ciphers=aNULL then completes the handshake instead of erroring out (its test 318 records ok either way, so the suite does not show the difference). Add the socat 1.8.1.1 matrix entry. Its test numbering matches 1.8.0.3 (the new tests are appended), so the expect_fail list is the 1.8.0.3 one minus 402, 459 and 460: 402 passes now, and the osp patch keeps the derived config.h.in defines through autoheader, so the ispeed and tcpwrap deny-table options exist again.
…d workflow ASN1_TIME_set() was a stub, so certificates generated through the compatibility layer only had the default validity period. X509V3_set_ctx() now stores the issuer and subject in the context instead of allocating an unused X509. libimobiledevice builds the subjectKeyIdentifier "hash" from X509_pubkey_digest(). OpenSSL digests the subjectPublicKey, but X509_set_pubkey() stores a SubjectPublicKeyInfo where a decoded certificate stores the key alone, so certificates built in memory got a different digest. Skip the SubjectPublicKeyInfo wrapper when present. Add the libimobiledevice workflow. libimobiledevice has no test suite and a runner has no iOS device, so .github/scripts/idevice-emulator.py plays one: it speaks the usbmuxd protocol on a Unix socket (ListDevices, Listen, Connect, ReadBUID and the pair record calls) and the lockdownd protocol on the connection tunnelled behind it (QueryType, GetValue, Pair, ValidatePair, Unpair, StartSession with the TLS upgrade, StopSession, StartService, Goodbye). The workflow builds the dependency chain (libplist, libimobiledevice-glue, libusbmuxd, libtatsu) from source, checks that the library and tools link against wolfSSL, and runs idevice_id, idevicepair pair/validate/unpair and ideviceinfo against the emulator. It then asserts on the emulator log: the pair record certificates and private keys check out, the session negotiated TLS with the host presenting the RootCertificate as its client certificate, requests were served inside that session, and the unpair reached the pair record store. A second run reports iOS 9, for which libimobiledevice pins the session to TLS 1.0, so wolfSSL is built with --enable-tlsv10.
tcpdump uses MD5 for the TCP MD5 signature option. The "options that require MD5" check runs before the tcpdump block sets OPENSSL_EXTRA and DES3, so MD5 stayed disabled. Turn it on in the tcpdump block. The workflow builds libpcap 1.10.5 next to tcpdump because the libpcap 1.10.4 shipped by Ubuntu 24.04 reads pcap timestamps as signed 32-bit values and fails the time_2038_overflow, time_2039, time_2106 and time_2106_max tests.
OpenSSL's AUTHORITY_INFO_ACCESS_free is an ASN.1 item free and releases the ACCESS_DESCRIPTION entries. wolfSSL's freed only the stack nodes, so CPython's _get_aia_uri leaked the entries. No in-tree caller relied on the shallow free. Add the 3.14.5 entry to the Python workflow matrix.
- Add EVP_PKEY_RSA_PSS. - Implement BN_mask_bits (was a stub) and guard its declaration like the definition: wolfSSL_mask_bits is not built with WOLFSSL_SP_MATH, and an unconditional declaration turned a missing API into a link error. - Test that partial EVP_DecryptUpdate calls with padding stay within inl + block_size. - Add softhsm 2.7.0 to the workflow matrix. ERR_set_mark/ERR_pop_to_mark are now provided by master.
sp_mod_2d() is only compiled when (WOLFSSL_SP_MATH_ALL && !WOLFSSL_RSA_VERIFY_ONLY) || HAVE_ECC, so guarding on WOLFSSL_SP_MATH alone left a verify-only SP build declaring BN_mask_bits without a backend. Track the backend condition with WOLFSSL_HAVE_MP_MOD_2D and use it for the implementation, the declaration, the alias and the test.
EVP_PKEY_new_mac_key() and EVP_PKEY_new_raw_private_key() accept a zero-length HMAC key, but the pkey_sz <= 0 check rejected it. An HMAC key is raw octets, so only a negative size is invalid.
XMALLOC(0) may return NULL, so EVP_PKEY_new_mac_key() with a zero-length key leaves pkey.ptr NULL. EVP_PKEY_dup() rejected that as "no key data". Key the NULL-buffer check off pkey_sz instead.
i2d_PrivateKey()/i2d_PUBKEY() are compiled out when NO_ASN or NO_PWDBASED is set, so leantls + opensslextra failed to link tests/unit.test.
buid is the usbmuxd ReadBUID protocol field, not a typo.
clang-tidy's bugprone-unused-return-value lists snprintf as a checked function, and XSNPRINTF resolves to it.
MSVC reported C4244 for the int-to-byte narrowing into the one-bit field, matching how the rest of evp.c sets it.
EVP_PKEY_new_raw_*_key() and X509_get_pubkey() for Ed25519 and ML-DSA keys cache raw key bytes in pkey.ptr, while the d2i, keygen and set1 paths cache DER. Add an isRaw bit, set it on every path that fills pkey.ptr, and let EVP_PKEY_dup() rebuild raw keys with the raw constructors based on it instead of the key length.
X509DecodePubKey() now decodes Ed448 keys, and like Ed25519 it caches the raw key bytes from the certificate. Set isRaw so EVP_PKEY_dup() rebuilds the key with the raw constructor instead of decoding it as DER.
X509DecodePubKey() marks ML-DSA certificate keys raw, then replaces the raw key with an SPKI where the encoder is built in. The stale flag made EVP_PKEY_dup() call the raw constructor, which has no ML-DSA support, so it returned NULL. Clear the flag so the SPKI is decoded as DER.
X509_get_ext_d2i(NID_info_access) returns a stack of ASN1_OBJECTs that borrow x509->authInfo. AUTHORITY_INFO_ACCESS_free freed them as ACCESS_DESCRIPTIONs, double freeing authInfo. Free the entries by stack type instead. Map ACCESS_DESCRIPTION stacks to their free function in OPENSSL_EXTRA builds too, as they are created there.
SetDhInternal now accepts a missing g, so set1_DH would encode g=0.
Mask the magnitude as OpenSSL does. mp_mod_2d made negatives positive.
Master now keeps ASN1_INTEGER data as the value magnitude, so the pathlen parsed from a basicConstraints string must be set as a value rather than in the length field.
1749f99 to
dc77e4a
Compare
check-workflows.py requires room for the 750s apt budget.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11499
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): .github/ci-deps/packages-ubuntu-24.04-full.txt, .github/scripts/idevice-emulator.py, .github/workflows/bind.yml, .github/workflows/codespell.yml, .github/workflows/jwt-cpp.yml, .github/workflows/krb5.yml, .github/workflows/libimobiledevice.yml, .github/workflows/libspdm.yml, .github/workflows/libvncserver.yml, .github/workflows/msmtp.yml, .github/workflows/net-snmp.yml, .github/workflows/openldap.yml, .github/workflows/python.yml, .github/workflows/socat.yml, .github/workflows/softhsm.yml, .github/workflows/tcpdump.yml, configure.ac, tests/api/test_evp_cipher.h, tests/api/test_evp_pkey.h, tests/api/test_ossl_asn1.h
Coverage: 11 of 20 in-scope changed file(s) opened by the reviewer; not opened: tests/api.c, tests/api/test_evp_cipher.c, tests/api/test_evp_pkey.c, tests/api/test_ossl_asn1.c, tests/api/test_ossl_dh.c, wolfssl/internal.h, wolfssl/openssl/bn.h, wolfssl/openssl/evp.h, wolfssl/ssl.h
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Lite
| #ifdef HAVE_ANON | ||
| /* Like OpenSSL, a list with anonymous suites lets a server run without | ||
| * a certificate. */ | ||
| if (ret == WOLFSSL_SUCCESS && SuitesHaveAnon(suites)) { |
There was a problem hiding this comment.
Cipher-list-derived useAnon is sticky and never cleared by a later non-anon list · Logic errors
useAnon is set to 1 whenever a parsed list contains an anonymous suite, but nothing resets it when a later list has none. A later HIGH:!aNULL list keeps useAnon=1, so InitSuites regenerations (server version downgrade, ProcessBufferResetSuites) re-add ADH suites and the server's NO_PRIVATE_KEY check stays skipped.
Suggested fix: Give useAnon its own flag for anon support that came from a cipher list, and clear that flag on any successful parse whose result has no anonymous suite, leaving explicit allow_anon_cipher untouched.
Extends wolfSSL's OpenSSL compatibility layer to fix interoperability issues found while building against several applications, and adds/updates their CI workflow matrix entries:
--enable-openldap(TLSCRLCheck needs HAVE_CRL)DH_compute_keywithout a generator (ARD auth only sets p and priv_key)EVP_PKEY_HMACinEVP_PKEY_new_raw_private_key, forwarding towolfSSL_EVP_PKEY_new_mac_key()EVP_PKEY_dup, anisPrivflag on EVP_PKEY, parsing ofbasicConstraintsstrings increateExtFromStr(), and support for thecritical,prefix inX509V3_EXT_nconf_nid()/X509V3_EXT_nconf(); add unit testsASN1_TIME_set, fixX509V3_set_ctxandX509_pubkey_digest, add a new workflow with a usbmuxd/lockdownd emulator script for CI testing without an iOS device--enable-tcpdump(TCP MD5 signature option), add workflow building libpcap 1.10.5 alongside itX509_VERIFY_PARAM_get_hostflags, fixAUTHORITY_INFO_ACCESS_freeto release entries, add to workflow matrixERR_set_mark/ERR_pop_to_mark,EVP_PKEY_RSA_PSS, implementBN_mask_bits, fixEVP_DecryptUpdatepadding buffer overflow, update workflowDepends on wolfSSL/osp#362