Repository navigation
Handle InternalError in KexMLKEM768X25519 and KexCurve25519 is_available - #2716
Open
JakkulaVeerababu wants to merge 1 commit into
Open
JakkulaVeerababu wants to merge 1 commit into
JakkulaVeerababu wants to merge 1 commit into
Conversation
Under OpenSSL FIPS mode or with providers that do not implement ML-KEM or X25519, key generation raises cryptography.exceptions.InternalError rather than UnsupportedAlgorithm. Because Transport initializes algorithms at import time, unhandled InternalError aborts importing paramiko. Catch InternalError alongside UnsupportedAlgorithm in is_available() so unavailable algorithms are gracefully excluded from preferred key exchanges. Fixes paramiko#2712.
Author
|
@bitprophet could you take a look when you have time? It catches |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2712 (and related #2442).
In environments where ML-KEM or X25519 is unsupported by the underlying OpenSSL provider (such as FIPS mode or custom provider configurations),
cryptographyraisescryptography.exceptions.InternalErrorwhen attempting key generation (generate()), rather thanUnsupportedAlgorithm.Because
Transportevaluates available key exchanges during class initialization at module import time, an unhandledInternalErrorinKexMLKEM768X25519.is_available()abortsimport paramikobefore any SSH connection can be established.Changes
paramiko/kex_mlkem.py: catch(UnsupportedAlgorithm, InternalError)inKexMLKEM768X25519.is_available().paramiko/kex_curve25519.py: catch(UnsupportedAlgorithm, InternalError)inKexCurve25519.is_available().tests/test_kex.py: addKexAvailabilityTestverifyingis_available()returnsFalsewhenInternalErrororUnsupportedAlgorithmis raised during key generation.sites/www/changelog.rst: add changelog entry for:bug:2712.