Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 1 | /* 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 Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 19 | #include <vector> |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 20 | |
| 21 | |
| 22 | struct TestConfig { |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 23 | int port = 0; |
| 24 | bool is_server = false; |
| 25 | bool is_dtls = false; |
David Benjamin | f0c4a6c | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 26 | int resume_count = 0; |
Robert Sloan | f6200e7 | 2017-07-10 08:09:18 -0700 | [diff] [blame] | 27 | std::string write_settings; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 28 | bool fallback_scsv = false; |
David Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 29 | std::vector<int> signing_prefs; |
Robert Sloan | 572a4e2 | 2017-04-17 10:52:19 -0700 | [diff] [blame] | 30 | std::vector<int> verify_prefs; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 31 | std::string key_file; |
| 32 | std::string cert_file; |
| 33 | std::string expected_server_name; |
| 34 | std::string expected_certificate_types; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 35 | bool require_any_client_certificate = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 36 | std::string advertise_npn; |
| 37 | std::string expected_next_proto; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 38 | bool false_start = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 39 | std::string select_next_proto; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 40 | bool async = false; |
| 41 | bool write_different_record_sizes = false; |
| 42 | bool cbc_record_splitting = false; |
| 43 | bool partial_write = false; |
David Benjamin | d316cba | 2016-06-02 16:17:39 -0400 | [diff] [blame] | 44 | bool no_tls13 = false; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 45 | bool no_tls12 = false; |
| 46 | bool no_tls11 = false; |
| 47 | bool no_tls1 = false; |
| 48 | bool no_ssl3 = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 49 | std::string expected_channel_id; |
David Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 50 | bool enable_channel_id = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 51 | std::string send_channel_id; |
Robert Sloan | 978112c | 2018-01-22 12:53:01 -0800 | [diff] [blame] | 52 | int expected_token_binding_param = -1; |
| 53 | std::string send_token_binding_params; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 54 | bool shim_writes_first = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 55 | std::string host_name; |
| 56 | std::string advertise_alpn; |
| 57 | std::string expected_alpn; |
Robert Sloan | e56da3e | 2017-06-26 08:26:42 -0700 | [diff] [blame] | 58 | std::string expected_late_alpn; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 59 | std::string expected_advertised_alpn; |
| 60 | std::string select_alpn; |
David Benjamin | 4969cc9 | 2016-04-22 15:02:23 -0400 | [diff] [blame] | 61 | bool decline_alpn = false; |
Robert Sloan | 8542c08 | 2018-02-05 09:07:34 -0800 | [diff] [blame] | 62 | std::string quic_transport_params; |
| 63 | std::string expected_quic_transport_params; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 64 | bool expect_session_miss = false; |
| 65 | bool expect_extended_master_secret = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 66 | std::string psk; |
| 67 | std::string psk_identity; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 68 | std::string srtp_profiles; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 69 | bool enable_ocsp_stapling = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 70 | std::string expected_ocsp_response; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 71 | bool enable_signed_cert_timestamps = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 72 | std::string expected_signed_cert_timestamps; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 73 | int min_version = 0; |
| 74 | int max_version = 0; |
Robert Sloan | f6200e7 | 2017-07-10 08:09:18 -0700 | [diff] [blame] | 75 | int expect_version = 0; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 76 | int mtu = 0; |
| 77 | bool implicit_handshake = false; |
| 78 | bool use_early_callback = false; |
| 79 | bool fail_early_callback = false; |
| 80 | bool install_ddos_callback = false; |
| 81 | bool fail_ddos_callback = false; |
| 82 | bool fail_second_ddos_callback = false; |
Steven Valdez | 909b19f | 2016-11-21 15:35:44 -0500 | [diff] [blame] | 83 | bool fail_cert_callback = false; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 84 | std::string cipher; |
| 85 | bool handshake_never_done = false; |
Robert Sloan | 5581810 | 2017-12-18 11:26:17 -0800 | [diff] [blame] | 86 | int export_early_keying_material = 0; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 87 | int export_keying_material = 0; |
| 88 | std::string export_label; |
| 89 | std::string export_context; |
| 90 | bool use_export_context = false; |
Adam Langley | f4e4272 | 2015-06-04 17:45:09 -0700 | [diff] [blame] | 91 | bool tls_unique = false; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 92 | bool expect_ticket_renewal = false; |
| 93 | bool expect_no_session = false; |
Robert Sloan | b1b54b8 | 2017-11-06 13:50:02 -0800 | [diff] [blame] | 94 | bool expect_ticket_supports_early_data = false; |
Robert Sloan | 6d0d00e | 2017-03-27 07:13:07 -0700 | [diff] [blame] | 95 | bool expect_accept_early_data = false; |
| 96 | bool expect_reject_early_data = false; |
Robert Sloan | 29c1d2c | 2017-10-30 14:10:28 -0700 | [diff] [blame] | 97 | bool expect_no_offer_early_data = false; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 98 | bool use_ticket_callback = false; |
| 99 | bool renew_ticket = false; |
Robert Sloan | 69939df | 2017-01-09 10:53:07 -0800 | [diff] [blame] | 100 | bool enable_early_data = false; |
Robert Sloan | a12bf46 | 2017-07-17 07:08:26 -0700 | [diff] [blame] | 101 | int tls13_variant = 0; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 102 | bool enable_client_custom_extension = false; |
| 103 | bool enable_server_custom_extension = false; |
| 104 | bool custom_extension_skip = false; |
| 105 | bool custom_extension_fail_add = false; |
| 106 | std::string ocsp_response; |
| 107 | bool check_close_notify = false; |
| 108 | bool shim_shuts_down = false; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 109 | bool verify_fail = false; |
| 110 | bool verify_peer = false; |
Robert Sloan | f6200e7 | 2017-07-10 08:09:18 -0700 | [diff] [blame] | 111 | bool verify_peer_if_no_obc = false; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 112 | bool expect_verify_result = false; |
| 113 | std::string signed_cert_timestamps; |
Kenny Root | e99801b | 2015-11-06 15:31:15 -0800 | [diff] [blame] | 114 | int expect_total_renegotiations = 0; |
| 115 | bool renegotiate_once = false; |
| 116 | bool renegotiate_freely = false; |
Adam Langley | fad6327 | 2015-11-12 12:15:39 -0800 | [diff] [blame] | 117 | bool renegotiate_ignore = false; |
David Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 118 | int expect_peer_signature_algorithm = 0; |
Adam Langley | 4139edb | 2016-01-13 15:00:54 -0800 | [diff] [blame] | 119 | bool p384_only = false; |
| 120 | bool enable_all_curves = false; |
David Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 121 | int expect_curve_id = 0; |
David Benjamin | 4969cc9 | 2016-04-22 15:02:23 -0400 | [diff] [blame] | 122 | bool use_old_client_cert_callback = false; |
David Benjamin | d316cba | 2016-06-02 16:17:39 -0400 | [diff] [blame] | 123 | int initial_timeout_duration_ms = 0; |
Robert Sloan | 7d422bc | 2017-03-06 10:04:29 -0800 | [diff] [blame] | 124 | std::string use_client_ca_list; |
| 125 | std::string expected_client_ca_list; |
David Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 126 | bool send_alert = false; |
Steven Valdez | bb1ceac | 2016-10-07 10:34:51 -0400 | [diff] [blame] | 127 | bool peek_then_read = false; |
| 128 | bool enable_grease = false; |
| 129 | int max_cert_list = 0; |
Steven Valdez | 909b19f | 2016-11-21 15:35:44 -0500 | [diff] [blame] | 130 | std::string ticket_key; |
| 131 | bool use_exporter_between_reads = false; |
| 132 | int expect_cipher_aes = 0; |
| 133 | int expect_cipher_no_aes = 0; |
| 134 | std::string expect_peer_cert_file; |
| 135 | int resumption_delay = 0; |
Robert Sloan | 8f860b1 | 2017-08-28 07:37:06 -0700 | [diff] [blame] | 136 | bool retain_only_sha256_client_cert = false; |
| 137 | bool expect_sha256_client_cert = false; |
Robert Sloan | 69939df | 2017-01-09 10:53:07 -0800 | [diff] [blame] | 138 | bool read_with_unfinished_write = false; |
Steven Valdez | b0b45c6 | 2017-01-17 16:23:54 -0500 | [diff] [blame] | 139 | bool expect_secure_renegotiation = false; |
| 140 | bool expect_no_secure_renegotiation = false; |
| 141 | int max_send_fragment = 0; |
| 142 | int read_size = 0; |
Robert Sloan | 4d1ac50 | 2017-02-06 08:36:14 -0800 | [diff] [blame] | 143 | bool expect_session_id = false; |
| 144 | bool expect_no_session_id = false; |
Robert Sloan | 1c9db53 | 2017-03-13 08:03:59 -0700 | [diff] [blame] | 145 | int expect_ticket_age_skew = 0; |
Robert Sloan | 6f79a50 | 2017-04-03 09:16:40 -0700 | [diff] [blame] | 146 | bool no_op_extra_handshake = false; |
| 147 | bool handshake_twice = false; |
Robert Sloan | 572a4e2 | 2017-04-17 10:52:19 -0700 | [diff] [blame] | 148 | bool allow_unknown_alpn_protos = false; |
| 149 | bool enable_ed25519 = false; |
Robert Sloan | b6d070c | 2017-07-24 08:40:01 -0700 | [diff] [blame] | 150 | bool use_custom_verify_callback = false; |
Robert Sloan | fe7cd21 | 2017-08-07 09:03:39 -0700 | [diff] [blame] | 151 | std::string expect_msg_callback; |
Robert Sloan | cd79cde | 2017-12-11 09:06:12 -0800 | [diff] [blame] | 152 | bool allow_false_start_without_alpn = false; |
Robert Sloan | 0da4395 | 2018-01-03 15:13:14 -0800 | [diff] [blame] | 153 | bool expect_draft_downgrade = false; |
Robert Sloan | 0db7f54 | 2018-01-16 15:48:33 -0800 | [diff] [blame] | 154 | int dummy_pq_padding_len = 0; |
Robert Sloan | 8542c08 | 2018-02-05 09:07:34 -0800 | [diff] [blame] | 155 | bool handoff = false; |
Robert Sloan | ab8b888 | 2018-03-26 11:39:51 -0700 | [diff] [blame^] | 156 | bool expect_dummy_pq_padding = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 157 | }; |
| 158 | |
Robert Sloan | e56da3e | 2017-06-26 08:26:42 -0700 | [diff] [blame] | 159 | bool ParseConfig(int argc, char **argv, TestConfig *out_initial, |
| 160 | TestConfig *out_resume, TestConfig *out_retry); |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 161 | |
| 162 | |
| 163 | #endif // HEADER_TEST_CONFIG |