Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ronf wants to merge16 commits intopython:main
base:main
Choose a base branch
Loading
fromronf:ssl-group-support
Open
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
662d66e
gh-136306: Initial cut at SSL groups support
ronfJul 4, 2025
9acb2c3
Fix regen and lint issues
ronfJul 4, 2025
03072c4
📜🤖 Added by blurb_it.
blurb-it[bot]Jul 4, 2025
187ff2e
gh-136306: Address first round of comments
ronfJul 5, 2025
452bdec
gh-136306: Add back indentation of example
ronfJul 5, 2025
9b4066b
gh-136306: Handle another allocation failure in get_groups()
ronfJul 5, 2025
a6ad433
gh-136306: Address additional review comments
ronfJul 5, 2025
aecc96b
gh-136306: Fix method references in whatsnew entry.
ronfJul 5, 2025
05c75a5
gh-136306: Add missing documentation for SSLSocket.group()
ronfJul 5, 2025
304c223
gh-136306: Address additional review comments
ronfJul 6, 2025
b516200
gh-136306: Minor doc updates
ronfJul 7, 2025
e0fdd25
gh-136306: Missed one
ronfJul 7, 2025
35a3ae0
gh-136306: Address additional review comments
ronfJul 12, 2025
e0baf56
Add checks that cipher() and group() return None on handshake failure
ronfJul 12, 2025
c5a1146
Merge branch 'main' into ssl-group-support
ronfJul 19, 2025
5e626a6
gh-136306: Regenerate clinic signature to fix missing end fo line
ronfJul 19, 2025
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
PrevPrevious commit
NextNext commit
gh-136306: Address additional review comments
  • Loading branch information
@ronf
ronf committedJul 12, 2025
commit35a3ae0896dfd4cd4522aa3479ec32aa080308f5
9 changes: 1 addition & 8 deletionsLib/test/test_ssl.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -964,22 +964,15 @@ def test_get_ciphers(self):

def test_set_groups(self):
ctx = ssl.create_default_context()

# Test valid group list
self.assertIsNone(ctx.set_groups('P-256:X25519'))

# Test invalid group list
self.assertRaises(ssl.SSLError, ctx.set_groups, 'P-256:xxx')

@unittest.skipUnless(CAN_GET_AVAILABLE_OPENSSL_GROUPS,
"OpenSSL version doesn't support getting groups")
def test_get_groups(self):
ctx = ssl.create_default_context()

# P-256 isn't an IANA name, so it shouldn't be returned by default
# By default, only return official IANA names.
self.assertNotIn('P-256', ctx.get_groups())

# Aliases like P-256 sbould be returned when include_aliases is set
self.assertIn('P-256', ctx.get_groups(include_aliases=True))

def test_options(self):
Expand Down
4 changes: 2 additions & 2 deletionsModules/_ssl.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3462,7 +3462,7 @@ _ssl__SSLContext_get_groups_impl(PySSLContext *self, int include_aliases)
#if OPENSSL_VERSION_NUMBER >= 0x30500000L
STACK_OF(OPENSSL_CSTRING) *groups = NULL;
const char *group;
size_t i, num;
int i, num;
PyObject *item, *result = NULL;

// This "groups" object is dynamically allocated, but the strings inside
Expand DownExpand Up@@ -3492,7 +3492,7 @@ _ssl__SSLContext_get_groups_impl(PySSLContext *self, int include_aliases)
// Group names are plain ASCII, so there's no chance of a decoding
// error here. However, an allocation failure could occur when
// constructing the Unicode version of the names.
item =PyUnicode_DecodeFSDefault(group);
item =PyUnicode_DecodeASCII(group, strlen(group), "strict");
if (item == NULL) {
_setSSLError(get_state_ctx(self), "Can't allocate group name", 0, __FILE__, __LINE__);
goto error;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp