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; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 27 | bool fallback_scsv = false; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 28 | std::string digest_prefs; |
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; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 52 | bool shim_writes_first = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 53 | std::string host_name; |
| 54 | std::string advertise_alpn; |
| 55 | std::string expected_alpn; |
Robert Sloan | 6d0d00e | 2017-03-27 07:13:07 -0700 | [diff] [blame] | 56 | std::string expected_resume_alpn; |
| 57 | bool expect_no_alpn = false; |
| 58 | bool expect_no_resume_alpn = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 59 | std::string expected_advertised_alpn; |
| 60 | std::string select_alpn; |
Robert Sloan | 6d0d00e | 2017-03-27 07:13:07 -0700 | [diff] [blame] | 61 | std::string select_resume_alpn; |
David Benjamin | 4969cc9 | 2016-04-22 15:02:23 -0400 | [diff] [blame] | 62 | bool decline_alpn = false; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 63 | bool expect_session_miss = false; |
| 64 | bool expect_extended_master_secret = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 65 | std::string psk; |
| 66 | std::string psk_identity; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 67 | std::string srtp_profiles; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 68 | bool enable_ocsp_stapling = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 69 | std::string expected_ocsp_response; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 70 | bool enable_signed_cert_timestamps = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 71 | std::string expected_signed_cert_timestamps; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 72 | 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 Valdez | 909b19f | 2016-11-21 15:35:44 -0500 | [diff] [blame] | 81 | bool fail_cert_callback = false; |
Adam Langley | e9ada86 | 2015-05-11 17:20:37 -0700 | [diff] [blame] | 82 | 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 Langley | f4e4272 | 2015-06-04 17:45:09 -0700 | [diff] [blame] | 88 | bool tls_unique = false; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 89 | bool expect_ticket_renewal = false; |
| 90 | bool expect_no_session = false; |
Robert Sloan | 69939df | 2017-01-09 10:53:07 -0800 | [diff] [blame] | 91 | bool expect_early_data_info = false; |
Robert Sloan | 6d0d00e | 2017-03-27 07:13:07 -0700 | [diff] [blame] | 92 | bool expect_accept_early_data = false; |
| 93 | bool expect_reject_early_data = false; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 94 | bool use_ticket_callback = false; |
| 95 | bool renew_ticket = false; |
Robert Sloan | 69939df | 2017-01-09 10:53:07 -0800 | [diff] [blame] | 96 | bool enable_early_data = false; |
Robert Sloan | 6d0d00e | 2017-03-27 07:13:07 -0700 | [diff] [blame] | 97 | bool enable_resume_early_data = false; |
Kenny Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 98 | 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 Root | b849459 | 2015-09-25 02:29:14 +0000 | [diff] [blame] | 105 | bool verify_fail = false; |
| 106 | bool verify_peer = false; |
| 107 | bool expect_verify_result = false; |
| 108 | std::string signed_cert_timestamps; |
Kenny Root | e99801b | 2015-11-06 15:31:15 -0800 | [diff] [blame] | 109 | int expect_total_renegotiations = 0; |
| 110 | bool renegotiate_once = false; |
| 111 | bool renegotiate_freely = false; |
Adam Langley | fad6327 | 2015-11-12 12:15:39 -0800 | [diff] [blame] | 112 | bool renegotiate_ignore = false; |
David Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 113 | int expect_peer_signature_algorithm = 0; |
Adam Langley | 4139edb | 2016-01-13 15:00:54 -0800 | [diff] [blame] | 114 | bool p384_only = false; |
| 115 | bool enable_all_curves = false; |
David Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 116 | int expect_curve_id = 0; |
Steven Valdez | e7531f0 | 2016-12-14 13:29:57 -0500 | [diff] [blame] | 117 | int expect_resume_curve_id = 0; |
David Benjamin | 4969cc9 | 2016-04-22 15:02:23 -0400 | [diff] [blame] | 118 | bool use_old_client_cert_callback = false; |
David Benjamin | d316cba | 2016-06-02 16:17:39 -0400 | [diff] [blame] | 119 | int initial_timeout_duration_ms = 0; |
Robert Sloan | 7d422bc | 2017-03-06 10:04:29 -0800 | [diff] [blame] | 120 | std::string use_client_ca_list; |
| 121 | std::string expected_client_ca_list; |
David Benjamin | c895d6b | 2016-08-11 13:26:41 -0400 | [diff] [blame] | 122 | bool send_alert = false; |
Steven Valdez | bb1ceac | 2016-10-07 10:34:51 -0400 | [diff] [blame] | 123 | bool peek_then_read = false; |
| 124 | bool enable_grease = false; |
| 125 | int max_cert_list = 0; |
Steven Valdez | 909b19f | 2016-11-21 15:35:44 -0500 | [diff] [blame] | 126 | 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 Sloan | 69939df | 2017-01-09 10:53:07 -0800 | [diff] [blame] | 136 | bool read_with_unfinished_write = false; |
Steven Valdez | b0b45c6 | 2017-01-17 16:23:54 -0500 | [diff] [blame] | 137 | bool expect_secure_renegotiation = false; |
| 138 | bool expect_no_secure_renegotiation = false; |
| 139 | int max_send_fragment = 0; |
| 140 | int read_size = 0; |
Robert Sloan | 4d1ac50 | 2017-02-06 08:36:14 -0800 | [diff] [blame] | 141 | bool expect_session_id = false; |
| 142 | bool expect_no_session_id = false; |
Robert Sloan | 1c9db53 | 2017-03-13 08:03:59 -0700 | [diff] [blame] | 143 | int expect_ticket_age_skew = 0; |
Robert Sloan | 6f79a50 | 2017-04-03 09:16:40 -0700 | [diff] [blame] | 144 | bool no_op_extra_handshake = false; |
| 145 | bool handshake_twice = false; |
Robert Sloan | 572a4e2 | 2017-04-17 10:52:19 -0700 | [diff] [blame] | 146 | bool allow_unknown_alpn_protos = false; |
| 147 | bool enable_ed25519 = false; |
Adam Langley | d9e397b | 2015-01-22 14:27:53 -0800 | [diff] [blame] | 148 | }; |
| 149 | |
| 150 | bool ParseConfig(int argc, char **argv, TestConfig *out_config); |
| 151 | |
| 152 | |
| 153 | #endif // HEADER_TEST_CONFIG |