curl/lib/vtls
Wyatt O'Day 1dc6ddde06
mbedTLS: cleanup insecure/deprecated code
1. With `MBEDTLS_SSL_PROTO_TLS1_2` not enabled, the mbedTLS code was not
able to connect to any server due to broken logic in curl's
`mbed_set_ssl_version_min_max()`. Now it correctly sets the minimum
supported TLS version based on what is compiled in the library.

2. If debugging is enabled, move the debugging enabling earlier in the
`mbed_connect_step1()` so that verbose errors are actually displayed if
failures happen (see the previous point -- it would've made debugging
that issue easier).

3. Remove the constant `mbedtls_x509_crt_profile_fr` and instead use
mbedTLS-included profile `mbedtls_x509_crt_profile_next` with
`mbedtls_ssl_conf_cert_profile()`. This will follow the latest standards
as new mbedTLS versions are released (rather than being stuck-in-time
until someone comes along to fix what was hard-coded here). This has the
immediate benefit of no longer supporting SHA1 certs and insecure RSA
key-lengths (1024). This fix immediately prevents previously possible
MITM attacks (SHA1 hashes and RSA-1024 keys can be forged relatively
easily by nation-state actors and criminal organizations with
deep-pockets).

4. Added [predictive
resistance](https://mbed-tls.readthedocs.io/en/latest/kb/how-to/add-a-random-generator/#enabling-prediction-resistance)
to the random number generator (adding more entropy to the RNG).

5. Split the random number generator into initialization, the actual
random generation, and the "freeing" of the resources. This
significantly reduces the overhead of using the RNG.

6. Removed the separate RNG function in the TLS connect stage (instead
use the "main" one) and remove the ad-hoc threading support. Instead
properly document how to enable threading in mbedTLS. As it was, other
internals of mbedTLS could have race conditions (in the RSA module in
particular) if `MBEDTLS_THREADING_C` was *not* enabled. And if it is
enabled, then these race-conditions cannot happen. And also, if
MBEDTLS_THREADING_C is enabled then the RNG functions [are fully
thread-safe](https://mbed-tls.readthedocs.io/en/latest/kb/development/thread-safety-and-multi-threading/).

   So, the previous ad-hoc threading support was both partial and broken.

7. Enable support for disabling `MBEDTLS_PEM_PARSE_C`.

8. Add support for `CURLOPT_SSLCERTTYPE` so user can specify `PEM` or
`DER` and get faster execution.

Closes #19983
2025-12-20 17:33:57 +01:00
..
apple.c tidy-up: one more round of formatting nits 2025-12-04 19:30:59 +01:00
apple.h apple sectrust: add to features 2025-10-16 10:58:45 +02:00
cipher_suite.c build: drop duplicate include curl/curl.h and others 2025-12-19 10:58:11 +01:00
cipher_suite.h TLS: remove support for Secure Transport and BearSSL 2025-06-11 07:54:19 +02:00
gtls.c build: drop unused multiif.h includes 2025-12-19 01:45:05 +01:00
gtls.h build: drop duplicate include curl/curl.h and others 2025-12-19 10:58:11 +01:00
hostcheck.c hostcheck: fail wildcard match if host starts with a dot 2025-12-08 10:42:49 +01:00
hostcheck.h build: drop duplicate include curl/curl.h and others 2025-12-19 10:58:11 +01:00
keylog.c build: drop duplicate include curl/curl.h and others 2025-12-19 10:58:11 +01:00
keylog.h spelling: 'a' vs 'an' 2025-05-30 11:38:35 +02:00
mbedtls.c mbedTLS: cleanup insecure/deprecated code 2025-12-20 17:33:57 +01:00
mbedtls.h lib: include files using known path 2025-04-08 17:00:00 +02:00
openssl.c openssl: drop includes unused or duplicate 2025-12-20 13:51:05 +01:00
openssl.h openssl: simplify HAVE_KEYLOG_CALLBACK guard 2025-12-04 22:49:03 +01:00
rustls.c build: drop unused curlx/inet_pton.h includes 2025-12-19 01:34:56 +01:00
rustls.h lib: include files using known path 2025-04-08 17:00:00 +02:00
schannel.c build: drop unused multiif.h includes 2025-12-19 01:45:05 +01:00
schannel.h openssl: drop includes unused or duplicate 2025-12-20 13:51:05 +01:00
schannel_int.h time-keeping: keep timestamp in multi, always update 2025-12-18 22:10:06 +01:00
schannel_verify.c windows: fix CreateFile() calls to support long filenames 2025-12-20 14:16:42 +01:00
vtls.c lib: drop unused rand.h includes 2025-12-20 13:51:04 +01:00
vtls.h lib/subdirs: fix formatting nits 2025-11-30 11:01:50 +01:00
vtls_int.h lib/subdirs: fix formatting nits 2025-11-30 11:01:50 +01:00
vtls_scache.c lib/subdirs: fix formatting nits 2025-11-30 11:01:50 +01:00
vtls_scache.h lib/subdirs: fix formatting nits 2025-11-30 11:01:50 +01:00
vtls_spack.c lib/subdirs: fix formatting nits 2025-11-30 11:01:50 +01:00
vtls_spack.h build: fix build errors/warnings in rare configurations 2025-07-23 22:17:03 +02:00
wolfssl.c build: drop duplicate include curl/curl.h and others 2025-12-19 10:58:11 +01:00
wolfssl.h wolfssl: fix possible assert with !HAVE_NO_EX wolfSSL builds 2025-12-07 17:01:45 +01:00
x509asn1.c build: drop duplicate include curl/curl.h and others 2025-12-19 10:58:11 +01:00
x509asn1.h build: address some -Weverything warnings, update picky warnings 2025-09-20 10:16:15 +02:00