Skip to content

Commit bfe6d76

Browse files
committed
Address Feedback
1 parent ab69205 commit bfe6d76

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

tests/integrationv2/test_pq_handshake.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,34 @@
2626
]
2727

2828
EXPECTED_RESULTS = {
29-
# The tuple keys have the form (client_{cipher, kem_group}, server_{cipher, kem_group})
29+
# The tuple keys have the form:
30+
# (client_{cipher, kem_group}, server_{cipher, kem_group}): {"cipher": {expected_cipher}, "kem_group": {expected_kem_group}}
3031
(Ciphers.PQ_TLS_1_0_2023_01, Ciphers.PQ_TLS_1_0_2023_01):
3132
{"cipher": "TLS_AES_256_GCM_SHA384",
32-
"kem": None, "kem_group": "_kyber-512-r3"},
33+
"kem_group": "_kyber-512-r3"},
3334
(KemGroups.P384_KYBER768R3, Ciphers.PQ_TLS_1_3_2023_06_01):
34-
{"cipher": "AES256_GCM_SHA384", "kem": None,
35-
"kem_group": "secp384r1_kyber-768-r3"},
35+
{"cipher": "AES256_GCM_SHA384",
36+
"kem_group": "secp384r1_kyber-768-r3"},
3637
(KemGroups.P521_KYBER1024R3, Ciphers.PQ_TLS_1_3_2023_06_01):
37-
{"cipher": "AES256_GCM_SHA384", "kem": None,
38-
"kem_group": "secp521r1_kyber-1024-r3"},
38+
{"cipher": "AES256_GCM_SHA384",
39+
"kem_group": "secp521r1_kyber-1024-r3"},
3940
(Ciphers.PQ_TLS_1_3_2023_06_01, KemGroups.X25519Kyber768Draft00):
4041
{"cipher": "TLS_AES_256_GCM_SHA384",
41-
"kem": None,
4242
"kem_group": "X25519Kyber768Draft00"},
4343
(Ciphers.PQ_TLS_1_3_2023_06_01, KemGroups.SecP256r1Kyber768Draft00):
4444
{"cipher": "TLS_AES_256_GCM_SHA384",
45-
"kem": None,
4645
"kem_group": "SecP256r1Kyber768Draft00"},
4746
(Ciphers.PQ_TLS_1_3_2023_06_01, Ciphers.PQ_TLS_1_3_2023_06_01):
4847
{"cipher": "TLS_AES_256_GCM_SHA384",
49-
"kem": None,
5048
"kem_group": "SecP256r1Kyber768Draft00"},
5149
(Ciphers.PQ_TLS_1_3_2023_06_01, Ciphers.KMS_TLS_1_0_2018_10):
5250
{"cipher": "ECDHE-RSA-AES256-GCM-SHA384",
53-
"kem": None,
5451
"kem_group": None},
5552
(Ciphers.KMS_TLS_1_0_2018_10, Ciphers.PQ_TLS_1_3_2023_06_01):
5653
{"cipher": "ECDHE-RSA-AES128-GCM-SHA256",
57-
"kem": None,
5854
"kem_group": None},
5955
(Ciphers.KMS_TLS_1_0_2018_10, Ciphers.KMS_TLS_1_0_2018_10):
6056
{"cipher": "ECDHE-RSA-AES256-GCM-SHA384",
61-
"kem": None,
6257
"kem_group": None},
6358
}
6459

@@ -95,16 +90,12 @@ def assert_s2n_negotiation_parameters(s2n_results, expected_result):
9590
if expected_result is not None:
9691
assert to_bytes(
9792
("Cipher negotiated: " + expected_result['cipher'])) in s2n_results.stdout
98-
if expected_result['kem']:
99-
assert to_bytes(
100-
("KEM: " + expected_result['kem'])) in s2n_results.stdout
101-
assert to_bytes(PQ_ENABLED_FLAG) in s2n_results.stdout
10293
if expected_result['kem_group']:
10394
# Purposefully leave off the "KEM Group: " prefix in order to perform partial matches
10495
# without specifying the curve.
10596
assert to_bytes(expected_result['kem_group']) in s2n_results.stdout
10697
assert to_bytes(PQ_ENABLED_FLAG) in s2n_results.stdout
107-
if not expected_result['kem'] and not expected_result['kem_group']:
98+
if not expected_result['kem_group']:
10899
assert to_bytes(PQ_ENABLED_FLAG) not in s2n_results.stdout
109100
assert to_bytes("Curve:") in s2n_results.stdout
110101

@@ -161,7 +152,7 @@ def test_s2nc_to_s2nd_pq_handshake(managed_process, protocol, certificate, clien
161152
# If PQ is not enabled in s2n, we expect classic handshakes to be negotiated.
162153
# Leave the expected cipher blank, as there are multiple possibilities - the
163154
# important thing is that kem and kem_group are NONE.
164-
expected_result = {"cipher": "", "kem": None, "kem_group": None}
155+
expected_result = {"cipher": "", "kem_group": None}
165156

166157
# Client and server are both s2n; can make meaningful assertions about negotiation for both
167158
for results in client.get_results():

0 commit comments

Comments
 (0)