-
-
Notifications
You must be signed in to change notification settings - Fork 7k
mbedtls: add support for 4.0.0 #19077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Careless is a word that comes to mind! We can also just document not compatible with v4 and leave that work for someone to do later. I mean it is an option. |
|
There is a separate 'migration guide' mentioning some of the breakages: https://github.com/Mbed-TLS/mbedtls/blob/mbedtls-4.0.0/docs/4.0-migration-guide.md The above doc links to another migration guide for the crypto subsystem, which is a 404: What I noticed so far: MD4 and 3DES are gone, MD5 and SHA256 may now be offered via different/moved headers and a new API (possibly introduced in 3.x? This may not be accurate, and will need more digging. edit: Oh, There is a per-header collection of further migration guides for the crypto API here: After major changes in 3.x, the random generator API has seen another overhaul in 4.x. Agreed with leaving the rest as-is for now. This PR is probably okay to merge, but it's just edit: this may be the non-404 link: https://github.com/Mbed-TLS/TF-PSA-Crypto/blob/tf-psa-crypto-1.0.0/docs/1.0-migration-guide.md (which is different from the master branch with the many separate migration guides). |
This comment was marked as resolved.
This comment was marked as resolved.
|
Managed to make curl build with 4.0.0. Some tests fail with it: Field notes:
Pending issues:
|
|
Ready for review! |
mbedTLS crypto might be used from other parts of the code, not only SSL. In MultiSSL builds it's possible that a different TLS backend is selected, yet, the code uses mbedTLS crypto in md4/md5/sha256/curl_ntlm_core. This can happen e.g. in an mbedTLS + Schannel MultiSSL build with Schannel selected as default.
It's unclear when MBEDTLS_USE_PSA_CRYPTO became available as an option, when the option actually worked, and how to enable it at build-time. The functionality covered by it is definitely supported, and always-enabled with 4.0.0. For 3.x and 3.6.x, it almost look like it was practically always disabled.
icc: remark curl#10441: The Intel(R) C++ Compiler Classic (ICC) is deprecated and will be removed from product release in the second half of 2023. The Intel(R) oneAPI DPC++/C++ Compiler (ICX) is the recommended compiler moving forward. Please transition to use this compiler. Use '-diag-disable=10441' to disable this message. In file included from libtests.c(125): ../../../tests/libtest/lib1308.c(52): error curl#188: enumerated type mixed with another type global_init(CURL_GLOBAL_ALL); ^ https://github.com/curl/curl/actions/runs/18561102955/job/52910049327?pr=19077#step:35:187
| WOLFSSL_VERSION: 5.8.2 | ||
| # renovate: datasource=github-tags depName=Mbed-TLS/mbedtls versioning=semver registryUrl=https://github.com | ||
| MBEDTLS_VERSION: 4.0.0 | ||
| # renovate: datasource=github-tags depName=Mbed-TLS/mbedtls versioning=semver:^3.0.0 registryUrl=https://github.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(We'll see if versioning= is correct, if Renovate picks it up to bump to 3.6.5.)
Make autotools and cmake detect DES support in OpenSSL and mbedTLS. Forward feature macros to C and omit NTLM from the feature preview list. Use the feature macros in source. This ensure that `-V` output matches the preview. OpenSSL doesn't support DES when built with `no-des` or `no-deprecated`. mbedTLS 4.x no longer supports it, and it's possible to disable it in <4 with `scripts/config.py unset MBEDTLS_DES_C`. Before this patch this worked for mbedTLS 4 only, and with a regression for pending PR #16973. Also: - drop NTLM feature check from `curl_setup.h` in favour of autotools/ cmake feature macros. This makes `curl_setup.h` no longer need to include an mbedTLS header, which in turn makes tests/server build without depending on mbedTLS. Fixing, in #16973: ``` In file included from tests/server/first.h:40, from bld/tests/server/servers.c:3: lib/curl_setup.h:741:10: fatal error: mbedtls/version.h: No such file or directory 741 | #include <mbedtls/version.h> | ^~~~~~~~~~~~~~~~~~~ ``` Ref: https://github.com/curl/curl/actions/runs/18689537893/job/53291322012?pr=16973 Ref: #19181 (initial fix idea) Follow-up to 3a30583 #19077 - move back mbedTLS header include and version check from `curl_setup.h` to each source which consumes mbedTLS. - GHA/http3-linux: drop workaround that disabled NTLM for `no-deprecated` OpenSSL builds. Follow-up to 0069778 #12384 - curl_ntlm_core: drop pointless macro `CURL_NTLM_NOT_SUPPORTED`. Follow-up to 0069778 #12384 Closes #19206
Fixing:
```
lib/vtls/mbedtls.c:1505:10: error: call to undeclared function 'Curl_sha256it'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1505 | return Curl_sha256it(sha256sum, input, inputlen);
| ^
1 error generated.
```
with mbedTLS configuration:
```
tf-psa-crypto/scripts/config.py unset PSA_WANT_ALG_SHA_256
tf-psa-crypto/scripts/config.py unset PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS
tf-psa-crypto/scripts/config.py unset MBEDTLS_LMS_C
```
Follow-up to 3a30583 #19077
Closes #19223
After this patch libcurl requires (as already documented)
the
curl_global_init()call when using thecurl_formadd()API withmbedTLS.
Note: NTLM is not supported with mbedTLS 4+, because it lacks
the necessary crypto primitive: DES.
Also:
curl_setup.h.curl_global_init().For MD5, SHA-256,
curl_formadd(), and MultiSSL builds with mbedTLSbut where mbedTLS isn't the default backend.
curl_global_init()(for the Form API).the default local implementation.
the default local implementation.
curl_global_init().an existing job, while also enabling pytest in it.
Closes CI: Update dependency Mbed-TLS/mbedtls to v4 #19075
Closes CI: Update dependency Mbed-TLS/mbedtls to v3.6.5 (try again?) #19074
Refs:
https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.0.0
https://github.com/Mbed-TLS/mbedtls/blob/mbedtls-4.0.0/docs/4.0-migration-guide.md
https://github.com/Mbed-TLS/mbedtls/blob/mbedtls-4.0.0/tf-psa-crypto/docs/1.0-migration-guide.md [404]
https://github.com/Mbed-TLS/TF-PSA-Crypto/blob/tf-psa-crypto-1.0.0/docs/1.0-migration-guide.md
https://github.com/Mbed-TLS/TF-PSA-Crypto/blob/tf-psa-crypto-1.0.0/docs/psa-transition.md
https://github.com/Mbed-TLS/TF-PSA-Crypto/tree/627f727bbed3d9319ed548f1c0839a29c223414e/docs/4.0-migration-guide
API already available in 3.x. It requires calling
psa_crypto_init()before use.psa_crypto_init(). Just in case.Or remove feature guards around PSA functions.
They seem to be available when explicitly including
psa/crypto.h.Which is available in all 3.2.0+ versions.