wolfssl/certs/intermediate
Tobias Frauenschlaeger b2322fd93e Skip same-name chain CAs in alternate chain mode
With WOLFSSL_ALT_CERT_CHAINS a chain CA that fails with ASN_NO_SIGNER_E
or ASN_SELF_SIGNED_E is skipped, as long as the peer certificate still
verifies to a trusted CA. An extra CA that carries no Authority Key
Identifier and shares its issuer name with a trusted CA is looked up by
name, finds that trusted CA and then fails with ASN_SIG_CONFIRM_E, or
with ASN_SIG_OID_E when the key types differ. Those errors aborted the
handshake even in alternate chain mode.

NSS can send such a chain: its own leaf and intermediate followed by the
peer's trust anchor from another PKI. RFC 8446 section 4.4.2 asks
implementations to tolerate extraneous certificates.

Treat both signature errors like the missing signer case when the chain
CA is self-issued, has no AKID, and the CA found for it has a different
public key. Only an error from parsing the chain CA counts, not one from
its OCSP or CRL check. A tampered intermediate, or a tampered copy of a
trusted root found by its own SKID, still fails on its own signature.
A CA with an AKID names its issuer, so a bad signature still fails the
handshake, as tests/test-fails.conf expects for
server-cert-rsa-badsig.pem. DecodedCert gains extAuthKeyIdPresent for
this, since extAuthKeyIdSet only records a key identifier and an AKID
with just issuer and serial would otherwise count as absent. Requiring a found issuer keeps out the
ASN_SIG_OID_E that DecodeCert returns when signatureAlgorithm differs
from the TBS signature; the original ASN decoder sets isCA before that
check, so such a malformed CA would otherwise be skipped. The skipped
certificate is not added to the certificate manager, so it never becomes
trusted and the peer certificate still has to verify on its own.

Add ECC test chains, generated by genintcerts.sh from existing keys,
that each end in an extra CA named after ca-ecc-cert.pem: roots with an
ECC and an RSA key and no key ids, a root with the key and SKID of
ca-ecc-cert.pem but signed by another key, roots with an AKID naming
ca-ecc-cert.pem by key id and by issuer and serial, and a CA that is not
self-issued. API tests expect the
first two to pass on an alternate chain when enabled and otherwise to
fail with ASN_SIG_CONFIRM_E and ASN_SIG_OID_E respectively. The other
four, and server-cert-rsa-badsig.pem whose chain CA carries an AKID,
fail with ASN_SIG_CONFIRM_E in both modes. The tests set
WOLFSSL_VERIFY_PEER on the client, since builds with
OPENSSL_COMPATIBLE_DEFAULTS default to no peer verification. They need WOLFSSL_PEM_TO_DER for the
PEM fixtures and are skipped with WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION,
where Security.framework revalidates the chain.
2026-11-10 14:18:07 +01:00
..
ca_false_intermediate
…
untrusted_anchor
…
ca-ecc-bad-aki.der
…
ca-ecc-bad-aki.pem
…
ca-ecc-same-dn-akid-cert.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
ca-ecc-same-dn-akid-name-cert.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
ca-ecc-same-dn-cert.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
ca-ecc-same-dn-int-cert.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
ca-ecc-same-dn-rsa-cert.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
ca-ecc-same-key-cert.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
ca-int-cert.der
…
ca-int-cert.pem
…
ca-int-ecc-cert.der
…
ca-int-ecc-cert.pem
…
ca-int-ecc-key.der
…
ca-int-ecc-key.pem
…
ca-int-key.der
…
ca-int-key.pem
…
ca-int2-cert.der
…
ca-int2-cert.pem
…
ca-int2-ecc-cert.der
…
ca-int2-ecc-cert.pem
…
ca-int2-ecc-key.der
…
ca-int2-ecc-key.pem
…
ca-int2-key.der
…
ca-int2-key.pem
…
client-chain-alt-ecc.pem
…
client-chain-alt.pem
…
client-chain-ecc.der
…
client-chain-ecc.pem
…
client-chain.der
…
client-chain.pem
…
client-int-cert.der
…
client-int-cert.pem
…
client-int-ecc-cert.der
…
client-int-ecc-cert.pem
…
genintcerts.sh Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
include.am Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
server-chain-alt-ecc.pem
…
server-chain-alt-same-dn-akid-ecc.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
server-chain-alt-same-dn-akid-name-ecc.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
server-chain-alt-same-dn-ecc.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
server-chain-alt-same-dn-int-ecc.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
server-chain-alt-same-dn-rsa.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
server-chain-alt-same-key-ecc.pem Skip same-name chain CAs in alternate chain mode 2026-11-10 14:18:07 +01:00
server-chain-alt.pem
…
server-chain-ecc.der
…
server-chain-ecc.pem
…
server-chain-short.pem
…
server-chain.der
…
server-chain.pem
…
server-int-cert.der
…
server-int-cert.pem
…
server-int-ecc-cert.der
…
server-int-ecc-cert.pem
…