|
14 | 14 |
|
15 | 15 | CIPHERS = [
|
16 | 16 | None, # `None` will default to the appropriate `test_all` cipher preference in the S2N client provider
|
17 |
| - Ciphers.KMS_PQ_TLS_1_0_2019_06, |
18 |
| - Ciphers.KMS_PQ_TLS_1_0_2020_02, |
19 |
| - Ciphers.KMS_PQ_TLS_1_0_2020_07, |
20 |
| - Ciphers.PQ_SIKE_TEST_TLS_1_0_2019_11, |
21 |
| - Ciphers.PQ_SIKE_TEST_TLS_1_0_2020_02, |
22 | 17 | Ciphers.KMS_TLS_1_0_2018_10,
|
23 |
| - Ciphers.PQ_TLS_1_0_2020_12, |
24 | 18 | Ciphers.PQ_TLS_1_3_2023_06_01,
|
25 | 19 | ]
|
26 | 20 |
|
|
32 | 26 | ]
|
33 | 27 |
|
34 | 28 | EXPECTED_RESULTS = {
|
35 |
| - # The tuple keys have the form (client_{cipher, kem_group}, server_{cipher, kem_group}) |
36 |
| - (Ciphers.KMS_PQ_TLS_1_0_2019_06, Ciphers.KMS_PQ_TLS_1_0_2019_06): |
37 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
38 |
| - "kem": None, "kem_group": None}, |
39 |
| - (Ciphers.KMS_PQ_TLS_1_0_2019_06, Ciphers.KMS_PQ_TLS_1_0_2020_02): |
40 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
41 |
| - "kem": None, "kem_group": None}, |
42 |
| - (Ciphers.KMS_PQ_TLS_1_0_2019_06, Ciphers.KMS_PQ_TLS_1_0_2020_07): |
43 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
44 |
| - "kem": None, "kem_group": None}, |
45 |
| - |
46 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_02, Ciphers.KMS_PQ_TLS_1_0_2019_06): |
47 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
48 |
| - "kem": None, "kem_group": None}, |
49 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_02, Ciphers.KMS_PQ_TLS_1_0_2020_02): |
50 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
51 |
| - "kem": None, "kem_group": None}, |
52 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_02, Ciphers.KMS_PQ_TLS_1_0_2020_07): |
53 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
54 |
| - "kem": None, "kem_group": None}, |
55 |
| - |
56 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_07, Ciphers.KMS_PQ_TLS_1_0_2019_06): |
57 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
58 |
| - "kem": None, "kem_group": None}, |
59 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_07, Ciphers.KMS_PQ_TLS_1_0_2020_02): |
60 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
61 |
| - "kem": None, "kem_group": None}, |
62 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_07, Ciphers.KMS_PQ_TLS_1_0_2020_07): |
63 |
| - {"cipher": "ECDHE-KYBER-RSA-AES256-GCM-SHA384", |
64 |
| - "kem": "kyber512r3", "kem_group": None}, |
65 |
| - |
66 |
| - (Ciphers.PQ_SIKE_TEST_TLS_1_0_2019_11, Ciphers.KMS_PQ_TLS_1_0_2019_06): |
67 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
68 |
| - "kem": None, "kem_group": None}, |
69 |
| - (Ciphers.PQ_SIKE_TEST_TLS_1_0_2019_11, Ciphers.KMS_PQ_TLS_1_0_2020_02): |
70 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
71 |
| - "kem": None, "kem_group": None}, |
72 |
| - (Ciphers.PQ_SIKE_TEST_TLS_1_0_2019_11, Ciphers.KMS_PQ_TLS_1_0_2020_07): |
73 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
74 |
| - "kem": None, "kem_group": None}, |
75 |
| - |
76 |
| - (Ciphers.PQ_SIKE_TEST_TLS_1_0_2020_02, Ciphers.KMS_PQ_TLS_1_0_2019_06): |
77 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
78 |
| - "kem": None, "kem_group": None}, |
79 |
| - (Ciphers.PQ_SIKE_TEST_TLS_1_0_2020_02, Ciphers.KMS_PQ_TLS_1_0_2020_02): |
80 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
81 |
| - "kem": None, "kem_group": None}, |
82 |
| - (Ciphers.PQ_SIKE_TEST_TLS_1_0_2020_02, Ciphers.KMS_PQ_TLS_1_0_2020_07): |
83 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
84 |
| - "kem": None, "kem_group": None}, |
85 |
| - |
86 |
| - (Ciphers.KMS_PQ_TLS_1_0_2019_06, Ciphers.KMS_TLS_1_0_2018_10): |
87 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
88 |
| - "kem": None, "kem_group": None}, |
89 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_02, Ciphers.KMS_TLS_1_0_2018_10): |
90 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
91 |
| - "kem": None, "kem_group": None}, |
92 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_07, Ciphers.KMS_TLS_1_0_2018_10): |
93 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
94 |
| - "kem": None, "kem_group": None}, |
95 |
| - |
96 |
| - (Ciphers.KMS_TLS_1_0_2018_10, Ciphers.KMS_PQ_TLS_1_0_2019_06): |
97 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
98 |
| - "kem": None, "kem_group": None}, |
99 |
| - (Ciphers.KMS_TLS_1_0_2018_10, Ciphers.KMS_PQ_TLS_1_0_2020_02): |
100 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
101 |
| - "kem": None, "kem_group": None}, |
102 |
| - (Ciphers.KMS_TLS_1_0_2018_10, Ciphers.KMS_PQ_TLS_1_0_2020_07): |
103 |
| - {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
104 |
| - "kem": None, "kem_group": None}, |
105 |
| - |
106 |
| - # The expected kem_group string for this case purposefully excludes a curve; |
107 |
| - # depending on how s2n was compiled, the curve may be either x25519 or one |
108 |
| - # of the NIST curves. |
109 |
| - (Ciphers.PQ_TLS_1_0_2020_12, Ciphers.PQ_TLS_1_0_2020_12): |
110 |
| - {"cipher": "TLS_AES_256_GCM_SHA384", |
111 |
| - "kem": None, "kem_group": "_kyber-512-r3"}, |
112 |
| - (Ciphers.PQ_TLS_1_0_2020_12, Ciphers.PQ_TLS_1_0_2023_01): |
113 |
| - {"cipher": "TLS_AES_256_GCM_SHA384", |
114 |
| - "kem": None, "kem_group": "_kyber-512-r3"}, |
| 29 | + # The tuple keys have the form: |
| 30 | + # (client_{cipher, kem_group}, server_{cipher, kem_group}): {"cipher": {expected_cipher}, "kem_group": {expected_kem_group}} |
115 | 31 | (Ciphers.PQ_TLS_1_0_2023_01, Ciphers.PQ_TLS_1_0_2023_01):
|
116 | 32 | {"cipher": "TLS_AES_256_GCM_SHA384",
|
117 |
| - "kem": None, "kem_group": "_kyber-512-r3"}, |
118 |
| - (Ciphers.PQ_TLS_1_0_2023_01, Ciphers.PQ_TLS_1_0_2020_12): |
119 |
| - {"cipher": "TLS_AES_256_GCM_SHA384", |
120 |
| - "kem": None, "kem_group": "_kyber-512-r3"}, |
121 |
| - (Ciphers.PQ_TLS_1_0_2020_12, Ciphers.KMS_PQ_TLS_1_0_2020_07): |
122 |
| - {"cipher": "ECDHE-KYBER-RSA-AES256-GCM-SHA384", |
123 |
| - "kem": "kyber512r3", "kem_group": None}, |
124 |
| - (Ciphers.KMS_PQ_TLS_1_0_2020_07, Ciphers.PQ_TLS_1_0_2020_12): |
125 |
| - {"cipher": "ECDHE-KYBER-RSA-AES256-GCM-SHA384", |
126 |
| - "kem": "kyber512r3", "kem_group": None}, |
127 |
| - (Ciphers.PQ_TLS_1_0_2020_12, KemGroups.P256_KYBER512R3): |
128 |
| - {"cipher": "AES256_GCM_SHA384", "kem": None, |
129 |
| - "kem_group": "secp256r1_kyber-512-r3"}, |
130 |
| - (KemGroups.P256_KYBER512R3, Ciphers.PQ_TLS_1_0_2020_12): |
131 |
| - {"cipher": "AES256_GCM_SHA384", "kem": None, |
132 |
| - "kem_group": "secp256r1_kyber-512-r3"}, |
133 |
| - (KemGroups.P256_KYBER512R3, Ciphers.PQ_TLS_1_0_2023_01): |
134 |
| - {"cipher": "AES256_GCM_SHA384", "kem": None, |
135 |
| - "kem_group": "secp256r1_kyber-512-r3"}, |
136 |
| - (KemGroups.P256_KYBER512R3, Ciphers.PQ_TLS_1_3_2023_06_01): |
137 |
| - {"cipher": "AES256_GCM_SHA384", "kem": None, |
138 |
| - "kem_group": "secp256r1_kyber-512-r3"}, |
| 33 | + "kem_group": "_kyber-512-r3"}, |
139 | 34 | (KemGroups.P384_KYBER768R3, Ciphers.PQ_TLS_1_3_2023_06_01):
|
140 |
| - {"cipher": "AES256_GCM_SHA384", "kem": None, |
141 |
| - "kem_group": "secp384r1_kyber-768-r3"}, |
| 35 | + {"cipher": "AES256_GCM_SHA384", |
| 36 | + "kem_group": "secp384r1_kyber-768-r3"}, |
142 | 37 | (KemGroups.P521_KYBER1024R3, Ciphers.PQ_TLS_1_3_2023_06_01):
|
143 |
| - {"cipher": "AES256_GCM_SHA384", "kem": None, |
144 |
| - "kem_group": "secp521r1_kyber-1024-r3"}, |
| 38 | + {"cipher": "AES256_GCM_SHA384", |
| 39 | + "kem_group": "secp521r1_kyber-1024-r3"}, |
145 | 40 | (Ciphers.PQ_TLS_1_3_2023_06_01, KemGroups.X25519Kyber768Draft00):
|
146 | 41 | {"cipher": "TLS_AES_256_GCM_SHA384",
|
147 |
| - "kem": None, |
148 | 42 | "kem_group": "X25519Kyber768Draft00"},
|
149 | 43 | (Ciphers.PQ_TLS_1_3_2023_06_01, KemGroups.SecP256r1Kyber768Draft00):
|
150 | 44 | {"cipher": "TLS_AES_256_GCM_SHA384",
|
151 |
| - "kem": None, |
152 | 45 | "kem_group": "SecP256r1Kyber768Draft00"},
|
| 46 | + (Ciphers.PQ_TLS_1_3_2023_06_01, Ciphers.PQ_TLS_1_3_2023_06_01): |
| 47 | + {"cipher": "TLS_AES_256_GCM_SHA384", |
| 48 | + "kem_group": "SecP256r1Kyber768Draft00"}, |
| 49 | + (Ciphers.PQ_TLS_1_3_2023_06_01, Ciphers.KMS_TLS_1_0_2018_10): |
| 50 | + {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
| 51 | + "kem_group": None}, |
| 52 | + (Ciphers.KMS_TLS_1_0_2018_10, Ciphers.PQ_TLS_1_3_2023_06_01): |
| 53 | + {"cipher": "ECDHE-RSA-AES128-GCM-SHA256", |
| 54 | + "kem_group": None}, |
| 55 | + (Ciphers.KMS_TLS_1_0_2018_10, Ciphers.KMS_TLS_1_0_2018_10): |
| 56 | + {"cipher": "ECDHE-RSA-AES256-GCM-SHA384", |
| 57 | + "kem_group": None}, |
153 | 58 | }
|
154 | 59 |
|
155 | 60 | """
|
@@ -185,16 +90,12 @@ def assert_s2n_negotiation_parameters(s2n_results, expected_result):
|
185 | 90 | if expected_result is not None:
|
186 | 91 | assert to_bytes(
|
187 | 92 | ("Cipher negotiated: " + expected_result['cipher'])) in s2n_results.stdout
|
188 |
| - if expected_result['kem']: |
189 |
| - assert to_bytes( |
190 |
| - ("KEM: " + expected_result['kem'])) in s2n_results.stdout |
191 |
| - assert to_bytes(PQ_ENABLED_FLAG) in s2n_results.stdout |
192 | 93 | if expected_result['kem_group']:
|
193 | 94 | # Purposefully leave off the "KEM Group: " prefix in order to perform partial matches
|
194 | 95 | # without specifying the curve.
|
195 | 96 | assert to_bytes(expected_result['kem_group']) in s2n_results.stdout
|
196 | 97 | assert to_bytes(PQ_ENABLED_FLAG) in s2n_results.stdout
|
197 |
| - if not expected_result['kem'] and not expected_result['kem_group']: |
| 98 | + if not expected_result['kem_group']: |
198 | 99 | assert to_bytes(PQ_ENABLED_FLAG) not in s2n_results.stdout
|
199 | 100 | assert to_bytes("Curve:") in s2n_results.stdout
|
200 | 101 |
|
@@ -224,22 +125,6 @@ def test_nothing():
|
224 | 125 | @pytest.mark.parametrize("other_provider", [S2N], ids=get_parameter_name)
|
225 | 126 | def test_s2nc_to_s2nd_pq_handshake(managed_process, protocol, certificate, client_cipher, server_cipher, provider,
|
226 | 127 | other_provider):
|
227 |
| - # Incorrect cipher is negotiated when both ciphers are PQ_TLS_1_0_2020_12 with |
228 |
| - # openssl 1.0.2, boringssl, and libressl libcryptos |
229 |
| - if all([ |
230 |
| - client_cipher == Ciphers.PQ_TLS_1_0_2020_12, |
231 |
| - server_cipher == Ciphers.PQ_TLS_1_0_2020_12, |
232 |
| - any([ |
233 |
| - libcrypto in get_flag(S2N_PROVIDER_VERSION) |
234 |
| - for libcrypto in [ |
235 |
| - "boringssl", |
236 |
| - "libressl", |
237 |
| - "openssl-1.0.2" |
238 |
| - ] |
239 |
| - ]) |
240 |
| - ]): |
241 |
| - pytest.skip() |
242 |
| - |
243 | 128 | port = next(available_ports)
|
244 | 129 |
|
245 | 130 | client_options = ProviderOptions(
|
@@ -267,7 +152,7 @@ def test_s2nc_to_s2nd_pq_handshake(managed_process, protocol, certificate, clien
|
267 | 152 | # If PQ is not enabled in s2n, we expect classic handshakes to be negotiated.
|
268 | 153 | # Leave the expected cipher blank, as there are multiple possibilities - the
|
269 | 154 | # important thing is that kem and kem_group are NONE.
|
270 |
| - expected_result = {"cipher": "", "kem": None, "kem_group": None} |
| 155 | + expected_result = {"cipher": "", "kem_group": None} |
271 | 156 |
|
272 | 157 | # Client and server are both s2n; can make meaningful assertions about negotiation for both
|
273 | 158 | for results in client.get_results():
|
@@ -359,7 +244,7 @@ def test_s2nd_to_awslc_pq_handshake(managed_process, s2n_server_policy, awslc_cl
|
359 | 244 |
|
360 | 245 | @pytest.mark.uncollect_if(func=invalid_test_parameters)
|
361 | 246 | @pytest.mark.parametrize("protocol", [Protocols.TLS13], ids=get_parameter_name)
|
362 |
| -@pytest.mark.parametrize("cipher", [Ciphers.PQ_TLS_1_0_2020_12], ids=get_parameter_name) |
| 247 | +@pytest.mark.parametrize("cipher", [Ciphers.PQ_TLS_1_3_2023_06_01], ids=get_parameter_name) |
363 | 248 | @pytest.mark.parametrize("kem_group", KEM_GROUPS, ids=get_parameter_name)
|
364 | 249 | def test_s2nc_to_oqs_openssl_pq_handshake(managed_process, protocol, cipher, kem_group):
|
365 | 250 | # If PQ is not enabled in s2n, there is no reason to test against oqs_openssl
|
@@ -401,7 +286,7 @@ def test_s2nc_to_oqs_openssl_pq_handshake(managed_process, protocol, cipher, kem
|
401 | 286 |
|
402 | 287 | @pytest.mark.uncollect_if(func=invalid_test_parameters)
|
403 | 288 | @pytest.mark.parametrize("protocol", [Protocols.TLS13], ids=get_parameter_name)
|
404 |
| -@pytest.mark.parametrize("cipher", [Ciphers.PQ_TLS_1_0_2020_12], ids=get_parameter_name) |
| 289 | +@pytest.mark.parametrize("cipher", [Ciphers.PQ_TLS_1_3_2023_06_01], ids=get_parameter_name) |
405 | 290 | @pytest.mark.parametrize("kem_group", KEM_GROUPS, ids=get_parameter_name)
|
406 | 291 | def test_oqs_openssl_to_s2nd_pq_handshake(managed_process, protocol, cipher, kem_group):
|
407 | 292 | # If PQ is not enabled in s2n, there is no reason to test against oqs_openssl
|
|
0 commit comments