1 | /*
|
---|
2 | * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
5 | * this file except in compliance with the License. You can obtain a copy
|
---|
6 | * in the file LICENSE in the source distribution or at
|
---|
7 | * https://www.openssl.org/source/license.html
|
---|
8 | */
|
---|
9 |
|
---|
10 | #include <string.h>
|
---|
11 |
|
---|
12 | #include <openssl/e_os2.h>
|
---|
13 | #include <openssl/crypto.h>
|
---|
14 |
|
---|
15 | #include "internal/nelem.h"
|
---|
16 | #include "ssl_test_ctx.h"
|
---|
17 | #include "../testutil.h"
|
---|
18 |
|
---|
19 | #ifdef OPENSSL_SYS_WINDOWS
|
---|
20 | # define strcasecmp _stricmp
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | static const int default_app_data_size = 256;
|
---|
24 | /* Default set to be as small as possible to exercise fragmentation. */
|
---|
25 | static const int default_max_fragment_size = 512;
|
---|
26 |
|
---|
27 | static int parse_boolean(const char *value, int *result)
|
---|
28 | {
|
---|
29 | if (strcasecmp(value, "Yes") == 0) {
|
---|
30 | *result = 1;
|
---|
31 | return 1;
|
---|
32 | }
|
---|
33 | else if (strcasecmp(value, "No") == 0) {
|
---|
34 | *result = 0;
|
---|
35 | return 1;
|
---|
36 | }
|
---|
37 | TEST_error("parse_boolean given: '%s'", value);
|
---|
38 | return 0;
|
---|
39 | }
|
---|
40 |
|
---|
41 | #define IMPLEMENT_SSL_TEST_BOOL_OPTION(struct_type, name, field) \
|
---|
42 | static int parse_##name##_##field(struct_type *ctx, const char *value) \
|
---|
43 | { \
|
---|
44 | return parse_boolean(value, &ctx->field); \
|
---|
45 | }
|
---|
46 |
|
---|
47 | #define IMPLEMENT_SSL_TEST_STRING_OPTION(struct_type, name, field) \
|
---|
48 | static int parse_##name##_##field(struct_type *ctx, const char *value) \
|
---|
49 | { \
|
---|
50 | OPENSSL_free(ctx->field); \
|
---|
51 | ctx->field = OPENSSL_strdup(value); \
|
---|
52 | return TEST_ptr(ctx->field); \
|
---|
53 | }
|
---|
54 |
|
---|
55 | #define IMPLEMENT_SSL_TEST_INT_OPTION(struct_type, name, field) \
|
---|
56 | static int parse_##name##_##field(struct_type *ctx, const char *value) \
|
---|
57 | { \
|
---|
58 | ctx->field = atoi(value); \
|
---|
59 | return 1; \
|
---|
60 | }
|
---|
61 |
|
---|
62 | /* True enums and other test configuration values that map to an int. */
|
---|
63 | typedef struct {
|
---|
64 | const char *name;
|
---|
65 | int value;
|
---|
66 | } test_enum;
|
---|
67 |
|
---|
68 |
|
---|
69 | __owur static int parse_enum(const test_enum *enums, size_t num_enums,
|
---|
70 | int *value, const char *name)
|
---|
71 | {
|
---|
72 | size_t i;
|
---|
73 | for (i = 0; i < num_enums; i++) {
|
---|
74 | if (strcmp(enums[i].name, name) == 0) {
|
---|
75 | *value = enums[i].value;
|
---|
76 | return 1;
|
---|
77 | }
|
---|
78 | }
|
---|
79 | return 0;
|
---|
80 | }
|
---|
81 |
|
---|
82 | static const char *enum_name(const test_enum *enums, size_t num_enums,
|
---|
83 | int value)
|
---|
84 | {
|
---|
85 | size_t i;
|
---|
86 | for (i = 0; i < num_enums; i++) {
|
---|
87 | if (enums[i].value == value) {
|
---|
88 | return enums[i].name;
|
---|
89 | }
|
---|
90 | }
|
---|
91 | return "InvalidValue";
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 | /* ExpectedResult */
|
---|
96 |
|
---|
97 | static const test_enum ssl_test_results[] = {
|
---|
98 | {"Success", SSL_TEST_SUCCESS},
|
---|
99 | {"ServerFail", SSL_TEST_SERVER_FAIL},
|
---|
100 | {"ClientFail", SSL_TEST_CLIENT_FAIL},
|
---|
101 | {"InternalError", SSL_TEST_INTERNAL_ERROR},
|
---|
102 | {"FirstHandshakeFailed", SSL_TEST_FIRST_HANDSHAKE_FAILED},
|
---|
103 | };
|
---|
104 |
|
---|
105 | __owur static int parse_expected_result(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
106 | {
|
---|
107 | int ret_value;
|
---|
108 | if (!parse_enum(ssl_test_results, OSSL_NELEM(ssl_test_results),
|
---|
109 | &ret_value, value)) {
|
---|
110 | return 0;
|
---|
111 | }
|
---|
112 | test_ctx->expected_result = ret_value;
|
---|
113 | return 1;
|
---|
114 | }
|
---|
115 |
|
---|
116 | const char *ssl_test_result_name(ssl_test_result_t result)
|
---|
117 | {
|
---|
118 | return enum_name(ssl_test_results, OSSL_NELEM(ssl_test_results), result);
|
---|
119 | }
|
---|
120 |
|
---|
121 | /* ExpectedClientAlert / ExpectedServerAlert */
|
---|
122 |
|
---|
123 | static const test_enum ssl_alerts[] = {
|
---|
124 | {"UnknownCA", SSL_AD_UNKNOWN_CA},
|
---|
125 | {"HandshakeFailure", SSL_AD_HANDSHAKE_FAILURE},
|
---|
126 | {"UnrecognizedName", SSL_AD_UNRECOGNIZED_NAME},
|
---|
127 | {"NoRenegotiation", SSL_AD_NO_RENEGOTIATION},
|
---|
128 | {"BadCertificate", SSL_AD_BAD_CERTIFICATE},
|
---|
129 | {"NoApplicationProtocol", SSL_AD_NO_APPLICATION_PROTOCOL},
|
---|
130 | {"CertificateRequired", SSL_AD_CERTIFICATE_REQUIRED},
|
---|
131 | };
|
---|
132 |
|
---|
133 | __owur static int parse_alert(int *alert, const char *value)
|
---|
134 | {
|
---|
135 | return parse_enum(ssl_alerts, OSSL_NELEM(ssl_alerts), alert, value);
|
---|
136 | }
|
---|
137 |
|
---|
138 | __owur static int parse_client_alert(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
139 | {
|
---|
140 | return parse_alert(&test_ctx->expected_client_alert, value);
|
---|
141 | }
|
---|
142 |
|
---|
143 | __owur static int parse_server_alert(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
144 | {
|
---|
145 | return parse_alert(&test_ctx->expected_server_alert, value);
|
---|
146 | }
|
---|
147 |
|
---|
148 | const char *ssl_alert_name(int alert)
|
---|
149 | {
|
---|
150 | return enum_name(ssl_alerts, OSSL_NELEM(ssl_alerts), alert);
|
---|
151 | }
|
---|
152 |
|
---|
153 | /* ExpectedProtocol */
|
---|
154 |
|
---|
155 | static const test_enum ssl_protocols[] = {
|
---|
156 | {"TLSv1.3", TLS1_3_VERSION},
|
---|
157 | {"TLSv1.2", TLS1_2_VERSION},
|
---|
158 | {"TLSv1.1", TLS1_1_VERSION},
|
---|
159 | {"TLSv1", TLS1_VERSION},
|
---|
160 | {"SSLv3", SSL3_VERSION},
|
---|
161 | {"DTLSv1", DTLS1_VERSION},
|
---|
162 | {"DTLSv1.2", DTLS1_2_VERSION},
|
---|
163 | };
|
---|
164 |
|
---|
165 | __owur static int parse_protocol(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
166 | {
|
---|
167 | return parse_enum(ssl_protocols, OSSL_NELEM(ssl_protocols),
|
---|
168 | &test_ctx->expected_protocol, value);
|
---|
169 | }
|
---|
170 |
|
---|
171 | const char *ssl_protocol_name(int protocol)
|
---|
172 | {
|
---|
173 | return enum_name(ssl_protocols, OSSL_NELEM(ssl_protocols), protocol);
|
---|
174 | }
|
---|
175 |
|
---|
176 | /* VerifyCallback */
|
---|
177 |
|
---|
178 | static const test_enum ssl_verify_callbacks[] = {
|
---|
179 | {"None", SSL_TEST_VERIFY_NONE},
|
---|
180 | {"AcceptAll", SSL_TEST_VERIFY_ACCEPT_ALL},
|
---|
181 | {"RetryOnce", SSL_TEST_VERIFY_RETRY_ONCE},
|
---|
182 | {"RejectAll", SSL_TEST_VERIFY_REJECT_ALL},
|
---|
183 | };
|
---|
184 |
|
---|
185 | __owur static int parse_client_verify_callback(SSL_TEST_CLIENT_CONF *client_conf,
|
---|
186 | const char *value)
|
---|
187 | {
|
---|
188 | int ret_value;
|
---|
189 |
|
---|
190 | if (!parse_enum(ssl_verify_callbacks, OSSL_NELEM(ssl_verify_callbacks),
|
---|
191 | &ret_value, value)) {
|
---|
192 | return 0;
|
---|
193 | }
|
---|
194 | client_conf->verify_callback = ret_value;
|
---|
195 | return 1;
|
---|
196 | }
|
---|
197 |
|
---|
198 | const char *ssl_verify_callback_name(ssl_verify_callback_t callback)
|
---|
199 | {
|
---|
200 | return enum_name(ssl_verify_callbacks, OSSL_NELEM(ssl_verify_callbacks),
|
---|
201 | callback);
|
---|
202 | }
|
---|
203 |
|
---|
204 | /* ServerName */
|
---|
205 |
|
---|
206 | static const test_enum ssl_servername[] = {
|
---|
207 | {"None", SSL_TEST_SERVERNAME_NONE},
|
---|
208 | {"server1", SSL_TEST_SERVERNAME_SERVER1},
|
---|
209 | {"server2", SSL_TEST_SERVERNAME_SERVER2},
|
---|
210 | {"invalid", SSL_TEST_SERVERNAME_INVALID},
|
---|
211 | };
|
---|
212 |
|
---|
213 | __owur static int parse_servername(SSL_TEST_CLIENT_CONF *client_conf,
|
---|
214 | const char *value)
|
---|
215 | {
|
---|
216 | int ret_value;
|
---|
217 | if (!parse_enum(ssl_servername, OSSL_NELEM(ssl_servername),
|
---|
218 | &ret_value, value)) {
|
---|
219 | return 0;
|
---|
220 | }
|
---|
221 | client_conf->servername = ret_value;
|
---|
222 | return 1;
|
---|
223 | }
|
---|
224 |
|
---|
225 | __owur static int parse_expected_servername(SSL_TEST_CTX *test_ctx,
|
---|
226 | const char *value)
|
---|
227 | {
|
---|
228 | int ret_value;
|
---|
229 | if (!parse_enum(ssl_servername, OSSL_NELEM(ssl_servername),
|
---|
230 | &ret_value, value)) {
|
---|
231 | return 0;
|
---|
232 | }
|
---|
233 | test_ctx->expected_servername = ret_value;
|
---|
234 | return 1;
|
---|
235 | }
|
---|
236 |
|
---|
237 | const char *ssl_servername_name(ssl_servername_t server)
|
---|
238 | {
|
---|
239 | return enum_name(ssl_servername, OSSL_NELEM(ssl_servername),
|
---|
240 | server);
|
---|
241 | }
|
---|
242 |
|
---|
243 | /* ServerNameCallback */
|
---|
244 |
|
---|
245 | static const test_enum ssl_servername_callbacks[] = {
|
---|
246 | {"None", SSL_TEST_SERVERNAME_CB_NONE},
|
---|
247 | {"IgnoreMismatch", SSL_TEST_SERVERNAME_IGNORE_MISMATCH},
|
---|
248 | {"RejectMismatch", SSL_TEST_SERVERNAME_REJECT_MISMATCH},
|
---|
249 | {"ClientHelloIgnoreMismatch",
|
---|
250 | SSL_TEST_SERVERNAME_CLIENT_HELLO_IGNORE_MISMATCH},
|
---|
251 | {"ClientHelloRejectMismatch",
|
---|
252 | SSL_TEST_SERVERNAME_CLIENT_HELLO_REJECT_MISMATCH},
|
---|
253 | {"ClientHelloNoV12", SSL_TEST_SERVERNAME_CLIENT_HELLO_NO_V12},
|
---|
254 | };
|
---|
255 |
|
---|
256 | __owur static int parse_servername_callback(SSL_TEST_SERVER_CONF *server_conf,
|
---|
257 | const char *value)
|
---|
258 | {
|
---|
259 | int ret_value;
|
---|
260 | if (!parse_enum(ssl_servername_callbacks,
|
---|
261 | OSSL_NELEM(ssl_servername_callbacks), &ret_value, value)) {
|
---|
262 | return 0;
|
---|
263 | }
|
---|
264 | server_conf->servername_callback = ret_value;
|
---|
265 | return 1;
|
---|
266 | }
|
---|
267 |
|
---|
268 | const char *ssl_servername_callback_name(ssl_servername_callback_t callback)
|
---|
269 | {
|
---|
270 | return enum_name(ssl_servername_callbacks,
|
---|
271 | OSSL_NELEM(ssl_servername_callbacks), callback);
|
---|
272 | }
|
---|
273 |
|
---|
274 | /* SessionTicketExpected */
|
---|
275 |
|
---|
276 | static const test_enum ssl_session_ticket[] = {
|
---|
277 | {"Ignore", SSL_TEST_SESSION_TICKET_IGNORE},
|
---|
278 | {"Yes", SSL_TEST_SESSION_TICKET_YES},
|
---|
279 | {"No", SSL_TEST_SESSION_TICKET_NO},
|
---|
280 | };
|
---|
281 |
|
---|
282 | __owur static int parse_session_ticket(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
283 | {
|
---|
284 | int ret_value;
|
---|
285 | if (!parse_enum(ssl_session_ticket, OSSL_NELEM(ssl_session_ticket),
|
---|
286 | &ret_value, value)) {
|
---|
287 | return 0;
|
---|
288 | }
|
---|
289 | test_ctx->session_ticket_expected = ret_value;
|
---|
290 | return 1;
|
---|
291 | }
|
---|
292 |
|
---|
293 | const char *ssl_session_ticket_name(ssl_session_ticket_t server)
|
---|
294 | {
|
---|
295 | return enum_name(ssl_session_ticket,
|
---|
296 | OSSL_NELEM(ssl_session_ticket),
|
---|
297 | server);
|
---|
298 | }
|
---|
299 |
|
---|
300 | /* CompressionExpected */
|
---|
301 |
|
---|
302 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CTX, test, compression_expected)
|
---|
303 |
|
---|
304 | /* SessionIdExpected */
|
---|
305 |
|
---|
306 | static const test_enum ssl_session_id[] = {
|
---|
307 | {"Ignore", SSL_TEST_SESSION_ID_IGNORE},
|
---|
308 | {"Yes", SSL_TEST_SESSION_ID_YES},
|
---|
309 | {"No", SSL_TEST_SESSION_ID_NO},
|
---|
310 | };
|
---|
311 |
|
---|
312 | __owur static int parse_session_id(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
313 | {
|
---|
314 | int ret_value;
|
---|
315 | if (!parse_enum(ssl_session_id, OSSL_NELEM(ssl_session_id),
|
---|
316 | &ret_value, value)) {
|
---|
317 | return 0;
|
---|
318 | }
|
---|
319 | test_ctx->session_id_expected = ret_value;
|
---|
320 | return 1;
|
---|
321 | }
|
---|
322 |
|
---|
323 | const char *ssl_session_id_name(ssl_session_id_t server)
|
---|
324 | {
|
---|
325 | return enum_name(ssl_session_id,
|
---|
326 | OSSL_NELEM(ssl_session_id),
|
---|
327 | server);
|
---|
328 | }
|
---|
329 |
|
---|
330 | /* Method */
|
---|
331 |
|
---|
332 | static const test_enum ssl_test_methods[] = {
|
---|
333 | {"TLS", SSL_TEST_METHOD_TLS},
|
---|
334 | {"DTLS", SSL_TEST_METHOD_DTLS},
|
---|
335 | };
|
---|
336 |
|
---|
337 | __owur static int parse_test_method(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
338 | {
|
---|
339 | int ret_value;
|
---|
340 | if (!parse_enum(ssl_test_methods, OSSL_NELEM(ssl_test_methods),
|
---|
341 | &ret_value, value)) {
|
---|
342 | return 0;
|
---|
343 | }
|
---|
344 | test_ctx->method = ret_value;
|
---|
345 | return 1;
|
---|
346 | }
|
---|
347 |
|
---|
348 | const char *ssl_test_method_name(ssl_test_method_t method)
|
---|
349 | {
|
---|
350 | return enum_name(ssl_test_methods, OSSL_NELEM(ssl_test_methods), method);
|
---|
351 | }
|
---|
352 |
|
---|
353 | /* NPN and ALPN options */
|
---|
354 |
|
---|
355 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CLIENT_CONF, client, npn_protocols)
|
---|
356 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_SERVER_CONF, server, npn_protocols)
|
---|
357 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CTX, test, expected_npn_protocol)
|
---|
358 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CLIENT_CONF, client, alpn_protocols)
|
---|
359 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_SERVER_CONF, server, alpn_protocols)
|
---|
360 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CTX, test, expected_alpn_protocol)
|
---|
361 |
|
---|
362 | /* SRP options */
|
---|
363 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CLIENT_CONF, client, srp_user)
|
---|
364 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_SERVER_CONF, server, srp_user)
|
---|
365 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CLIENT_CONF, client, srp_password)
|
---|
366 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_SERVER_CONF, server, srp_password)
|
---|
367 |
|
---|
368 | /* Session Ticket App Data options */
|
---|
369 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CTX, test, expected_session_ticket_app_data)
|
---|
370 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_SERVER_CONF, server, session_ticket_app_data)
|
---|
371 |
|
---|
372 | /* Handshake mode */
|
---|
373 |
|
---|
374 | static const test_enum ssl_handshake_modes[] = {
|
---|
375 | {"Simple", SSL_TEST_HANDSHAKE_SIMPLE},
|
---|
376 | {"Resume", SSL_TEST_HANDSHAKE_RESUME},
|
---|
377 | {"RenegotiateServer", SSL_TEST_HANDSHAKE_RENEG_SERVER},
|
---|
378 | {"RenegotiateClient", SSL_TEST_HANDSHAKE_RENEG_CLIENT},
|
---|
379 | {"KeyUpdateServer", SSL_TEST_HANDSHAKE_KEY_UPDATE_SERVER},
|
---|
380 | {"KeyUpdateClient", SSL_TEST_HANDSHAKE_KEY_UPDATE_CLIENT},
|
---|
381 | {"PostHandshakeAuth", SSL_TEST_HANDSHAKE_POST_HANDSHAKE_AUTH},
|
---|
382 | };
|
---|
383 |
|
---|
384 | __owur static int parse_handshake_mode(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
385 | {
|
---|
386 | int ret_value;
|
---|
387 | if (!parse_enum(ssl_handshake_modes, OSSL_NELEM(ssl_handshake_modes),
|
---|
388 | &ret_value, value)) {
|
---|
389 | return 0;
|
---|
390 | }
|
---|
391 | test_ctx->handshake_mode = ret_value;
|
---|
392 | return 1;
|
---|
393 | }
|
---|
394 |
|
---|
395 | const char *ssl_handshake_mode_name(ssl_handshake_mode_t mode)
|
---|
396 | {
|
---|
397 | return enum_name(ssl_handshake_modes, OSSL_NELEM(ssl_handshake_modes),
|
---|
398 | mode);
|
---|
399 | }
|
---|
400 |
|
---|
401 | /* Renegotiation Ciphersuites */
|
---|
402 |
|
---|
403 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CLIENT_CONF, client, reneg_ciphers)
|
---|
404 |
|
---|
405 | /* KeyUpdateType */
|
---|
406 |
|
---|
407 | static const test_enum ssl_key_update_types[] = {
|
---|
408 | {"KeyUpdateRequested", SSL_KEY_UPDATE_REQUESTED},
|
---|
409 | {"KeyUpdateNotRequested", SSL_KEY_UPDATE_NOT_REQUESTED},
|
---|
410 | };
|
---|
411 |
|
---|
412 | __owur static int parse_key_update_type(SSL_TEST_CTX *test_ctx, const char *value)
|
---|
413 | {
|
---|
414 | int ret_value;
|
---|
415 | if (!parse_enum(ssl_key_update_types, OSSL_NELEM(ssl_key_update_types),
|
---|
416 | &ret_value, value)) {
|
---|
417 | return 0;
|
---|
418 | }
|
---|
419 | test_ctx->key_update_type = ret_value;
|
---|
420 | return 1;
|
---|
421 | }
|
---|
422 |
|
---|
423 | /* CT Validation */
|
---|
424 |
|
---|
425 | static const test_enum ssl_ct_validation_modes[] = {
|
---|
426 | {"None", SSL_TEST_CT_VALIDATION_NONE},
|
---|
427 | {"Permissive", SSL_TEST_CT_VALIDATION_PERMISSIVE},
|
---|
428 | {"Strict", SSL_TEST_CT_VALIDATION_STRICT},
|
---|
429 | };
|
---|
430 |
|
---|
431 | __owur static int parse_ct_validation(SSL_TEST_CLIENT_CONF *client_conf,
|
---|
432 | const char *value)
|
---|
433 | {
|
---|
434 | int ret_value;
|
---|
435 | if (!parse_enum(ssl_ct_validation_modes, OSSL_NELEM(ssl_ct_validation_modes),
|
---|
436 | &ret_value, value)) {
|
---|
437 | return 0;
|
---|
438 | }
|
---|
439 | client_conf->ct_validation = ret_value;
|
---|
440 | return 1;
|
---|
441 | }
|
---|
442 |
|
---|
443 | const char *ssl_ct_validation_name(ssl_ct_validation_t mode)
|
---|
444 | {
|
---|
445 | return enum_name(ssl_ct_validation_modes, OSSL_NELEM(ssl_ct_validation_modes),
|
---|
446 | mode);
|
---|
447 | }
|
---|
448 |
|
---|
449 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CTX, test, resumption_expected)
|
---|
450 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_SERVER_CONF, server, broken_session_ticket)
|
---|
451 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CTX, test, use_sctp)
|
---|
452 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CTX, test, enable_client_sctp_label_bug)
|
---|
453 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CTX, test, enable_server_sctp_label_bug)
|
---|
454 |
|
---|
455 | /* CertStatus */
|
---|
456 |
|
---|
457 | static const test_enum ssl_certstatus[] = {
|
---|
458 | {"None", SSL_TEST_CERT_STATUS_NONE},
|
---|
459 | {"GoodResponse", SSL_TEST_CERT_STATUS_GOOD_RESPONSE},
|
---|
460 | {"BadResponse", SSL_TEST_CERT_STATUS_BAD_RESPONSE}
|
---|
461 | };
|
---|
462 |
|
---|
463 | __owur static int parse_certstatus(SSL_TEST_SERVER_CONF *server_conf,
|
---|
464 | const char *value)
|
---|
465 | {
|
---|
466 | int ret_value;
|
---|
467 | if (!parse_enum(ssl_certstatus, OSSL_NELEM(ssl_certstatus), &ret_value,
|
---|
468 | value)) {
|
---|
469 | return 0;
|
---|
470 | }
|
---|
471 | server_conf->cert_status = ret_value;
|
---|
472 | return 1;
|
---|
473 | }
|
---|
474 |
|
---|
475 | const char *ssl_certstatus_name(ssl_cert_status_t cert_status)
|
---|
476 | {
|
---|
477 | return enum_name(ssl_certstatus,
|
---|
478 | OSSL_NELEM(ssl_certstatus), cert_status);
|
---|
479 | }
|
---|
480 |
|
---|
481 | /* ApplicationData */
|
---|
482 |
|
---|
483 | IMPLEMENT_SSL_TEST_INT_OPTION(SSL_TEST_CTX, test, app_data_size)
|
---|
484 |
|
---|
485 |
|
---|
486 | /* MaxFragmentSize */
|
---|
487 |
|
---|
488 | IMPLEMENT_SSL_TEST_INT_OPTION(SSL_TEST_CTX, test, max_fragment_size)
|
---|
489 |
|
---|
490 | /* Maximum-Fragment-Length TLS extension mode */
|
---|
491 | static const test_enum ssl_max_fragment_len_mode[] = {
|
---|
492 | {"None", TLSEXT_max_fragment_length_DISABLED},
|
---|
493 | { "512", TLSEXT_max_fragment_length_512},
|
---|
494 | {"1024", TLSEXT_max_fragment_length_1024},
|
---|
495 | {"2048", TLSEXT_max_fragment_length_2048},
|
---|
496 | {"4096", TLSEXT_max_fragment_length_4096}
|
---|
497 | };
|
---|
498 |
|
---|
499 | __owur static int parse_max_fragment_len_mode(SSL_TEST_CLIENT_CONF *client_conf,
|
---|
500 | const char *value)
|
---|
501 | {
|
---|
502 | int ret_value;
|
---|
503 |
|
---|
504 | if (!parse_enum(ssl_max_fragment_len_mode,
|
---|
505 | OSSL_NELEM(ssl_max_fragment_len_mode), &ret_value, value)) {
|
---|
506 | return 0;
|
---|
507 | }
|
---|
508 | client_conf->max_fragment_len_mode = ret_value;
|
---|
509 | return 1;
|
---|
510 | }
|
---|
511 |
|
---|
512 | const char *ssl_max_fragment_len_name(int MFL_mode)
|
---|
513 | {
|
---|
514 | return enum_name(ssl_max_fragment_len_mode,
|
---|
515 | OSSL_NELEM(ssl_max_fragment_len_mode), MFL_mode);
|
---|
516 | }
|
---|
517 |
|
---|
518 |
|
---|
519 | /* Expected key and signature types */
|
---|
520 |
|
---|
521 | __owur static int parse_expected_key_type(int *ptype, const char *value)
|
---|
522 | {
|
---|
523 | int nid;
|
---|
524 | const EVP_PKEY_ASN1_METHOD *ameth;
|
---|
525 |
|
---|
526 | if (value == NULL)
|
---|
527 | return 0;
|
---|
528 | ameth = EVP_PKEY_asn1_find_str(NULL, value, -1);
|
---|
529 | if (ameth != NULL)
|
---|
530 | EVP_PKEY_asn1_get0_info(&nid, NULL, NULL, NULL, NULL, ameth);
|
---|
531 | else
|
---|
532 | nid = OBJ_sn2nid(value);
|
---|
533 | if (nid == NID_undef)
|
---|
534 | nid = OBJ_ln2nid(value);
|
---|
535 | #ifndef OPENSSL_NO_EC
|
---|
536 | if (nid == NID_undef)
|
---|
537 | nid = EC_curve_nist2nid(value);
|
---|
538 | #endif
|
---|
539 | if (nid == NID_undef)
|
---|
540 | return 0;
|
---|
541 | *ptype = nid;
|
---|
542 | return 1;
|
---|
543 | }
|
---|
544 |
|
---|
545 | __owur static int parse_expected_tmp_key_type(SSL_TEST_CTX *test_ctx,
|
---|
546 | const char *value)
|
---|
547 | {
|
---|
548 | return parse_expected_key_type(&test_ctx->expected_tmp_key_type, value);
|
---|
549 | }
|
---|
550 |
|
---|
551 | __owur static int parse_expected_server_cert_type(SSL_TEST_CTX *test_ctx,
|
---|
552 | const char *value)
|
---|
553 | {
|
---|
554 | return parse_expected_key_type(&test_ctx->expected_server_cert_type,
|
---|
555 | value);
|
---|
556 | }
|
---|
557 |
|
---|
558 | __owur static int parse_expected_server_sign_type(SSL_TEST_CTX *test_ctx,
|
---|
559 | const char *value)
|
---|
560 | {
|
---|
561 | return parse_expected_key_type(&test_ctx->expected_server_sign_type,
|
---|
562 | value);
|
---|
563 | }
|
---|
564 |
|
---|
565 | __owur static int parse_expected_client_cert_type(SSL_TEST_CTX *test_ctx,
|
---|
566 | const char *value)
|
---|
567 | {
|
---|
568 | return parse_expected_key_type(&test_ctx->expected_client_cert_type,
|
---|
569 | value);
|
---|
570 | }
|
---|
571 |
|
---|
572 | __owur static int parse_expected_client_sign_type(SSL_TEST_CTX *test_ctx,
|
---|
573 | const char *value)
|
---|
574 | {
|
---|
575 | return parse_expected_key_type(&test_ctx->expected_client_sign_type,
|
---|
576 | value);
|
---|
577 | }
|
---|
578 |
|
---|
579 |
|
---|
580 | /* Expected signing hash */
|
---|
581 |
|
---|
582 | __owur static int parse_expected_sign_hash(int *ptype, const char *value)
|
---|
583 | {
|
---|
584 | int nid;
|
---|
585 |
|
---|
586 | if (value == NULL)
|
---|
587 | return 0;
|
---|
588 | nid = OBJ_sn2nid(value);
|
---|
589 | if (nid == NID_undef)
|
---|
590 | nid = OBJ_ln2nid(value);
|
---|
591 | if (nid == NID_undef)
|
---|
592 | return 0;
|
---|
593 | *ptype = nid;
|
---|
594 | return 1;
|
---|
595 | }
|
---|
596 |
|
---|
597 | __owur static int parse_expected_server_sign_hash(SSL_TEST_CTX *test_ctx,
|
---|
598 | const char *value)
|
---|
599 | {
|
---|
600 | return parse_expected_sign_hash(&test_ctx->expected_server_sign_hash,
|
---|
601 | value);
|
---|
602 | }
|
---|
603 |
|
---|
604 | __owur static int parse_expected_client_sign_hash(SSL_TEST_CTX *test_ctx,
|
---|
605 | const char *value)
|
---|
606 | {
|
---|
607 | return parse_expected_sign_hash(&test_ctx->expected_client_sign_hash,
|
---|
608 | value);
|
---|
609 | }
|
---|
610 |
|
---|
611 | __owur static int parse_expected_ca_names(STACK_OF(X509_NAME) **pnames,
|
---|
612 | const char *value,
|
---|
613 | OSSL_LIB_CTX *libctx)
|
---|
614 | {
|
---|
615 | if (value == NULL)
|
---|
616 | return 0;
|
---|
617 | if (!strcmp(value, "empty"))
|
---|
618 | *pnames = sk_X509_NAME_new_null();
|
---|
619 | else
|
---|
620 | *pnames = SSL_load_client_CA_file_ex(value, libctx, NULL);
|
---|
621 | return *pnames != NULL;
|
---|
622 | }
|
---|
623 | __owur static int parse_expected_server_ca_names(SSL_TEST_CTX *test_ctx,
|
---|
624 | const char *value)
|
---|
625 | {
|
---|
626 | return parse_expected_ca_names(&test_ctx->expected_server_ca_names, value,
|
---|
627 | test_ctx->libctx);
|
---|
628 | }
|
---|
629 | __owur static int parse_expected_client_ca_names(SSL_TEST_CTX *test_ctx,
|
---|
630 | const char *value)
|
---|
631 | {
|
---|
632 | return parse_expected_ca_names(&test_ctx->expected_client_ca_names, value,
|
---|
633 | test_ctx->libctx);
|
---|
634 | }
|
---|
635 |
|
---|
636 | /* ExpectedCipher */
|
---|
637 |
|
---|
638 | IMPLEMENT_SSL_TEST_STRING_OPTION(SSL_TEST_CTX, test, expected_cipher)
|
---|
639 |
|
---|
640 | /* Client and Server PHA */
|
---|
641 |
|
---|
642 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CLIENT_CONF, client, enable_pha)
|
---|
643 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_SERVER_CONF, server, force_pha)
|
---|
644 | IMPLEMENT_SSL_TEST_BOOL_OPTION(SSL_TEST_CLIENT_CONF, client, no_extms_on_reneg)
|
---|
645 |
|
---|
646 | /* Known test options and their corresponding parse methods. */
|
---|
647 |
|
---|
648 | /* Top-level options. */
|
---|
649 | typedef struct {
|
---|
650 | const char *name;
|
---|
651 | int (*parse)(SSL_TEST_CTX *test_ctx, const char *value);
|
---|
652 | } ssl_test_ctx_option;
|
---|
653 |
|
---|
654 | static const ssl_test_ctx_option ssl_test_ctx_options[] = {
|
---|
655 | { "ExpectedResult", &parse_expected_result },
|
---|
656 | { "ExpectedClientAlert", &parse_client_alert },
|
---|
657 | { "ExpectedServerAlert", &parse_server_alert },
|
---|
658 | { "ExpectedProtocol", &parse_protocol },
|
---|
659 | { "ExpectedServerName", &parse_expected_servername },
|
---|
660 | { "SessionTicketExpected", &parse_session_ticket },
|
---|
661 | { "CompressionExpected", &parse_test_compression_expected },
|
---|
662 | { "SessionIdExpected", &parse_session_id },
|
---|
663 | { "Method", &parse_test_method },
|
---|
664 | { "ExpectedNPNProtocol", &parse_test_expected_npn_protocol },
|
---|
665 | { "ExpectedALPNProtocol", &parse_test_expected_alpn_protocol },
|
---|
666 | { "HandshakeMode", &parse_handshake_mode },
|
---|
667 | { "KeyUpdateType", &parse_key_update_type },
|
---|
668 | { "ResumptionExpected", &parse_test_resumption_expected },
|
---|
669 | { "ApplicationData", &parse_test_app_data_size },
|
---|
670 | { "MaxFragmentSize", &parse_test_max_fragment_size },
|
---|
671 | { "ExpectedTmpKeyType", &parse_expected_tmp_key_type },
|
---|
672 | { "ExpectedServerCertType", &parse_expected_server_cert_type },
|
---|
673 | { "ExpectedServerSignHash", &parse_expected_server_sign_hash },
|
---|
674 | { "ExpectedServerSignType", &parse_expected_server_sign_type },
|
---|
675 | { "ExpectedServerCANames", &parse_expected_server_ca_names },
|
---|
676 | { "ExpectedClientCertType", &parse_expected_client_cert_type },
|
---|
677 | { "ExpectedClientSignHash", &parse_expected_client_sign_hash },
|
---|
678 | { "ExpectedClientSignType", &parse_expected_client_sign_type },
|
---|
679 | { "ExpectedClientCANames", &parse_expected_client_ca_names },
|
---|
680 | { "UseSCTP", &parse_test_use_sctp },
|
---|
681 | { "EnableClientSCTPLabelBug", &parse_test_enable_client_sctp_label_bug },
|
---|
682 | { "EnableServerSCTPLabelBug", &parse_test_enable_server_sctp_label_bug },
|
---|
683 | { "ExpectedCipher", &parse_test_expected_cipher },
|
---|
684 | { "ExpectedSessionTicketAppData", &parse_test_expected_session_ticket_app_data },
|
---|
685 | };
|
---|
686 |
|
---|
687 | /* Nested client options. */
|
---|
688 | typedef struct {
|
---|
689 | const char *name;
|
---|
690 | int (*parse)(SSL_TEST_CLIENT_CONF *conf, const char *value);
|
---|
691 | } ssl_test_client_option;
|
---|
692 |
|
---|
693 | static const ssl_test_client_option ssl_test_client_options[] = {
|
---|
694 | { "VerifyCallback", &parse_client_verify_callback },
|
---|
695 | { "ServerName", &parse_servername },
|
---|
696 | { "NPNProtocols", &parse_client_npn_protocols },
|
---|
697 | { "ALPNProtocols", &parse_client_alpn_protocols },
|
---|
698 | { "CTValidation", &parse_ct_validation },
|
---|
699 | { "RenegotiateCiphers", &parse_client_reneg_ciphers},
|
---|
700 | { "SRPUser", &parse_client_srp_user },
|
---|
701 | { "SRPPassword", &parse_client_srp_password },
|
---|
702 | { "MaxFragmentLenExt", &parse_max_fragment_len_mode },
|
---|
703 | { "EnablePHA", &parse_client_enable_pha },
|
---|
704 | { "RenegotiateNoExtms", &parse_client_no_extms_on_reneg },
|
---|
705 | };
|
---|
706 |
|
---|
707 | /* Nested server options. */
|
---|
708 | typedef struct {
|
---|
709 | const char *name;
|
---|
710 | int (*parse)(SSL_TEST_SERVER_CONF *conf, const char *value);
|
---|
711 | } ssl_test_server_option;
|
---|
712 |
|
---|
713 | static const ssl_test_server_option ssl_test_server_options[] = {
|
---|
714 | { "ServerNameCallback", &parse_servername_callback },
|
---|
715 | { "NPNProtocols", &parse_server_npn_protocols },
|
---|
716 | { "ALPNProtocols", &parse_server_alpn_protocols },
|
---|
717 | { "BrokenSessionTicket", &parse_server_broken_session_ticket },
|
---|
718 | { "CertStatus", &parse_certstatus },
|
---|
719 | { "SRPUser", &parse_server_srp_user },
|
---|
720 | { "SRPPassword", &parse_server_srp_password },
|
---|
721 | { "ForcePHA", &parse_server_force_pha },
|
---|
722 | { "SessionTicketAppData", &parse_server_session_ticket_app_data },
|
---|
723 | };
|
---|
724 |
|
---|
725 | SSL_TEST_CTX *SSL_TEST_CTX_new(OSSL_LIB_CTX *libctx)
|
---|
726 | {
|
---|
727 | SSL_TEST_CTX *ret;
|
---|
728 |
|
---|
729 | /* The return code is checked by caller */
|
---|
730 | if ((ret = OPENSSL_zalloc(sizeof(*ret))) != NULL) {
|
---|
731 | ret->libctx = libctx;
|
---|
732 | ret->app_data_size = default_app_data_size;
|
---|
733 | ret->max_fragment_size = default_max_fragment_size;
|
---|
734 | }
|
---|
735 | return ret;
|
---|
736 | }
|
---|
737 |
|
---|
738 | static void ssl_test_extra_conf_free_data(SSL_TEST_EXTRA_CONF *conf)
|
---|
739 | {
|
---|
740 | OPENSSL_free(conf->client.npn_protocols);
|
---|
741 | OPENSSL_free(conf->server.npn_protocols);
|
---|
742 | OPENSSL_free(conf->server2.npn_protocols);
|
---|
743 | OPENSSL_free(conf->client.alpn_protocols);
|
---|
744 | OPENSSL_free(conf->server.alpn_protocols);
|
---|
745 | OPENSSL_free(conf->server2.alpn_protocols);
|
---|
746 | OPENSSL_free(conf->client.reneg_ciphers);
|
---|
747 | OPENSSL_free(conf->server.srp_user);
|
---|
748 | OPENSSL_free(conf->server.srp_password);
|
---|
749 | OPENSSL_free(conf->server2.srp_user);
|
---|
750 | OPENSSL_free(conf->server2.srp_password);
|
---|
751 | OPENSSL_free(conf->client.srp_user);
|
---|
752 | OPENSSL_free(conf->client.srp_password);
|
---|
753 | OPENSSL_free(conf->server.session_ticket_app_data);
|
---|
754 | OPENSSL_free(conf->server2.session_ticket_app_data);
|
---|
755 | }
|
---|
756 |
|
---|
757 | static void ssl_test_ctx_free_extra_data(SSL_TEST_CTX *ctx)
|
---|
758 | {
|
---|
759 | ssl_test_extra_conf_free_data(&ctx->extra);
|
---|
760 | ssl_test_extra_conf_free_data(&ctx->resume_extra);
|
---|
761 | }
|
---|
762 |
|
---|
763 | void SSL_TEST_CTX_free(SSL_TEST_CTX *ctx)
|
---|
764 | {
|
---|
765 | if (ctx == NULL)
|
---|
766 | return;
|
---|
767 | ssl_test_ctx_free_extra_data(ctx);
|
---|
768 | OPENSSL_free(ctx->expected_npn_protocol);
|
---|
769 | OPENSSL_free(ctx->expected_alpn_protocol);
|
---|
770 | OPENSSL_free(ctx->expected_session_ticket_app_data);
|
---|
771 | sk_X509_NAME_pop_free(ctx->expected_server_ca_names, X509_NAME_free);
|
---|
772 | sk_X509_NAME_pop_free(ctx->expected_client_ca_names, X509_NAME_free);
|
---|
773 | OPENSSL_free(ctx->expected_cipher);
|
---|
774 | OPENSSL_free(ctx);
|
---|
775 | }
|
---|
776 |
|
---|
777 | static int parse_client_options(SSL_TEST_CLIENT_CONF *client, const CONF *conf,
|
---|
778 | const char *client_section)
|
---|
779 | {
|
---|
780 | STACK_OF(CONF_VALUE) *sk_conf;
|
---|
781 | int i;
|
---|
782 | size_t j;
|
---|
783 |
|
---|
784 | if (!TEST_ptr(sk_conf = NCONF_get_section(conf, client_section)))
|
---|
785 | return 0;
|
---|
786 |
|
---|
787 | for (i = 0; i < sk_CONF_VALUE_num(sk_conf); i++) {
|
---|
788 | int found = 0;
|
---|
789 | const CONF_VALUE *option = sk_CONF_VALUE_value(sk_conf, i);
|
---|
790 | for (j = 0; j < OSSL_NELEM(ssl_test_client_options); j++) {
|
---|
791 | if (strcmp(option->name, ssl_test_client_options[j].name) == 0) {
|
---|
792 | if (!ssl_test_client_options[j].parse(client, option->value)) {
|
---|
793 | TEST_info("Bad value %s for option %s",
|
---|
794 | option->value, option->name);
|
---|
795 | return 0;
|
---|
796 | }
|
---|
797 | found = 1;
|
---|
798 | break;
|
---|
799 | }
|
---|
800 | }
|
---|
801 | if (!found) {
|
---|
802 | TEST_info("Unknown test option: %s", option->name);
|
---|
803 | return 0;
|
---|
804 | }
|
---|
805 | }
|
---|
806 |
|
---|
807 | return 1;
|
---|
808 | }
|
---|
809 |
|
---|
810 | static int parse_server_options(SSL_TEST_SERVER_CONF *server, const CONF *conf,
|
---|
811 | const char *server_section)
|
---|
812 | {
|
---|
813 | STACK_OF(CONF_VALUE) *sk_conf;
|
---|
814 | int i;
|
---|
815 | size_t j;
|
---|
816 |
|
---|
817 | if (!TEST_ptr(sk_conf = NCONF_get_section(conf, server_section)))
|
---|
818 | return 0;
|
---|
819 |
|
---|
820 | for (i = 0; i < sk_CONF_VALUE_num(sk_conf); i++) {
|
---|
821 | int found = 0;
|
---|
822 | const CONF_VALUE *option = sk_CONF_VALUE_value(sk_conf, i);
|
---|
823 | for (j = 0; j < OSSL_NELEM(ssl_test_server_options); j++) {
|
---|
824 | if (strcmp(option->name, ssl_test_server_options[j].name) == 0) {
|
---|
825 | if (!ssl_test_server_options[j].parse(server, option->value)) {
|
---|
826 | TEST_info("Bad value %s for option %s",
|
---|
827 | option->value, option->name);
|
---|
828 | return 0;
|
---|
829 | }
|
---|
830 | found = 1;
|
---|
831 | break;
|
---|
832 | }
|
---|
833 | }
|
---|
834 | if (!found) {
|
---|
835 | TEST_info("Unknown test option: %s", option->name);
|
---|
836 | return 0;
|
---|
837 | }
|
---|
838 | }
|
---|
839 |
|
---|
840 | return 1;
|
---|
841 | }
|
---|
842 |
|
---|
843 | SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section,
|
---|
844 | OSSL_LIB_CTX *libctx)
|
---|
845 | {
|
---|
846 | STACK_OF(CONF_VALUE) *sk_conf = NULL;
|
---|
847 | SSL_TEST_CTX *ctx = NULL;
|
---|
848 | int i;
|
---|
849 | size_t j;
|
---|
850 |
|
---|
851 | if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section))
|
---|
852 | || !TEST_ptr(ctx = SSL_TEST_CTX_new(libctx)))
|
---|
853 | goto err;
|
---|
854 |
|
---|
855 | for (i = 0; i < sk_CONF_VALUE_num(sk_conf); i++) {
|
---|
856 | int found = 0;
|
---|
857 | const CONF_VALUE *option = sk_CONF_VALUE_value(sk_conf, i);
|
---|
858 |
|
---|
859 | /* Subsections */
|
---|
860 | if (strcmp(option->name, "client") == 0) {
|
---|
861 | if (!parse_client_options(&ctx->extra.client, conf, option->value))
|
---|
862 | goto err;
|
---|
863 | } else if (strcmp(option->name, "server") == 0) {
|
---|
864 | if (!parse_server_options(&ctx->extra.server, conf, option->value))
|
---|
865 | goto err;
|
---|
866 | } else if (strcmp(option->name, "server2") == 0) {
|
---|
867 | if (!parse_server_options(&ctx->extra.server2, conf, option->value))
|
---|
868 | goto err;
|
---|
869 | } else if (strcmp(option->name, "resume-client") == 0) {
|
---|
870 | if (!parse_client_options(&ctx->resume_extra.client, conf,
|
---|
871 | option->value))
|
---|
872 | goto err;
|
---|
873 | } else if (strcmp(option->name, "resume-server") == 0) {
|
---|
874 | if (!parse_server_options(&ctx->resume_extra.server, conf,
|
---|
875 | option->value))
|
---|
876 | goto err;
|
---|
877 | } else if (strcmp(option->name, "resume-server2") == 0) {
|
---|
878 | if (!parse_server_options(&ctx->resume_extra.server2, conf,
|
---|
879 | option->value))
|
---|
880 | goto err;
|
---|
881 | } else {
|
---|
882 | for (j = 0; j < OSSL_NELEM(ssl_test_ctx_options); j++) {
|
---|
883 | if (strcmp(option->name, ssl_test_ctx_options[j].name) == 0) {
|
---|
884 | if (!ssl_test_ctx_options[j].parse(ctx, option->value)) {
|
---|
885 | TEST_info("Bad value %s for option %s",
|
---|
886 | option->value, option->name);
|
---|
887 | goto err;
|
---|
888 | }
|
---|
889 | found = 1;
|
---|
890 | break;
|
---|
891 | }
|
---|
892 | }
|
---|
893 | if (!found) {
|
---|
894 | TEST_info("Unknown test option: %s", option->name);
|
---|
895 | goto err;
|
---|
896 | }
|
---|
897 | }
|
---|
898 | }
|
---|
899 |
|
---|
900 | goto done;
|
---|
901 |
|
---|
902 | err:
|
---|
903 | SSL_TEST_CTX_free(ctx);
|
---|
904 | ctx = NULL;
|
---|
905 | done:
|
---|
906 | return ctx;
|
---|
907 | }
|
---|