Skip to content

mbedtls: drop unused Blowfish, RC4, make 3DES conditional - #2277

Closed
vszakats wants to merge 2 commits into
libssh2:masterfrom
vszakats:mbedobs
Closed

vszakats wants to merge 2 commits into
libssh2:masterfrom
vszakats:mbedobs

Conversation

@vszakats

@vszakats vszakats commented Jul 12, 2026 •

Copy link
Copy Markdown
Member

RC4 and Blowfish not supported by mbedTLS 3+.
3DES not supported by mbedTLS 4+.

Follow-up to f63f68b #1727


https://github.com/libssh2/libssh2/pull/2277/files?w=1

@vszakats vszakats changed the title mbedtls: drop RC4, Blowfish, make DES3 conditional mbedtls: drop RC4, Blowfish, make 3DES conditional Jul 12, 2026
@vszakats vszakats changed the title mbedtls: drop RC4, Blowfish, make 3DES conditional mbedtls: drop unused Blowfish, RC4, make 3DES conditional Jul 12, 2026
@vszakats

vszakats commented Jul 12, 2026 •

Copy link
Copy Markdown
Member Author

Regarding 4.0 support: It's a sad transition story; almost all things seem to be
supported by the PSA API, but parsing key files in a way compatible with it
requires 3.6.0+. I cannot spot a way to remedy this without keeping basically
two mbedtls implementations, the existing (non-PSA) one for 3.x and a PSA
one for 4.x. I find this a subpar option, because maintaining 5 backends is already
an enourmous strain, and making that 6, with two mbedTLS ones is not helping.

Another option is to stop relying on mbedTLS' built-in key parser, and use pem.c
instead. This reduces the number of supported key formats with mbedTLS, but
restores compatibility with mbedTLS 2.x, which already supports the PSA API
bits necessary for libssh2. The key formats lost this way are the legacy PKCS8
ones and PEM EC, which is probably fine, as it offer bad or worse security and
have never been tested in CI either. But also may break compatibility for those
relying on them in combination with mbedTLS.

Though a precise assessment of which backends/versions support which
formats exactly would be nice.

Regardless I tend to like this option, because the missing parsing bits may be
implemented in libssh2, and most other backends would benefit from it too.

(Another option is to bump the minimum from 3.1 to 3.6.)

@vszakats vszakats closed this in b684520 Jul 12, 2026
@vszakats
vszakats deleted the mbedobs branch July 12, 2026 19:42
@vszakats
vszakats requested a review from Copilot July 12, 2026 19:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the mbedTLS backend feature flags and cipher mappings to reflect ciphers removed from newer mbedTLS major versions (3+ and 4+), aligning libssh2’s advertised/compiled cipher support with what mbedTLS can actually provide.

Changes:

  • Hard-disables Blowfish and RC4 for the mbedTLS backend.
  • Makes 3DES support conditional and wraps 3DES-specific cipher mapping and padding-mode handling with LIBSSH2_3DES.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/mbedtls.h Disables Blowfish/RC4; makes 3DES availability conditional; conditionally defines ssh2_cipher_3des.
src/mbedtls.c Makes CBC padding-mode handling conditional for 3DES.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/mbedtls.h
Comment on lines +86 to 90
#ifdef MBEDTLS_CIPHER_DES_EDE3_CBC
# define LIBSSH2_3DES 1
#else
# define LIBSSH2_RC4 0
# define LIBSSH2_3DES 0
#endif
vszakats added a commit to vszakats/libssh2 that referenced this pull request Jul 13, 2026
`MBEDTLS_CIPHER_*` are not macros upstream.

Follow-up to b684520 libssh2#2277
Follow-up to f1d60b1
vszakats added a commit that referenced this pull request Jul 13, 2026
`MBEDTLS_CIPHER_*` are not macros upstream.

Follow-up to b684520 #2277
Follow-up to f1d60b1

Closes #2286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants