Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gh-136306: Address first round of comments
  • Loading branch information
ronf committed Jul 5, 2025
commit 187ff2e1acaa02c8d595fc9ad0ecb645cb26e203
22 changes: 8 additions & 14 deletions Doc/library/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1645,17 +1645,15 @@

Get a list of groups implemented for key agreement, taking into account
the SSLContext's current TLS ``minimum_version`` and ``maximum_version``
Comment thread
picnixz marked this conversation as resolved.
Outdated
values.
values. For example::

Example::

>>> ctx = ssl.create_default_context()
>>> ctx.minimum_version=ssl.TLSVersion.TLSv1_3
>>> ctx.maximum_version=ssl.TLSVersion.TLSv1_3
>>> ctx.get_groups()
['secp256r1', 'secp384r1', 'secp521r1', 'x25519', 'x448', 'brainpoolP256r1tls13', 'brainpoolP384r1tls13', 'brainpoolP512r1tls13', 'ffdhe2048', 'ffdhe3072', 'ffdhe4096', 'ffdhe6144', 'ffdhe8192', 'MLKEM512', 'MLKEM768', 'MLKEM1024', 'SecP256r1MLKEM768', 'X25519MLKEM768', 'SecP384r1MLKEM1024'
>>> ctx = ssl.create_default_context()
Comment thread
picnixz marked this conversation as resolved.
Outdated
>>> ctx.minimum_version=ssl.TLSVersion.TLSv1_3
>>> ctx.maximum_version=ssl.TLSVersion.TLSv1_3
>>> 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
.. versionadded:: next

.. method:: SSLContext.set_default_verify_paths()

Expand Down Expand Up @@ -1689,7 +1687,7 @@
<https://docs.openssl.org/master/man3/SSL_CTX_set1_groups_list/>`_.
Comment thread
gpshead marked this conversation as resolved.

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

Check warning on line 1690 in Doc/library/ssl.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: SSLSocket.group [ref.meth]
Comment thread
picnixz marked this conversation as resolved.
return the group used for key agreement on that connection.

.. versionadded:: 3.15
Comment thread
picnixz marked this conversation as resolved.
Outdated
Comment thread
picnixz marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -1817,10 +1815,6 @@

.. versionadded:: 3.3

.. deprecated:: 3.15

This method has been replaced by :math:`set_groups`.

.. seealso::
`SSL/TLS & Perfect Forward Secrecy <https://vincent.bernat.ch/en/blog/2011-ssl-perfect-forward-secrecy>`_
Vincent Bernat.
Expand Down
8 changes: 6 additions & 2 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2154,11 +2154,15 @@ _ssl__SSLSocket_group_impl(PySSLSocket *self)
#if OPENSSL_VERSION_NUMBER >= 0x30200000L
const char *group_name;

if (self->ssl == NULL)
if (self->ssl == NULL) {
Py_RETURN_NONE;
}

group_name = SSL_get0_group_name(self->ssl);
if (group_name == NULL)
if (group_name == NULL) {
Py_RETURN_NONE;
}
Comment thread
picnixz marked this conversation as resolved.

return PyUnicode_DecodeFSDefault(group_name);
#else
PyErr_SetString(PyExc_NotImplementedError,
Expand Down
Loading