Skip to content

gh-136306: Add support for SSL groups #136307

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

ronf
Copy link
Contributor

@ronf ronf commented Jul 4, 2025

This is an initial implementation of the feature proposed in issue #136306.


📚 Documentation preview 📚: https://cpython-previews--136307.org.readthedocs.build/

This is an initial implementation of the feature proposed in issue python#136306.
@picnixz picnixz changed the title gh-136306: Initial cut at SSL groups support gh-136306: Add support for SSL groups Jul 5, 2025
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

A first round of comments

>>> ctx.get_groups()
['secp256r1', 'secp384r1', 'secp521r1', 'x25519', 'x448', 'brainpoolP256r1tls13', 'brainpoolP384r1tls13', 'brainpoolP512r1tls13', 'ffdhe2048', 'ffdhe3072', 'ffdhe4096', 'ffdhe6144', 'ffdhe8192', 'MLKEM512', 'MLKEM768', 'MLKEM1024', 'SecP256r1MLKEM768', 'X25519MLKEM768', 'SecP384r1MLKEM1024'

.. versionadded:: 3.15
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.. versionadded:: 3.15
.. versionadded:: next

Comment on lines +1648 to +1650
values.

Example::
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
values.
Example::
values. For example::

And remove the indentation in the example (I don't think it's necessary)

<https://docs.openssl.org/master/man3/SSL_CTX_set1_groups_list/>`_.

.. note::
when connected, the :meth:`SSLSocket.group` method of SSL sockets will
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
when connected, the :meth:`SSLSocket.group` method of SSL sockets will
When connected, the :meth:`SSLSocket.group` method of SSL sockets will

@@ -1789,6 +1817,10 @@ to speed up repeated connections from the same clients.

.. versionadded:: 3.3

.. deprecated:: 3.15
Copy link
Member

Choose a reason for hiding this comment

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

This should be done in a separate PR as it would be better to raise a warning. Leave it supported for now.

@@ -0,0 +1 @@
:mod:`ssl` can now get and set groups used for key agreement.
Copy link
Member

Choose a reason for hiding this comment

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

We need a what's new entry as well.

if (self->ssl == NULL)
Py_RETURN_NONE;
group_name = SSL_get0_group_name(self->ssl);
if (group_name == NULL)
Copy link
Member

Choose a reason for hiding this comment

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

Please follow PEP-7 for new code (add braces).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants