Gilles Peskine 0d6060d644 Stop accepting basicConstraints with only pathLenConstraint
In an X.509 certificate, a basicConstraints extension where the cA
field (BOOLEAN) is omitted but the pathLenConstraint field (INTEGER )is
present is syntactically valid, but RFC 5280 states that CAs MUST NOT emit
such a certificate.

Historically, since XySSL 0.9 in 2008, if a basicConstraints extension
started with an INTEGER field, we interpreted that field as a cA value. This
was a deliberate change:

> Fixed x509_get_ext() to accept some rare certificates (like
> www.openssl.org:443) which have an INTEGER instead of a BOOLEAN for
> Extension::BasicConstraints::cA.

However, 18 years later, this does not seem to be relevant, and the details
seem to have been lost. Furthermore, major implementations follow RFC 5280
and interpret `SEQUENCE { INTEGER n }` with cA being set to its default
value (FALSE) and pathLenConstraint set to `n`. This means that such a
certificate with n != 0 would be interpreted as a CA certificate in Mbed TLS
but as a leaf certificate elsewhere, which is dangerous.

Since CAs are not supposed to emit such certificates, stop accepting them
altogether.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:35:46 +02:00
..
.jenkins
configs Remove deprecated items 2025-08-01 11:45:14 +01:00
git-scripts Header updates 2023-11-03 12:21:36 +00:00
include Fix dependencies 2026-03-16 12:28:36 +00:00
opt-testcases Do not check fail cases for verify skipped 2026-03-13 18:04:16 +00:00
scripts Merge pull request #10631 from yiwu0b11/destdir_install_env_support 2026-04-29 14:37:29 +00:00
src Fix some compile time guards 2026-03-16 12:27:21 +00:00
suites Stop accepting basicConstraints with only pathLenConstraint 2026-06-05 11:35:46 +02:00
.gitignore cmake: Generate test_keys.h and test_certs.h in the build tree 2025-03-26 21:19:28 +01:00
CMakeLists.txt cmake: Introduce TF_PSA_CRYPTO_PRIVATE_INCLUDE_DIRS 2026-03-09 08:28:51 +01:00
compat-in-docker.sh Header updates 2023-11-03 12:21:36 +00:00
compat.sh Revert "ssl_server2.c: DTLS: Attempt to read the response to the close notification" 2026-03-24 18:38:37 +01:00
context-info.sh Fix test and formatting in ssl_context_info 2025-04-29 22:02:24 +02:00
Descriptions.txt
make-in-docker.sh Header updates 2023-11-03 12:21:36 +00:00
Makefile Remove PSA status coverage log test 2026-03-12 10:18:33 +01:00
ssl-opt.sh ssl: narrow TLS 1.2 RSA-PSS handling and add interop coverage 2026-04-16 04:36:48 +03:00