blob: 279b13d5805d642128741bcae9f00cf0284af6c6 [file] [log] [blame]
Adam Langleyd9e397b2015-01-22 14:27:53 -08001/* 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 Benjaminc895d6b2016-08-11 13:26:41 -040019#include <vector>
Adam Langleyd9e397b2015-01-22 14:27:53 -080020
21
22struct TestConfig {
Adam Langleye9ada862015-05-11 17:20:37 -070023 int port = 0;
24 bool is_server = false;
25 bool is_dtls = false;
David Benjaminf0c4a6c2016-08-11 13:26:41 -040026 int resume_count = 0;
Adam Langleye9ada862015-05-11 17:20:37 -070027 bool fallback_scsv = false;
Kenny Rootb8494592015-09-25 02:29:14 +000028 std::string digest_prefs;
David Benjaminc895d6b2016-08-11 13:26:41 -040029 std::vector<int> signing_prefs;
Robert Sloan572a4e22017-04-17 10:52:19 -070030 std::vector<int> verify_prefs;
Adam Langleyd9e397b2015-01-22 14:27:53 -080031 std::string key_file;
32 std::string cert_file;
33 std::string expected_server_name;
34 std::string expected_certificate_types;
Adam Langleye9ada862015-05-11 17:20:37 -070035 bool require_any_client_certificate = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080036 std::string advertise_npn;
37 std::string expected_next_proto;
Adam Langleye9ada862015-05-11 17:20:37 -070038 bool false_start = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080039 std::string select_next_proto;
Adam Langleye9ada862015-05-11 17:20:37 -070040 bool async = false;
41 bool write_different_record_sizes = false;
42 bool cbc_record_splitting = false;
43 bool partial_write = false;
David Benjamind316cba2016-06-02 16:17:39 -040044 bool no_tls13 = false;
Adam Langleye9ada862015-05-11 17:20:37 -070045 bool no_tls12 = false;
46 bool no_tls11 = false;
47 bool no_tls1 = false;
48 bool no_ssl3 = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080049 std::string expected_channel_id;
David Benjaminc895d6b2016-08-11 13:26:41 -040050 bool enable_channel_id = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080051 std::string send_channel_id;
Adam Langleye9ada862015-05-11 17:20:37 -070052 bool shim_writes_first = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080053 std::string host_name;
54 std::string advertise_alpn;
55 std::string expected_alpn;
Robert Sloan6d0d00e2017-03-27 07:13:07 -070056 std::string expected_resume_alpn;
57 bool expect_no_alpn = false;
58 bool expect_no_resume_alpn = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080059 std::string expected_advertised_alpn;
60 std::string select_alpn;
Robert Sloan6d0d00e2017-03-27 07:13:07 -070061 std::string select_resume_alpn;
David Benjamin4969cc92016-04-22 15:02:23 -040062 bool decline_alpn = false;
Adam Langleye9ada862015-05-11 17:20:37 -070063 bool expect_session_miss = false;
64 bool expect_extended_master_secret = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080065 std::string psk;
66 std::string psk_identity;
Adam Langleyd9e397b2015-01-22 14:27:53 -080067 std::string srtp_profiles;
Adam Langleye9ada862015-05-11 17:20:37 -070068 bool enable_ocsp_stapling = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080069 std::string expected_ocsp_response;
Adam Langleye9ada862015-05-11 17:20:37 -070070 bool enable_signed_cert_timestamps = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -080071 std::string expected_signed_cert_timestamps;
Adam Langleye9ada862015-05-11 17:20:37 -070072 int min_version = 0;
73 int max_version = 0;
74 int mtu = 0;
75 bool implicit_handshake = false;
76 bool use_early_callback = false;
77 bool fail_early_callback = false;
78 bool install_ddos_callback = false;
79 bool fail_ddos_callback = false;
80 bool fail_second_ddos_callback = false;
Steven Valdez909b19f2016-11-21 15:35:44 -050081 bool fail_cert_callback = false;
Adam Langleye9ada862015-05-11 17:20:37 -070082 std::string cipher;
83 bool handshake_never_done = false;
84 int export_keying_material = 0;
85 std::string export_label;
86 std::string export_context;
87 bool use_export_context = false;
Adam Langleyf4e42722015-06-04 17:45:09 -070088 bool tls_unique = false;
Kenny Rootb8494592015-09-25 02:29:14 +000089 bool expect_ticket_renewal = false;
90 bool expect_no_session = false;
Robert Sloan69939df2017-01-09 10:53:07 -080091 bool expect_early_data_info = false;
Robert Sloan6d0d00e2017-03-27 07:13:07 -070092 bool expect_accept_early_data = false;
93 bool expect_reject_early_data = false;
Kenny Rootb8494592015-09-25 02:29:14 +000094 bool use_ticket_callback = false;
95 bool renew_ticket = false;
Robert Sloan69939df2017-01-09 10:53:07 -080096 bool enable_early_data = false;
Robert Sloan6d0d00e2017-03-27 07:13:07 -070097 bool enable_resume_early_data = false;
Kenny Rootb8494592015-09-25 02:29:14 +000098 bool enable_client_custom_extension = false;
99 bool enable_server_custom_extension = false;
100 bool custom_extension_skip = false;
101 bool custom_extension_fail_add = false;
102 std::string ocsp_response;
103 bool check_close_notify = false;
104 bool shim_shuts_down = false;
Kenny Rootb8494592015-09-25 02:29:14 +0000105 bool verify_fail = false;
106 bool verify_peer = false;
107 bool expect_verify_result = false;
108 std::string signed_cert_timestamps;
Kenny Roote99801b2015-11-06 15:31:15 -0800109 int expect_total_renegotiations = 0;
110 bool renegotiate_once = false;
111 bool renegotiate_freely = false;
Adam Langleyfad63272015-11-12 12:15:39 -0800112 bool renegotiate_ignore = false;
David Benjaminc895d6b2016-08-11 13:26:41 -0400113 int expect_peer_signature_algorithm = 0;
Adam Langley4139edb2016-01-13 15:00:54 -0800114 bool p384_only = false;
115 bool enable_all_curves = false;
David Benjaminc895d6b2016-08-11 13:26:41 -0400116 int expect_curve_id = 0;
Steven Valdeze7531f02016-12-14 13:29:57 -0500117 int expect_resume_curve_id = 0;
David Benjamin4969cc92016-04-22 15:02:23 -0400118 bool use_old_client_cert_callback = false;
David Benjamind316cba2016-06-02 16:17:39 -0400119 int initial_timeout_duration_ms = 0;
Robert Sloan7d422bc2017-03-06 10:04:29 -0800120 std::string use_client_ca_list;
121 std::string expected_client_ca_list;
David Benjaminc895d6b2016-08-11 13:26:41 -0400122 bool send_alert = false;
Steven Valdezbb1ceac2016-10-07 10:34:51 -0400123 bool peek_then_read = false;
124 bool enable_grease = false;
125 int max_cert_list = 0;
Steven Valdez909b19f2016-11-21 15:35:44 -0500126 std::string ticket_key;
127 bool use_exporter_between_reads = false;
128 int expect_cipher_aes = 0;
129 int expect_cipher_no_aes = 0;
130 std::string expect_peer_cert_file;
131 int resumption_delay = 0;
132 bool retain_only_sha256_client_cert_initial = false;
133 bool retain_only_sha256_client_cert_resume = false;
134 bool expect_sha256_client_cert_initial = false;
135 bool expect_sha256_client_cert_resume = false;
Robert Sloan69939df2017-01-09 10:53:07 -0800136 bool read_with_unfinished_write = false;
Steven Valdezb0b45c62017-01-17 16:23:54 -0500137 bool expect_secure_renegotiation = false;
138 bool expect_no_secure_renegotiation = false;
139 int max_send_fragment = 0;
140 int read_size = 0;
Robert Sloan4d1ac502017-02-06 08:36:14 -0800141 bool expect_session_id = false;
142 bool expect_no_session_id = false;
Robert Sloan1c9db532017-03-13 08:03:59 -0700143 int expect_ticket_age_skew = 0;
Robert Sloan6f79a502017-04-03 09:16:40 -0700144 bool no_op_extra_handshake = false;
145 bool handshake_twice = false;
Robert Sloan572a4e22017-04-17 10:52:19 -0700146 bool allow_unknown_alpn_protos = false;
147 bool enable_ed25519 = false;
Adam Langleyd9e397b2015-01-22 14:27:53 -0800148};
149
150bool ParseConfig(int argc, char **argv, TestConfig *out_config);
151
152
153#endif // HEADER_TEST_CONFIG