Debian Codegraph @

crt/s2n/tests/unit/s2n_cert_status_extension_test.c

raw symbols SCIP
1 /*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 #include "s2n_test.h"
17 #include "testlib/s2n_testlib.h"
18 #include "tls/extensions/s2n_cert_status.h"
19
20 const uint8_t ocsp_data[] = "OCSP DATA";
21
22 int s2n_test_enable_sending_extension(struct s2n_connection *conn, struct s2n_cert_chain_and_key *chain_and_key)
23 {
24 conn->status_type = S2N_STATUS_REQUEST_OCSP;
25 conn->handshake_params.our_chain_and_key = chain_and_key;
26 EXPECT_SUCCESS(s2n_cert_chain_and_key_set_ocsp_data(chain_and_key, ocsp_data, s2n_array_len(ocsp_data)));
27 conn->x509_validator.state = VALIDATED;
28 return S2N_SUCCESS;
29 }
30
31 int main(int argc, char **argv)
32 {
33 BEGIN_TEST();
34
35 DEFER_CLEANUP(struct s2n_cert_chain_and_key *chain_and_key = NULL, s2n_cert_chain_and_key_ptr_free);
36 EXPECT_SUCCESS(s2n_test_cert_chain_and_key_new(&chain_and_key,
37 S2N_DEFAULT_TEST_CERT_CHAIN, S2N_DEFAULT_TEST_PRIVATE_KEY));
38
39 /* should_send */
40 {
41 struct s2n_config *config = NULL;
42 EXPECT_NOT_NULL(config = s2n_config_new());
43
44 struct s2n_connection *conn = NULL;
45 EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT));
46 EXPECT_SUCCESS(s2n_connection_set_config(conn, config));
47
48 /* Don't send by default */
49 EXPECT_FALSE(s2n_cert_status_extension.should_send(conn));
50
51 /* Send if all prerequisites met */
52 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
53 EXPECT_TRUE(s2n_cert_status_extension.should_send(conn));
54
55 /* Send if client */
56 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
57 conn->mode = S2N_CLIENT;
58 EXPECT_TRUE(s2n_cert_status_extension.should_send(conn));
59
60 /* Send if server */
61 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
62 conn->mode = S2N_SERVER;
63 EXPECT_TRUE(s2n_cert_status_extension.should_send(conn));
64
65 /* Don't send if no certificate set */
66 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
67 conn->handshake_params.our_chain_and_key = NULL;
68 EXPECT_FALSE(s2n_cert_status_extension.should_send(conn));
69
70 /* Don't send if no ocsp data */
71 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
72 EXPECT_SUCCESS(s2n_free(&conn->handshake_params.our_chain_and_key->ocsp_status));
73 EXPECT_FALSE(s2n_cert_status_extension.should_send(conn));
74
75 EXPECT_SUCCESS(s2n_connection_free(conn));
76 EXPECT_SUCCESS(s2n_config_free(config));
77 };
78
79 /* Test send */
80 {
81 struct s2n_connection *conn = NULL;
82 EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_SERVER));
83 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
84
85 struct s2n_stuffer stuffer = { 0 };
86 EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));
87
88 EXPECT_SUCCESS(s2n_cert_status_extension.send(conn, &stuffer));
89
90 uint8_t request_type = 0;
91 EXPECT_SUCCESS(s2n_stuffer_read_uint8(&stuffer, &request_type));
92 EXPECT_EQUAL(request_type, S2N_STATUS_REQUEST_OCSP);
93
94 uint32_t ocsp_size = 0;
95 EXPECT_SUCCESS(s2n_stuffer_read_uint24(&stuffer, &ocsp_size));
96 EXPECT_EQUAL(ocsp_size, s2n_stuffer_data_available(&stuffer));
97 EXPECT_EQUAL(ocsp_size, s2n_array_len(ocsp_data));
98
99 uint8_t *actual_ocsp_data = NULL;
100 EXPECT_NOT_NULL(actual_ocsp_data = s2n_stuffer_raw_read(&stuffer, ocsp_size));
101 EXPECT_BYTEARRAY_EQUAL(actual_ocsp_data, ocsp_data, ocsp_size);
102
103 EXPECT_EQUAL(s2n_stuffer_data_available(&stuffer), 0);
104
105 EXPECT_SUCCESS(s2n_stuffer_free(&stuffer));
106 EXPECT_SUCCESS(s2n_connection_free(conn));
107 };
108
109 /* Test recv */
110 {
111 /* Disable x509 validation so that the OCSP test data can be successfully received. */
112 DEFER_CLEANUP(struct s2n_config *config = s2n_config_new_minimal(), s2n_config_ptr_free);
113 EXPECT_SUCCESS(s2n_config_set_unsafe_for_testing(config));
114
115 struct s2n_connection *conn = NULL;
116 EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_SERVER));
117 EXPECT_SUCCESS(s2n_connection_set_config(conn, config));
118 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
119
120 struct s2n_stuffer stuffer = { 0 };
121 EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));
122
123 EXPECT_SUCCESS(s2n_cert_status_extension.send(conn, &stuffer));
124
125 EXPECT_EQUAL(conn->status_response.size, 0);
126 EXPECT_SUCCESS(s2n_cert_status_extension.recv(conn, &stuffer));
127 EXPECT_BYTEARRAY_EQUAL(conn->status_response.data, ocsp_data, s2n_array_len(ocsp_data));
128
129 EXPECT_EQUAL(s2n_stuffer_data_available(&stuffer), 0);
130
131 EXPECT_SUCCESS(s2n_stuffer_free(&stuffer));
132 EXPECT_SUCCESS(s2n_connection_free(conn));
133 };
134
135 /* Test recv - not ocsp */
136 {
137 struct s2n_connection *conn = NULL;
138 EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_SERVER));
139 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
140
141 struct s2n_stuffer stuffer = { 0 };
142 EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));
143
144 EXPECT_SUCCESS(s2n_stuffer_write_uint8(&stuffer, S2N_STATUS_REQUEST_NONE));
145
146 EXPECT_EQUAL(conn->status_response.size, 0);
147 EXPECT_SUCCESS(s2n_cert_status_extension.recv(conn, &stuffer));
148 EXPECT_EQUAL(conn->status_response.size, 0);
149
150 EXPECT_SUCCESS(s2n_stuffer_free(&stuffer));
151 EXPECT_SUCCESS(s2n_connection_free(conn));
152 };
153
154 /* Test recv - bad ocsp data */
155 {
156 struct s2n_connection *conn = s2n_connection_new(S2N_CLIENT);
157 EXPECT_NOT_NULL(conn);
158 EXPECT_SUCCESS(s2n_test_enable_sending_extension(conn, chain_and_key));
159
160 DEFER_CLEANUP(struct s2n_stuffer stuffer = { 0 }, s2n_stuffer_free);
161 EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));
162
163 EXPECT_SUCCESS(s2n_cert_status_extension.send(conn, &stuffer));
164
165 if (s2n_x509_ocsp_stapling_supported()) {
166 EXPECT_FAILURE_WITH_ERRNO(s2n_cert_status_extension.recv(conn, &stuffer),
167 S2N_ERR_INVALID_OCSP_RESPONSE);
168 } else {
169 /* s2n_x509_validator_validate_cert_stapled_ocsp_response returns untrusted error if ocsp is not supported */
170 EXPECT_FAILURE_WITH_ERRNO(s2n_cert_status_extension.recv(conn, &stuffer),
171 S2N_ERR_CERT_UNTRUSTED);
172 }
173
174 EXPECT_SUCCESS(s2n_connection_free(conn));
175 };
176
177 /* Self-talk tests */
178 if (s2n_x509_ocsp_stapling_supported() && s2n_is_tls13_fully_supported()) {
179 uint8_t ocsp_response[S2N_MAX_TEST_PEM_SIZE] = { 0 };
180 uint32_t ocsp_response_len = 0;
181 EXPECT_SUCCESS(s2n_read_test_pem_and_len(S2N_OCSP_RESPONSE_DER, ocsp_response, &ocsp_response_len, S2N_MAX_TEST_PEM_SIZE));
182 EXPECT_TRUE(ocsp_response_len > 0);
183
184 DEFER_CLEANUP(struct s2n_cert_chain_and_key *ocsp_chain_and_key = NULL, s2n_cert_chain_and_key_ptr_free);
185 EXPECT_SUCCESS(s2n_test_cert_chain_and_key_new(&ocsp_chain_and_key, S2N_OCSP_SERVER_CERT, S2N_OCSP_SERVER_KEY));
186 EXPECT_SUCCESS(s2n_cert_chain_and_key_set_ocsp_data(ocsp_chain_and_key, ocsp_response, ocsp_response_len));
187
188 /* Client requests OCSP staple, and server sends OCSP response */
189 {
190 DEFER_CLEANUP(struct s2n_config *client_config = s2n_config_new(), s2n_config_ptr_free);
191 EXPECT_NOT_NULL(client_config);
192 EXPECT_SUCCESS(s2n_config_set_verification_ca_location(client_config, S2N_OCSP_CA_CERT, NULL));
193 EXPECT_SUCCESS(s2n_config_set_cipher_preferences(client_config, "default_tls13"));
194 EXPECT_SUCCESS(s2n_config_set_status_request_type(client_config, S2N_STATUS_REQUEST_OCSP));
195
196 DEFER_CLEANUP(struct s2n_config *server_config = s2n_config_new(), s2n_config_ptr_free);
197 EXPECT_NOT_NULL(server_config);
198 EXPECT_SUCCESS(s2n_config_add_cert_chain_and_key_to_store(server_config, ocsp_chain_and_key));
199 EXPECT_SUCCESS(s2n_config_set_cipher_preferences(server_config, "default_tls13"));
200
201 DEFER_CLEANUP(struct s2n_connection *server_conn = s2n_connection_new(S2N_SERVER), s2n_connection_ptr_free);
202 EXPECT_NOT_NULL(server_conn);
203 EXPECT_SUCCESS(s2n_connection_set_config(server_conn, server_config));
204
205 DEFER_CLEANUP(struct s2n_connection *client_conn = s2n_connection_new(S2N_CLIENT), s2n_connection_ptr_free);
206 EXPECT_NOT_NULL(client_conn);
207 EXPECT_SUCCESS(s2n_connection_set_config(client_conn, client_config));
208 EXPECT_SUCCESS(s2n_set_server_name(client_conn, "s2n Test Cert"));
209
210 DEFER_CLEANUP(struct s2n_test_io_pair io_pair = { 0 }, s2n_io_pair_close);
211 EXPECT_SUCCESS(s2n_io_pair_init_non_blocking(&io_pair));
212 EXPECT_SUCCESS(s2n_connection_set_io_pair(client_conn, &io_pair));
213 EXPECT_SUCCESS(s2n_connection_set_io_pair(server_conn, &io_pair));
214
215 EXPECT_SUCCESS(s2n_negotiate_test_server_and_client(server_conn, client_conn));
216
217 EXPECT_EQUAL(server_conn->actual_protocol_version, S2N_TLS13);
218 EXPECT_EQUAL(client_conn->actual_protocol_version, S2N_TLS13);
219
220 uint32_t client_received_ocsp_response_len = 0;
221 const uint8_t *client_received_ocsp_response = s2n_connection_get_ocsp_response(client_conn,
222 &client_received_ocsp_response_len);
223 EXPECT_NOT_NULL(client_received_ocsp_response);
224
225 uint32_t server_received_ocsp_response_len = 0;
226 const uint8_t *server_received_ocsp_response = s2n_connection_get_ocsp_response(server_conn,
227 &server_received_ocsp_response_len);
228 /* Only the client requested a response, the server should not have received one. */
229 EXPECT_NULL(server_received_ocsp_response);
230
231 /* The server sent an OCSP response, and the client received an OCSP response */
232 EXPECT_EQUAL(s2n_connection_is_ocsp_stapled(server_conn), 1);
233 EXPECT_EQUAL(s2n_connection_is_ocsp_stapled(client_conn), 1);
234 }
235
236 /* Server requests OCSP staple, and client sends OCSP response */
237 {
238 DEFER_CLEANUP(struct s2n_config *client_config = s2n_config_new(), s2n_config_ptr_free);
239 EXPECT_NOT_NULL(client_config);
240 EXPECT_SUCCESS(s2n_config_set_verification_ca_location(client_config, S2N_OCSP_CA_CERT, NULL));
241 EXPECT_SUCCESS(s2n_config_set_cipher_preferences(client_config, "default_tls13"));
242 EXPECT_SUCCESS(s2n_config_set_status_request_type(client_config, S2N_STATUS_REQUEST_NONE));
243
244 EXPECT_SUCCESS(s2n_config_set_client_auth_type(client_config, S2N_CERT_AUTH_OPTIONAL));
245 EXPECT_SUCCESS(s2n_config_add_cert_chain_and_key_to_store(client_config, ocsp_chain_and_key));
246
247 DEFER_CLEANUP(struct s2n_config *server_config = s2n_config_new(), s2n_config_ptr_free);
248 EXPECT_NOT_NULL(server_config);
249 EXPECT_SUCCESS(s2n_config_add_cert_chain_and_key_to_store(server_config, ocsp_chain_and_key));
250 EXPECT_SUCCESS(s2n_config_set_cipher_preferences(server_config, "default_tls13"));
251 EXPECT_SUCCESS(s2n_config_set_status_request_type(server_config, S2N_STATUS_REQUEST_OCSP));
252
253 /* The OCSP certificate chain was not issued with the purpose of TLS clientAuth, but is
254 * being used as a client certificate. Intent verification is disabled to allow this
255 * certificate to be used as a client certificate anyway.
256 */
257 EXPECT_SUCCESS(s2n_config_disable_x509_intent_verification(server_config));
258
259 EXPECT_SUCCESS(s2n_config_set_client_auth_type(server_config, S2N_CERT_AUTH_REQUIRED));
260 EXPECT_SUCCESS(s2n_config_set_verification_ca_location(server_config, S2N_OCSP_CA_CERT, NULL));
261
262 DEFER_CLEANUP(struct s2n_connection *server_conn = s2n_connection_new(S2N_SERVER), s2n_connection_ptr_free);
263 EXPECT_NOT_NULL(server_conn);
264 EXPECT_SUCCESS(s2n_connection_set_config(server_conn, server_config));
265
266 DEFER_CLEANUP(struct s2n_connection *client_conn = s2n_connection_new(S2N_CLIENT), s2n_connection_ptr_free);
267 EXPECT_NOT_NULL(client_conn);
268 EXPECT_SUCCESS(s2n_connection_set_config(client_conn, client_config));
269 EXPECT_SUCCESS(s2n_set_server_name(client_conn, "s2n Test Cert"));
270
271 DEFER_CLEANUP(struct s2n_test_io_pair io_pair = { 0 }, s2n_io_pair_close);
272 EXPECT_SUCCESS(s2n_io_pair_init_non_blocking(&io_pair));
273 EXPECT_SUCCESS(s2n_connection_set_io_pair(client_conn, &io_pair));
274 EXPECT_SUCCESS(s2n_connection_set_io_pair(server_conn, &io_pair));
275
276 EXPECT_SUCCESS(s2n_negotiate_test_server_and_client(server_conn, client_conn));
277
278 EXPECT_EQUAL(server_conn->actual_protocol_version, S2N_TLS13);
279 EXPECT_EQUAL(client_conn->actual_protocol_version, S2N_TLS13);
280
281 uint32_t client_received_ocsp_response_len = 0;
282 const uint8_t *client_received_ocsp_response = s2n_connection_get_ocsp_response(client_conn,
283 &client_received_ocsp_response_len);
284 /* Only the server requested a response, the client should not have received one. */
285 EXPECT_NULL(client_received_ocsp_response);
286
287 uint32_t server_received_ocsp_response_len = 0;
288 const uint8_t *server_received_ocsp_response = s2n_connection_get_ocsp_response(server_conn,
289 &server_received_ocsp_response_len);
290 EXPECT_NOT_NULL(server_received_ocsp_response);
291
292 /* The server did not send an OCSP response, and the client did not receive an OCSP response */
293 EXPECT_EQUAL(s2n_connection_is_ocsp_stapled(server_conn), 0);
294 EXPECT_EQUAL(s2n_connection_is_ocsp_stapled(client_conn), 0);
295 }
296
297 /* Client and server both request OCSP staples, and client and server both send responses */
298 {
299 DEFER_CLEANUP(struct s2n_config *client_config = s2n_config_new(), s2n_config_ptr_free);
300 EXPECT_NOT_NULL(client_config);
301 EXPECT_SUCCESS(s2n_config_set_verification_ca_location(client_config, S2N_OCSP_CA_CERT, NULL));
302 EXPECT_SUCCESS(s2n_config_set_cipher_preferences(client_config, "default_tls13"));
303 EXPECT_SUCCESS(s2n_config_set_status_request_type(client_config, S2N_STATUS_REQUEST_OCSP));
304
305 EXPECT_SUCCESS(s2n_config_set_client_auth_type(client_config, S2N_CERT_AUTH_OPTIONAL));
306 EXPECT_SUCCESS(s2n_config_add_cert_chain_and_key_to_store(client_config, ocsp_chain_and_key));
307
308 DEFER_CLEANUP(struct s2n_config *server_config = s2n_config_new(), s2n_config_ptr_free);
309 EXPECT_NOT_NULL(server_config);
310 EXPECT_SUCCESS(s2n_config_add_cert_chain_and_key_to_store(server_config, ocsp_chain_and_key));
311 EXPECT_SUCCESS(s2n_config_set_cipher_preferences(server_config, "default_tls13"));
312 EXPECT_SUCCESS(s2n_config_set_status_request_type(server_config, S2N_STATUS_REQUEST_OCSP));
313
314 /* The OCSP certificate chain was not issued with the purpose of TLS clientAuth, but is
315 * being used as a client certificate. Intent verification is disabled to allow this
316 * certificate to be used as a client certificate anyway.
317 */
318 EXPECT_SUCCESS(s2n_config_disable_x509_intent_verification(server_config));
319
320 EXPECT_SUCCESS(s2n_config_set_client_auth_type(server_config, S2N_CERT_AUTH_REQUIRED));
321 EXPECT_SUCCESS(s2n_config_set_verification_ca_location(server_config, S2N_OCSP_CA_CERT, NULL));
322
323 DEFER_CLEANUP(struct s2n_connection *server_conn = s2n_connection_new(S2N_SERVER), s2n_connection_ptr_free);
324 EXPECT_NOT_NULL(server_conn);
325 EXPECT_SUCCESS(s2n_connection_set_config(server_conn, server_config));
326
327 DEFER_CLEANUP(struct s2n_connection *client_conn = s2n_connection_new(S2N_CLIENT), s2n_connection_ptr_free);
328 EXPECT_NOT_NULL(client_conn);
329 EXPECT_SUCCESS(s2n_connection_set_config(client_conn, client_config));
330 EXPECT_SUCCESS(s2n_set_server_name(client_conn, "s2n Test Cert"));
331
332 DEFER_CLEANUP(struct s2n_test_io_pair io_pair = { 0 }, s2n_io_pair_close);
333 EXPECT_SUCCESS(s2n_io_pair_init_non_blocking(&io_pair));
334 EXPECT_SUCCESS(s2n_connection_set_io_pair(client_conn, &io_pair));
335 EXPECT_SUCCESS(s2n_connection_set_io_pair(server_conn, &io_pair));
336
337 EXPECT_SUCCESS(s2n_negotiate_test_server_and_client(server_conn, client_conn));
338
339 EXPECT_EQUAL(server_conn->actual_protocol_version, S2N_TLS13);
340 EXPECT_EQUAL(client_conn->actual_protocol_version, S2N_TLS13);
341
342 uint32_t client_received_ocsp_response_len = 0;
343 const uint8_t *client_received_ocsp_response = s2n_connection_get_ocsp_response(client_conn,
344 &client_received_ocsp_response_len);
345 EXPECT_NOT_NULL(client_received_ocsp_response);
346
347 uint32_t server_received_ocsp_response_len = 0;
348 const uint8_t *server_received_ocsp_response = s2n_connection_get_ocsp_response(server_conn,
349 &server_received_ocsp_response_len);
350 EXPECT_NOT_NULL(server_received_ocsp_response);
351
352 /* The server sent an OCSP response, and the client received an OCSP response */
353 EXPECT_EQUAL(s2n_connection_is_ocsp_stapled(server_conn), 1);
354 EXPECT_EQUAL(s2n_connection_is_ocsp_stapled(client_conn), 1);
355 }
356
357 /* Server sets an OCSP response but client does not request OCSP stapling */
358 {
359 DEFER_CLEANUP(struct s2n_config *client_config = s2n_config_new(), s2n_config_ptr_free);
360 EXPECT_NOT_NULL(client_config);
361 EXPECT_SUCCESS(s2n_config_set_verification_ca_location(client_config, S2N_OCSP_CA_CERT, NULL));
362 EXPECT_SUCCESS(s2n_config_set_cipher_preferences(client_config, "default_tls13"));
363 EXPECT_SUCCESS(s2n_config_set_status_request_type(client_config, S2N_STATUS_REQUEST_NONE));
364
365 DEFER_CLEANUP(struct s2n_config *server_config = s2n_config_new(), s2n_config_ptr_free);
366 EXPECT_NOT_NULL(server_config);
367 EXPECT_SUCCESS(s2n_config_add_cert_chain_and_key_to_store(server_config, ocsp_chain_and_key));
368 EXPECT_SUCCESS(s2n_config_set_cipher_preferences(server_config, "default_tls13"));
369
370 DEFER_CLEANUP(struct s2n_connection *server_conn = s2n_connection_new(S2N_SERVER), s2n_connection_ptr_free);
371 EXPECT_NOT_NULL(server_conn);
372 EXPECT_SUCCESS(s2n_connection_set_config(server_conn, server_config));
373
374 DEFER_CLEANUP(struct s2n_connection *client_conn = s2n_connection_new(S2N_CLIENT), s2n_connection_ptr_free);
375 EXPECT_NOT_NULL(client_conn);
376 EXPECT_SUCCESS(s2n_connection_set_config(client_conn, client_config));
377 EXPECT_SUCCESS(s2n_set_server_name(client_conn, "s2n Test Cert"));
378
379 DEFER_CLEANUP(struct s2n_test_io_pair io_pair = { 0 }, s2n_io_pair_close);
380 EXPECT_SUCCESS(s2n_io_pair_init_non_blocking(&io_pair));
381 EXPECT_SUCCESS(s2n_connection_set_io_pair(client_conn, &io_pair));
382 EXPECT_SUCCESS(s2n_connection_set_io_pair(server_conn, &io_pair));
383
384 EXPECT_SUCCESS(s2n_negotiate_test_server_and_client(server_conn, client_conn));
385
386 EXPECT_EQUAL(server_conn->actual_protocol_version, S2N_TLS13);
387 EXPECT_EQUAL(client_conn->actual_protocol_version, S2N_TLS13);
388
389 uint32_t client_received_ocsp_response_len = 0;
390 const uint8_t *client_received_ocsp_response = s2n_connection_get_ocsp_response(client_conn,
391 &client_received_ocsp_response_len);
392
393 uint32_t server_received_ocsp_response_len = 0;
394 const uint8_t *server_received_ocsp_response = s2n_connection_get_ocsp_response(server_conn,
395 &server_received_ocsp_response_len);
396
397 /* Both the server and client did not request OCSP responses, so neither should have received them. */
398 EXPECT_NULL(client_received_ocsp_response);
399 EXPECT_NULL(server_received_ocsp_response);
400
401 /* The server did not send an OCSP response, and the client did not receive an OCSP response */
402 EXPECT_EQUAL(s2n_connection_is_ocsp_stapled(server_conn), 0);
403 EXPECT_EQUAL(s2n_connection_is_ocsp_stapled(client_conn), 0);
404 }
405 }
406
407 END_TEST();
408 }