Move FFDH to decrepit - #15643
Open
reaperhulk wants to merge 5 commits into
Open
Move FFDH to decrepit#15643reaperhulk wants to merge 5 commits into
reaperhulk wants to merge 5 commits into
Conversation
Diffie-Hellman over finite fields was deprecated in 50.0.0 with the intent to remove it, but some protocols mandate it with no alternative to negotiate into (see #15603). Move it into cryptography.hazmat.decrepit.asymmetric.dh, alongside the parameter loaders, which are FFDH-only. The names in cryptography.hazmat.primitives.asymmetric.dh, load_pem_parameters/load_der_parameters in serialization, and loading FFDH keys with the generic key loading APIs still warn, but the warning now says FFDH has moved to decrepit and will only be available there starting in 53.0.0. The deprecated DH shim now takes every value from the decrepit module directly: previously the *WithSerialization aliases wrapped the deprecation marker of the base name rather than the class, because each utils.deprecated call replaces the module global it names. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TmnZQpY2o4HeBNFN5tfqYE
Historical changelog entries link to the classes at their original documentation path, and Sphinx runs in nitpicky mode, so the page keeps documenting them (as the decrepit cipher and mode pages do) with a warning pointing at the decrepit module. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TmnZQpY2o4HeBNFN5tfqYE
The BoringSSL CI jobs failed because the new tests built DH parameters without the `dh_supported` guard the other DH tests use. Also use the 3072-bit fixture rather than generating 512-bit parameters, which FIPS builds reject. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TmnZQpY2o4HeBNFN5tfqYE
reaperhulk
commented
Sep 15, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TmnZQpY2o4HeBNFN5tfqYE
alex
reviewed
Sep 15, 2026
| "algorithm." | ||
| "Diffie-Hellman over finite fields (FFDH) is deprecated and has been " | ||
| "moved to cryptography.hazmat.decrepit.asymmetric.dh. Starting in " | ||
| "53.0.0 it will only be available from that module." |
Member
There was a problem hiding this comment.
Ugh, I really feel like this is moving backwards on the deprecation, and therefore suggests we're prepared to carry it forever, which I really don't want to be.
The old primitives page is now a short stub pointing at the decrepit module instead of a full copy of the reference. Historical changelog entries cross-reference the decrepit page so Sphinx's nitpicky build still resolves them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TmnZQpY2o4HeBNFN5tfqYE
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.
Addresses #15603.
Diffie-Hellman over finite fields (FFDH) was deprecated in 50.0.0 on the way to removal, but some protocols mandate it with no alternative to negotiate into. This moves it into
cryptography.hazmat.decrepit.asymmetric.dh, following the pattern used for the decrepit ciphers and modes, and keeps every existing deprecation warning with reworded text: FFDH is deprecated and will only be available from the decrepit module starting in 53.0.0.What moved
cryptography.hazmat.decrepit.asymmetric.dhnow holdsgenerate_parameters, theDHParameters/DHPrivateKey/DHPublicKeyABCs, the three numbers classes, andload_pem_parameters/load_der_parameters(these can only load FFDH parameters, so they belong with it). Nothing in the decrepit module warns.cryptography.hazmat.primitives.asymmetric.dhbecomes a shim that re-exports the same objects viautils.deprecated, soisinstancechecks against either path keep working. The warning class isDeprecatedIn51with removal targeted at 53.0.0, matching the two-release window.serialization.load_pem_parameters/load_der_parametersstay deprecated, with the "has been moved to ... and will be removed from ... in 53.0.0" wording the Camellia and CFB/OFB moves used.public_key()) hand back a DH key is kept and reworded the same way.DEPRECATED_IN_50intypes.rswas only used there and is removed.asymmetric.typesnow takes the DH types from the decrepit module instead of the_DHPublicKey/_DHPrivateKeyprivate aliases, which are dropped.Bug fixed along the way
The old shim (and
dsa.pytoday, not touched here) calledutils.deprecated(DHParameters, ..., name="DHParametersWithSerialization")afterutils.deprecated(DHParameters, ..., name="DHParameters")had already replaced the module global with the_DeprecatedValuemarker, so the...WithSerializationaliases resolved to the marker object instead of the class. The new shim reads every value from the decrepit module directly, and the new test covers all ten names.Docs and tests
docs/hazmat/decrepit/dh.rstdocuments the decrepit module (withversionadded:: 51.0.0markers and doctests for the parameter loaders). The oldprimitives/asymmetric/dh.rstkeeps its content with a "moved to decrepit" warning, as the cipher and mode pages do, so older changelog cross-references still resolve under nitpicky mode.TestFFDHDeprecationchecks the old module names, the serialization loaders, the generic key loaders, and that the decrepit path is warning-free.One design point for reviewers
Loading FFDH keys through
load_pem_private_keyand friends still warns, as requested ("keep the warnings"). The decrepit module deliberately does not grow its own PEM/DER key loaders in this PR, so if the intent for 53.0.0 is that the generic loaders stop returning DH keys, a follow-up would need to add those; if instead the generic loaders should keep working and return the decrepit types, the Rust warning can simply be removed later.nox -e localpasses in full.nox -e docsbuilds cleanly under-W; the only doctest failures locally are in unrelated pages (Argon2, AES-GCM-SIV, SHAKEsqueeze) because the container's system OpenSSL 3.0.13 lacks them.🤖 Generated with Claude Code
https://claude.ai/code/session_01TmnZQpY2o4HeBNFN5tfqYE
Generated by Claude Code