Skip to content

Add compatibility-layer fixes and workflows for 12 applications - #11499

Open
julek-wolfssl wants to merge 13 commits into
wolfSSL:masterfrom
julek-wolfssl:osp-ports-2026-09
Open

julek-wolfssl wants to merge 13 commits into
wolfSSL:masterfrom
julek-wolfssl:osp-ports-2026-09

Conversation

@julek-wolfssl

Copy link
Copy Markdown
Member

Extends wolfSSL's OpenSSL compatibility layer to fix interoperability issues found while building against several applications, and adds/updates their CI workflow matrix entries:

  • openldap 2.6.13: enable CRL with --enable-openldap (TLSCRLCheck needs HAVE_CRL)
  • msmtp 1.8.32: add to workflow matrix
  • libvncserver 0.9.15: allow DH_compute_key without a generator (ARD auth only sets p and priv_key)
  • jwt-cpp 0.7.2: add to workflow matrix
  • net-snmp 5.9.5.2: add to workflow matrix (no OSP patch needed; patch file is now a matrix variable)
  • bind9 9.20.23: accept EVP_PKEY_HMAC in EVP_PKEY_new_raw_private_key, forwarding to wolfSSL_EVP_PKEY_new_mac_key()
  • libspdm 3.8.2: add EVP_PKEY_dup, an isPriv flag on EVP_PKEY, parsing of basicConstraints strings in createExtFromStr(), and support for the critical, prefix in X509V3_EXT_nconf_nid()/X509V3_EXT_nconf(); add unit tests
  • socat 1.8.1.1: fix the "aNULL" cipher list keyword so anonymous DH suites and CTX/SSL anon flag are set correctly; update expect_fail list
  • krb5 1.22.2: update workflow
  • libimobiledevice 1.4.0: implement ASN1_TIME_set, fix X509V3_set_ctx and X509_pubkey_digest, add a new workflow with a usbmuxd/lockdownd emulator script for CI testing without an iOS device
  • tcpdump 4.99.6: enable MD5 with --enable-tcpdump (TCP MD5 signature option), add workflow building libpcap 1.10.5 alongside it
  • python 3.14.5: add X509_VERIFY_PARAM_get_hostflags, fix AUTHORITY_INFO_ACCESS_free to release entries, add to workflow matrix
  • softhsm 2.7.0: add ERR_set_mark/ERR_pop_to_mark, EVP_PKEY_RSA_PSS, implement BN_mask_bits, fix EVP_DecryptUpdate padding buffer overflow, update workflow

Depends on wolfSSL/osp#362

OpenLDAP's TLSCRLCheck maps to X509_STORE_set_flags(X509_V_FLAG_CRL_CHECK),
which needs HAVE_CRL. Force CRL on for --enable-openldap like the other
application recipes do.
…orkflow

OpenSSL's DH_compute_key only needs p and priv_key. libvncserver's ARD
authentication sets just those and failed in SetDhInternal. Make g
optional there but leave the key marked unsynced so a generator set
later is picked up, and require g in the paths that need it.
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.
CPython 3.14 calls X509_VERIFY_PARAM_get_hostflags() unconditionally.
Add the getter next to the existing setter and cover it in
test_wolfSSL_X509_VERIFY_PARAM.

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.
… workflow

- Add ERR_set_mark and ERR_pop_to_mark for both error queue variants.
- 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.
- EVP_DecryptUpdate with padding: flush the held back block as soon as
  partial data is buffered, like OpenSSL. Otherwise a later update could
  write inl + 2 * block_size - 1 bytes into a buffer sized inl + block_size.
- Add softhsm 2.7.0 to the workflow matrix.
Copilot AI lite review requested due to automatic review settings September 18, 2026 15:00
@julek-wolfssl julek-wolfssl self-assigned this Sep 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 of out and 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.ptr is DER and sends it to d2i_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). Therefore EVP_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.

Comment thread src/ssl_bn.c
Comment on lines +883 to +884
#ifndef WOLFSSL_SP_MATH
/* Keep only the lowest n bits. bn = bn mod 2^n
Comment thread src/x509.c
Comment on lines +3326 to +3332
for (num = tok + 8; num < end; num++) {
if ((*num < '0') || (*num > '9'))
return WOLFSSL_FAILURE;
pathLen = (pathLen * 10) + (*num - '0');
if (pathLen > WOLFSSL_MAX_PATH_LEN)
return WOLFSSL_FAILURE;
}
Comment thread wolfssl/openssl/ssl.h
Comment on lines +1243 to +1244
#define ERR_set_mark wolfSSL_ERR_set_mark
#define ERR_pop_to_mark wolfSSL_ERR_pop_to_mark
Comment thread wolfcrypt/src/evp_pk.c

WOLFSSL_ENTER("wolfSSL_EVP_PKEY_dup");

if (pkey == NULL || pkey->pkey.ptr == NULL || pkey->pkey_sz <= 0) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants