GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-128035: Add ssl.HAS_PHA to detect libssl PHA support by WillChilds-Klein · Pull Request #128036 · python/cpython

gh-128035: Add ssl.HAS_PHA to detect libssl PHA support #128036

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.

Sign up for GitHub

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

Merged
gpshead merged 9 commits into python:main from WillChilds-Klein:ssl-add-has-pha-property
Dec 24, 2024

Uh oh!

There was an error while loading. Please reload this page.

Merged

gh-128035: Add ssl.HAS_PHA to detect libssl PHA support #128036

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
9 commits
Select commit Hold shift + click to select a range
7293bec
Add ssl.HAS_PHA to detect libssl PHA support
WillChilds-Klein Dec 17, 2024
9543715
📜🤖 Added by blurb_it.
blurb-it[bot] Dec 17, 2024
0c8f5dd
Update Doc/library/ssl.rst
WillChilds-Klein Dec 17, 2024
fcb7190
Fix news lint
WillChilds-Klein Dec 17, 2024
f7850fd
Update Doc/library/ssl.rst
WillChilds-Klein Dec 17, 2024
57ce78f
Update Lib/test/test_httplib.py
WillChilds-Klein Dec 17, 2024
65e6a0d
Shorten news entry, update whatsnew
WillChilds-Klein Dec 17, 2024
63df081
Move whatsnew section
WillChilds-Klein Dec 17, 2024
a3548a8
Fix whatsnew formatting
WillChilds-Klein Dec 23, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

6 changes: 6 additions & 0 deletions 6 Doc/library/ssl.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,12 @@ Constants

.. versionadded:: 3.13

.. data:: HAS_PHA

Whether the OpenSSL library has built-in support for TLS-PHA.

.. versionadded:: next

.. data:: CHANNEL_BINDING_TYPES

List of supported TLS channel binding types. Strings in this list
Expand Down
8 changes: 8 additions & 0 deletions 8 Doc/whatsnew/3.14.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,14 @@ pydoc
(Contributed by Jelle Zijlstra in :gh:`101552`.)


ssl
---

* Indicate through :data:`ssl.HAS_PHA` whether the :mod:`ssl` module supports
TLSv1.3 post-handshake client authentication (PHA).
Comment thread
Comment on lines +586 to +587

@picnixz picnixz Dec 24, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggested change
* Indicate through :data:`ssl.HAS_PHA` whether the :mod:`ssl` module supports
TLSv1.3 post-handshake client authentication (PHA).
* Indicate through :data:`ssl.HAS_PHA` whether the :mod:`ssl` module
supports TLSv1.3 post-handshake client authentication (PHA).

(just for reducing the line length and make it look more uniform, but this is entirely optional and a matter of taste; my previous suggestion may even have been incorrect in that regard).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
(Contributed by Will Childs-Klein in :gh:`128036`.)


symtable
--------

Expand Down
2 changes: 1 addition & 1 deletion 2 Lib/ssl.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

from _ssl import (
HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN, HAS_SSLv2, HAS_SSLv3, HAS_TLSv1,
HAS_TLSv1_1, HAS_TLSv1_2, HAS_TLSv1_3, HAS_PSK
HAS_TLSv1_1, HAS_TLSv1_2, HAS_TLSv1_3, HAS_PSK, HAS_PHA
)
from _ssl import _DEFAULT_CIPHERS, _OPENSSL_API_VERSION

Expand Down
4 changes: 2 additions & 2 deletions 4 Lib/test/test_httplib.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2073,8 +2073,8 @@ def test_host_port(self):

def test_tls13_pha(self):
import ssl
if not ssl.HAS_TLSv1_3:
self.skipTest('TLS 1.3 support required')
if not ssl.HAS_TLSv1_3 or not ssl.HAS_PHA:
self.skipTest('TLS 1.3 PHA support required')
# just check status of PHA flag
h = client.HTTPSConnection('localhost', 443)
self.assertTrue(h._context.post_handshake_auth)
Expand Down
3 changes: 2 additions & 1 deletion 3 Lib/test/test_ssl.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4494,7 +4494,8 @@ def server_callback(identity):
s.connect((HOST, server.port))


@unittest.skipUnless(has_tls_version('TLSv1_3'), "Test needs TLS 1.3")
@unittest.skipUnless(has_tls_version('TLSv1_3') and ssl.HAS_PHA,
"Test needs TLS 1.3 PHA")
class TestPostHandshakeAuth(unittest.TestCase):
def test_pha_setter(self):
protocols = [
Expand Down
1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Core_and_Builtins/2024-12-17-18-20-37.gh-issue-128035.JwqHdB.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Indicate through :data:`ssl.HAS_PHA` whether the :mod:`ssl` module supports TLSv1.3 post-handshake client authentication (PHA). Patch by Will Childs-Klein.
6 changes: 6 additions & 0 deletions 6 Modules/_ssl.c
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6553,6 +6553,12 @@ sslmodule_init_constants(PyObject *m)
addbool(m, "HAS_PSK", 1);
#endif

#ifdef SSL_VERIFY_POST_HANDSHAKE
addbool(m, "HAS_PHA", 1);
#else
addbool(m, "HAS_PHA", 0);
#endif

#undef addbool
#undef ADD_INT_CONST

Expand Down
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.