blob: 8ad53d52463cdeca879108dc76e257417a4a6ae7 [file] [log] [blame]
David Benjamin5a593af2014-08-11 19:51:50 -04001/* Copyright (c) 2014, Google Inc.
2 *
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15#ifndef HEADER_TEST_CONFIG
16#define HEADER_TEST_CONFIG
17
18#include <string>
David Benjaminca3d5452016-07-14 12:51:01 -040019#include <vector>
David Benjamin5a593af2014-08-11 19:51:50 -040020
21
22struct TestConfig {
David Benjamin0d4db502015-03-23 18:46:05 -040023 int port = 0;
24 bool is_server = false;
25 bool is_dtls = false;
David Benjamin46662482016-08-17 00:51:00 -040026 int resume_count = 0;
David Benjamin0fde2eb2017-06-30 19:11:22 -040027 std::string write_settings;
David Benjamin0d4db502015-03-23 18:46:05 -040028 bool fallback_scsv = false;
Steven Valdez0d62f262015-09-04 12:41:04 -040029 std::string digest_prefs;
David Benjaminca3d5452016-07-14 12:51:01 -040030 std::vector<int> signing_prefs;
David Benjamin71c21b42017-04-14 17:05:40 -040031 std::vector<int> verify_prefs;
David Benjamin5a593af2014-08-11 19:51:50 -040032 std::string key_file;
33 std::string cert_file;
34 std::string expected_server_name;
35 std::string expected_certificate_types;
David Benjamin0d4db502015-03-23 18:46:05 -040036 bool require_any_client_certificate = false;
David Benjamin5a593af2014-08-11 19:51:50 -040037 std::string advertise_npn;
38 std::string expected_next_proto;
David Benjamin0d4db502015-03-23 18:46:05 -040039 bool false_start = false;
David Benjamin5a593af2014-08-11 19:51:50 -040040 std::string select_next_proto;
David Benjamin0d4db502015-03-23 18:46:05 -040041 bool async = false;
42 bool write_different_record_sizes = false;
43 bool cbc_record_splitting = false;
44 bool partial_write = false;
Steven Valdez4f94b1c2016-05-24 12:31:07 -040045 bool no_tls13 = false;
David Benjamin0d4db502015-03-23 18:46:05 -040046 bool no_tls12 = false;
47 bool no_tls11 = false;
48 bool no_tls1 = false;
49 bool no_ssl3 = false;
David Benjamina08e49d2014-08-24 01:46:07 -040050 std::string expected_channel_id;
Steven Valdez143e8b32016-07-11 13:19:03 -040051 bool enable_channel_id = false;
David Benjamina08e49d2014-08-24 01:46:07 -040052 std::string send_channel_id;
David Benjamin0d4db502015-03-23 18:46:05 -040053 bool shim_writes_first = false;
David Benjamine78bfde2014-09-06 12:45:15 -040054 std::string host_name;
David Benjaminae2888f2014-09-06 12:58:58 -040055 std::string advertise_alpn;
56 std::string expected_alpn;
Steven Valdeze831a812017-03-09 14:56:07 -050057 std::string expected_late_alpn;
David Benjaminae2888f2014-09-06 12:58:58 -040058 std::string expected_advertised_alpn;
59 std::string select_alpn;
David Benjamin594e7d22016-03-17 17:49:56 -040060 bool decline_alpn = false;
David Benjamin0d4db502015-03-23 18:46:05 -040061 bool expect_session_miss = false;
62 bool expect_extended_master_secret = false;
David Benjamin48cae082014-10-27 01:06:24 -040063 std::string psk;
64 std::string psk_identity;
David Benjaminca6c8262014-11-15 19:06:08 -050065 std::string srtp_profiles;
David Benjamin0d4db502015-03-23 18:46:05 -040066 bool enable_ocsp_stapling = false;
David Benjamin61f95272014-11-25 01:55:35 -050067 std::string expected_ocsp_response;
David Benjamin0d4db502015-03-23 18:46:05 -040068 bool enable_signed_cert_timestamps = false;
David Benjamin61f95272014-11-25 01:55:35 -050069 std::string expected_signed_cert_timestamps;
David Benjamin0d4db502015-03-23 18:46:05 -040070 int min_version = 0;
71 int max_version = 0;
72 int mtu = 0;
73 bool implicit_handshake = false;
74 bool use_early_callback = false;
75 bool fail_early_callback = false;
76 bool install_ddos_callback = false;
77 bool fail_ddos_callback = false;
78 bool fail_second_ddos_callback = false;
David Benjaminb8d74f52016-11-14 22:02:50 +090079 bool fail_cert_callback = false;
David Benjamin67d1fb52015-03-16 15:16:23 -040080 std::string cipher;
David Benjamin87e4acd2015-04-02 19:57:35 -040081 bool handshake_never_done = false;
David Benjaminc565ebb2015-04-03 04:06:36 -040082 int export_keying_material = 0;
83 std::string export_label;
84 std::string export_context;
85 bool use_export_context = false;
Adam Langleyaf0e32c2015-06-03 09:57:23 -070086 bool tls_unique = false;
David Benjaminba4594a2015-06-18 18:36:15 -040087 bool expect_ticket_renewal = false;
88 bool expect_no_session = false;
Steven Valdez08b65f42016-12-07 15:29:45 -050089 bool expect_early_data_info = false;
Steven Valdez2d850622017-01-11 11:34:52 -050090 bool expect_accept_early_data = false;
91 bool expect_reject_early_data = false;
David Benjamind98452d2015-06-16 14:16:23 -040092 bool use_ticket_callback = false;
93 bool renew_ticket = false;
Steven Valdez08b65f42016-12-07 15:29:45 -050094 bool enable_early_data = false;
Adam Langley09505632015-07-30 18:10:13 -070095 bool enable_client_custom_extension = false;
96 bool enable_server_custom_extension = false;
97 bool custom_extension_skip = false;
98 bool custom_extension_fail_add = false;
Paul Lietaraeeff2c2015-08-12 11:47:11 +010099 std::string ocsp_response;
David Benjamin30789da2015-08-29 22:56:45 -0400100 bool check_close_notify = false;
101 bool shim_shuts_down = false;
Paul Lietar8f1c2682015-08-18 12:21:54 +0100102 bool verify_fail = false;
103 bool verify_peer = false;
David Benjaminc3648fa2017-07-01 10:50:56 -0400104 bool verify_peer_if_no_obc = false;
Paul Lietar8f1c2682015-08-18 12:21:54 +0100105 bool expect_verify_result = false;
Paul Lietar4fac72e2015-09-09 13:44:55 +0100106 std::string signed_cert_timestamps;
David Benjamin324dce42015-10-12 19:49:00 -0400107 int expect_total_renegotiations = 0;
David Benjamin1d5ef3b2015-10-12 19:54:18 -0400108 bool renegotiate_once = false;
109 bool renegotiate_freely = false;
Adam Langley27a0d082015-11-03 13:34:10 -0800110 bool renegotiate_ignore = false;
Nick Harper60edffd2016-06-21 15:19:24 -0700111 int expect_peer_signature_algorithm = 0;
David Benjamin99fdfb92015-11-02 12:11:35 -0500112 bool p384_only = false;
David Benjamin8c2b3bf2015-12-18 20:55:44 -0500113 bool enable_all_curves = false;
David Benjamin9e68f192016-06-30 14:55:33 -0400114 int expect_curve_id = 0;
David Benjaminacb6dcc2016-03-10 09:15:01 -0500115 bool use_old_client_cert_callback = false;
Taylor Brandstetter376a0fe2016-05-10 19:30:28 -0700116 int initial_timeout_duration_ms = 0;
Adam Langley2ff79332017-02-28 13:45:39 -0800117 std::string use_client_ca_list;
118 std::string expected_client_ca_list;
David Benjamin1d4f4c02016-07-26 18:03:08 -0400119 bool send_alert = false;
David Benjaminf3fbade2016-09-19 13:08:16 -0400120 bool peek_then_read = false;
David Benjamin65ac9972016-09-02 21:35:25 -0400121 bool enable_grease = false;
David Benjamina252b342016-09-26 19:57:53 -0400122 int max_cert_list = 0;
David Benjamin4199b0d2016-11-01 13:58:25 -0400123 std::string ticket_key;
David Benjamin7bb1d292016-11-01 19:45:06 -0400124 bool use_exporter_between_reads = false;
David Benjaminabbbee12016-10-31 19:20:42 -0400125 int expect_cipher_aes = 0;
126 int expect_cipher_no_aes = 0;
David Benjamin2c516452016-11-15 10:16:54 +0900127 std::string expect_peer_cert_file;
Steven Valdeza833c352016-11-01 13:39:36 -0400128 int resumption_delay = 0;
David Benjaminbbaf3672016-11-17 10:53:09 +0900129 bool retain_only_sha256_client_cert_initial = false;
130 bool retain_only_sha256_client_cert_resume = false;
131 bool expect_sha256_client_cert_initial = false;
132 bool expect_sha256_client_cert_resume = false;
David Benjamina1eaba12017-01-01 23:19:22 -0500133 bool read_with_unfinished_write = false;
David Benjamind2610042017-01-03 10:49:28 -0500134 bool expect_secure_renegotiation = false;
135 bool expect_no_secure_renegotiation = false;
David Benjamine3fbb362017-01-06 16:19:28 -0500136 int max_send_fragment = 0;
137 int read_size = 0;
David Benjaminb5c58db2017-01-28 01:39:29 -0500138 bool expect_session_id = false;
139 bool expect_no_session_id = false;
David Benjamin35ac5b72017-03-03 15:05:56 -0500140 int expect_ticket_age_skew = 0;
David Benjamin8c26d752017-03-26 15:13:51 -0500141 bool no_op_extra_handshake = false;
142 bool handshake_twice = false;
David Benjaminc8ff30c2017-04-04 13:52:36 -0400143 bool allow_unknown_alpn_protos = false;
David Benjamin69522112017-03-28 15:38:29 -0500144 bool enable_ed25519 = false;
David Benjamin5a593af2014-08-11 19:51:50 -0400145};
146
Steven Valdeze831a812017-03-09 14:56:07 -0500147bool ParseConfig(int argc, char **argv, TestConfig *out_initial,
148 TestConfig *out_resume, TestConfig *out_retry);
David Benjamin5a593af2014-08-11 19:51:50 -0400149
David Benjamin5a593af2014-08-11 19:51:50 -0400150
151#endif // HEADER_TEST_CONFIG