Repository navigation
Conversation
|
You want drop all backward compatibility (2.x)? Due to support complexity? You jokes? Somewhere i use 18.04 ubuntu and what ? If stable base LTS distib version 24.04 support only 2.x you can't broke that in important library. |
|
mbedTLS breaks compatibility in big ways on each major release, |
|
May be try to add support 4.x with next layer of preprocessing directives: #if MBEDTLS_VERSION_NUMBER >= 0x04000000
...
#elif MBEDTLS_VERSION_NUMBER >= 0x03000000
...
#else
...
#endifYour commit simply drop all previous work in trash can without any explanations. After that all tries of backporting bug fixes to old LTS versions be more difficult for maintainers. |
|
Everything is possible, but it means to build the patch, maintain and mbedTLS 3.x has been released in 2021, 4+ years ago, and it's possible We've also dropped support for mbedTLS 2.x in curl. You should talk to distros and mbedTLS to provide updates and/or |
|
You can drop anything you want, but i want aware you from wrong decisions. You wrote what LTS Ubuntu 24.04 shipped with 2.x version, this mean what you doing this too early. You can watch https://ubuntu.com/about/release-cycle, this version has security support up to 5 year and full EOL only in 2036 ! |
|
Ubuntu doesn't ship newer libssh2 versions in a stable release. They're going
to ship libcurl 1.11.0 in 24.04 as long as they support it, patched with
security fixes. That version of libssh2 will support the same versions of
mbedtls in 5 years as it does today.
|
LTS distros ship with a compatible libssh2 release, which will continue Besides the above option, you are free to build a supported mbedTLS Saying we are supposed to use more |
In `_libssh2_mbedtls_pub_priv_key()` on a NON-error code path, a stack
variable was checked without initializing it first.
I found it interesting that clang-tidy did not find this when building
against the system mbedtls (2.x) with 2.x compatibility code still it.
Then it did find it when using a manual build of mbedtls 3.1.0 with
2.x compatibility code deleted from libssh2. Being such a trivial error
I wonder why no compiler ever detected it as a regular warning.
linux (clang-tidy, amd64, mbedTLS-prev [3.1.0], cmake, ON):
```
/home/runner/work/libssh2/libssh2/src/mbedtls.c:744:8: error: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch,-warnings-as-errors]
744 | if(ret) {
| ^
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18620615649/job/53091295760#step:22:44
Follow-up to 186f1a2 libssh2#132
Cherry-picked from libssh2#1727
In `_libssh2_mbedtls_pub_priv_key()` on a NON-error code path, a stack
variable was checked without initializing it first.
I found it interesting that clang-tidy did not find this when building
against the system mbedtls (2.x) with 2.x compatibility code still in.
Then it did find it when using a manual build of mbedtls 3.1.0 with
2.x compatibility code deleted from libssh2. Being such a trivial error
I wonder why no compiler ever detected it as a regular warning.
linux (clang-tidy, amd64, mbedTLS-prev [3.1.0], cmake, ON):
```
src/mbedtls.c:744:8: error: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch,-warnings-as-errors]
744 | if(ret) {
| ^
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18620615649/job/53091295760#step:22:44
Follow-up to 186f1a2 #132
Cherry-picked from #1727
Closes #1729
fd814f0 to
97949d3
Compare
```
/home/runner/work/libssh2/libssh2/src/mbedtls.c: In function ‘_libssh2_mbedtls_cipher_init’:
/home/runner/work/libssh2/libssh2/src/mbedtls.c:129:24: error: implicit declaration of function ‘mbedtls_cipher_info_get_key_bitlen’; did you mean ‘mbedtls_cipher_get_key_bitlen’? [-Wimplicit-function-declaration]
129 | (int)mbedtls_cipher_info_get_key_bitlen(cipher_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_cipher_get_key_bitlen
/home/runner/work/libssh2/libssh2/src/mbedtls.c:129:24: error: nested extern declaration of ‘mbedtls_cipher_info_get_key_bitlen’ [-Werror=nested-externs]
/home/runner/work/libssh2/libssh2/src/mbedtls.c:134:19: error: implicit declaration of function ‘mbedtls_cipher_info_get_iv_size’; did you mean ‘mbedtls_cipher_get_iv_size’? [-Wimplicit-function-declaration]
134 | mbedtls_cipher_info_get_iv_size(cipher_info));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_cipher_get_iv_size
/home/runner/work/libssh2/libssh2/src/mbedtls.c:134:19: error: nested extern declaration of ‘mbedtls_cipher_info_get_iv_size’ [-Werror=nested-externs]
```
https://github.com/libssh2/libssh2/actions/runs/18620223849/job/53090381294?pr=1727#step:22:49
There was a problem hiding this comment.
Pull request overview
This PR drops mbedTLS 2.x compatibility and raises the minimum supported mbedTLS version to 3.1.0 to simplify the backend and unblock future PSA/4.x-related work, while updating CI to install mbedTLS 3.x reliably on runners where distro packages are still 2.x.
Changes:
- Enforce mbedTLS >= 3.1.0 at compile time and in CMake configuration.
- Remove mbedTLS 2.x compatibility branches in the mbedTLS crypto backend implementation.
- Update GitHub Actions workflows to avoid distro
libmbedtls-dev(2.x) and install/build/cache mbedTLS 3.x instead.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/mbedtls.c |
Adds a hard compile-time minimum version check and removes 2.x compatibility code paths. |
CMakeLists.txt |
Adds a CMake-time version gate for mbedTLS >= 3.1.0. |
cmake/FindMbedTLS.cmake |
Simplifies version detection to only the 3.x+ header layout. |
.github/workflows/codeql.yml |
Switches Ubuntu CodeQL job to use Homebrew for mbedTLS instead of apt. |
.github/workflows/ci.yml |
Updates CI matrix and adds “prev” (3.1.0) mbedTLS-from-source install + cache logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The mbedTLS API is not one API but distinctly incompatible APIs
depending on its version. 2.x is largely incompatible with 3.x, and 4.x
is largely incompatible with 3.x, also dropping certain legacy crypto
primitives.
Following the release of 3.x in 2021, libssh2 added support for 3.x in
2022. 4.x was released in October 2025, and it makes using the PSA
Crypto API mandatory, after adding it in 3.x.
Supporting 2.x while also supporting the PSA Crypto API would mean
supporting 3 different crypto backends meshed together in a single
source file, with various overlapping and per-version parts, with
different features and separate needs to test.
2.x is also no longer maintained, supported, or security patched, as
written in its latest, and final, release notes on 2025-03-24:
https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-2.28.10
The mbedTLS project recommends upgrading to an upper major version.
To allow adding support for the PSA Crypto API and the 4.x series, and
to avoid an unmaintained 2.x major version, this patch drops support for
mbedTLS 2.x.
Also:
source and cache it.
with 3.0.0 due the use of API
mbedtls_cipher_info_get_key_bitlen().Nobody complained since the initial commit introducing it.
Refs:
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#asymmetric-cryptography
w/o sp: https://github.com/libssh2/libssh2/pull/1727/files?w=1
mbedTLS 4.0.0 was released yesterday with a new round of breaking changes.
Drop support for 2.x to give room for the upcoming complexity.
https://sources.debian.org/src/mbedtls/