Skip to content

Commit a31eefa

Browse files
authored
Fallback for failure in setting ML-KEM SSL groups (#853)
1 parent a5981aa commit a31eefa

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

‎.basedpyright/baseline.json‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3769,14 +3769,6 @@
37693769
"lineCount": 1
37703770
}
37713771
},
3772-
{
3773-
"code": "reportUnnecessaryTypeIgnoreComment",
3774-
"range": {
3775-
"startColumn": 55,
3776-
"endColumn": 78,
3777-
"lineCount": 1
3778-
}
3779-
},
37803772
{
37813773
"code": "reportUnknownArgumentType",
37823774
"range": {

‎splunklib/binding.py‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,11 +1751,17 @@ def connect(scheme, host, port):
17511751
# with patched python that includes set_groups on 3.9 and 3.13, thus we
17521752
# check for the existence of set_groups, not the python version.
17531753
if hasattr(ctx, "set_groups"):
1754-
ctx.set_groups( # pyright: ignore[reportUnknownMemberType, reportAttributeAccessIssue]
1755-
"X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024:"
1756-
+ "MLKEM512:MLKEM768:MLKEM1024:"
1757-
+ "X25519:secp256r1:X448:secp384r1:secp521r1:ffdhe2048:ffdhe3072"
1758-
)
1754+
try:
1755+
ctx.set_groups( # pyright: ignore[reportAttributeAccessIssue]
1756+
"X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024:"
1757+
+ "MLKEM512:MLKEM768:MLKEM1024:"
1758+
+ "X25519:secp256r1:X448:secp384r1:secp521r1:ffdhe2048:ffdhe3072"
1759+
)
1760+
except ssl.SSLError:
1761+
# FIPS providers (and OpenSSL builds without ML-KEM) reject the
1762+
# ML-KEM group names — fall back to the default groups rather
1763+
# than failing every connection.
1764+
pass
17591765
kwargs["context"] = ctx
17601766
elif context:
17611767
# verify is True in elif branch and context is not None

0 commit comments

Comments
 (0)