2014-08-12 00:51:50 +01:00
|
|
|
/* Copyright (c) 2014, Google Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
|
|
|
|
|
|
|
#ifndef HEADER_TEST_CONFIG
|
|
|
|
#define HEADER_TEST_CONFIG
|
|
|
|
|
|
|
|
#include <string>
|
2016-07-14 17:51:01 +01:00
|
|
|
#include <vector>
|
2014-08-12 00:51:50 +01:00
|
|
|
|
2018-06-22 23:53:19 +01:00
|
|
|
#include <openssl/base.h>
|
|
|
|
#include <openssl/x509.h>
|
|
|
|
|
|
|
|
#include "test_state.h"
|
2014-08-12 00:51:50 +01:00
|
|
|
|
|
|
|
struct TestConfig {
|
2015-03-23 22:46:05 +00:00
|
|
|
int port = 0;
|
|
|
|
bool is_server = false;
|
|
|
|
bool is_dtls = false;
|
2016-08-17 05:51:00 +01:00
|
|
|
int resume_count = 0;
|
2017-07-01 00:11:22 +01:00
|
|
|
std::string write_settings;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool fallback_scsv = false;
|
2016-07-14 17:51:01 +01:00
|
|
|
std::vector<int> signing_prefs;
|
2017-04-14 22:05:40 +01:00
|
|
|
std::vector<int> verify_prefs;
|
2018-07-10 22:27:45 +01:00
|
|
|
std::vector<int> expected_peer_verify_prefs;
|
2018-11-12 21:53:42 +00:00
|
|
|
std::vector<int> curves;
|
2014-08-12 00:51:50 +01:00
|
|
|
std::string key_file;
|
|
|
|
std::string cert_file;
|
|
|
|
std::string expected_server_name;
|
|
|
|
std::string expected_certificate_types;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool require_any_client_certificate = false;
|
2014-08-12 00:51:50 +01:00
|
|
|
std::string advertise_npn;
|
|
|
|
std::string expected_next_proto;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool false_start = false;
|
2014-08-12 00:51:50 +01:00
|
|
|
std::string select_next_proto;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool async = false;
|
|
|
|
bool write_different_record_sizes = false;
|
|
|
|
bool cbc_record_splitting = false;
|
|
|
|
bool partial_write = false;
|
2016-05-24 17:31:07 +01:00
|
|
|
bool no_tls13 = false;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool no_tls12 = false;
|
|
|
|
bool no_tls11 = false;
|
|
|
|
bool no_tls1 = false;
|
2018-07-18 02:26:05 +01:00
|
|
|
bool no_ticket = false;
|
2014-08-24 06:46:07 +01:00
|
|
|
std::string expected_channel_id;
|
2016-07-11 18:19:03 +01:00
|
|
|
bool enable_channel_id = false;
|
2014-08-24 06:46:07 +01:00
|
|
|
std::string send_channel_id;
|
2017-09-21 23:02:22 +01:00
|
|
|
int expected_token_binding_param = -1;
|
|
|
|
std::string send_token_binding_params;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool shim_writes_first = false;
|
2014-09-06 17:45:15 +01:00
|
|
|
std::string host_name;
|
2014-09-06 17:58:58 +01:00
|
|
|
std::string advertise_alpn;
|
|
|
|
std::string expected_alpn;
|
2017-03-09 19:56:07 +00:00
|
|
|
std::string expected_late_alpn;
|
2014-09-06 17:58:58 +01:00
|
|
|
std::string expected_advertised_alpn;
|
|
|
|
std::string select_alpn;
|
2016-03-17 21:49:56 +00:00
|
|
|
bool decline_alpn = false;
|
2018-05-15 20:06:28 +01:00
|
|
|
bool select_empty_alpn = false;
|
2017-12-22 23:50:43 +00:00
|
|
|
std::string quic_transport_params;
|
|
|
|
std::string expected_quic_transport_params;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool expect_session_miss = false;
|
|
|
|
bool expect_extended_master_secret = false;
|
2014-10-27 05:06:24 +00:00
|
|
|
std::string psk;
|
|
|
|
std::string psk_identity;
|
2014-11-16 00:06:08 +00:00
|
|
|
std::string srtp_profiles;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool enable_ocsp_stapling = false;
|
2014-11-25 06:55:35 +00:00
|
|
|
std::string expected_ocsp_response;
|
2015-03-23 22:46:05 +00:00
|
|
|
bool enable_signed_cert_timestamps = false;
|
2014-11-25 06:55:35 +00:00
|
|
|
std::string expected_signed_cert_timestamps;
|
2015-03-23 22:46:05 +00:00
|
|
|
int min_version = 0;
|
|
|
|
int max_version = 0;
|
2017-07-07 18:17:19 +01:00
|
|
|
int expect_version = 0;
|
2015-03-23 22:46:05 +00:00
|
|
|
int mtu = 0;
|
|
|
|
bool implicit_handshake = false;
|
|
|
|
bool use_early_callback = false;
|
|
|
|
bool fail_early_callback = false;
|
|
|
|
bool install_ddos_callback = false;
|
|
|
|
bool fail_ddos_callback = false;
|
2016-11-14 13:02:50 +00:00
|
|
|
bool fail_cert_callback = false;
|
2015-03-16 19:16:23 +00:00
|
|
|
std::string cipher;
|
2015-04-03 00:57:35 +01:00
|
|
|
bool handshake_never_done = false;
|
2017-12-08 22:05:06 +00:00
|
|
|
int export_early_keying_material = 0;
|
2015-04-03 09:06:36 +01:00
|
|
|
int export_keying_material = 0;
|
|
|
|
std::string export_label;
|
|
|
|
std::string export_context;
|
|
|
|
bool use_export_context = false;
|
2015-06-03 17:57:23 +01:00
|
|
|
bool tls_unique = false;
|
2015-06-18 23:36:15 +01:00
|
|
|
bool expect_ticket_renewal = false;
|
|
|
|
bool expect_no_session = false;
|
2017-10-11 17:29:36 +01:00
|
|
|
bool expect_ticket_supports_early_data = false;
|
2017-01-11 16:34:52 +00:00
|
|
|
bool expect_accept_early_data = false;
|
|
|
|
bool expect_reject_early_data = false;
|
2017-10-17 20:48:46 +01:00
|
|
|
bool expect_no_offer_early_data = false;
|
2015-06-16 19:16:23 +01:00
|
|
|
bool use_ticket_callback = false;
|
|
|
|
bool renew_ticket = false;
|
2016-12-07 20:29:45 +00:00
|
|
|
bool enable_early_data = false;
|
2017-06-13 17:45:25 +01:00
|
|
|
int tls13_variant = 0;
|
2015-07-31 02:10:13 +01:00
|
|
|
bool enable_client_custom_extension = false;
|
|
|
|
bool enable_server_custom_extension = false;
|
|
|
|
bool custom_extension_skip = false;
|
|
|
|
bool custom_extension_fail_add = false;
|
2015-08-12 11:47:11 +01:00
|
|
|
std::string ocsp_response;
|
2015-08-30 03:56:45 +01:00
|
|
|
bool check_close_notify = false;
|
|
|
|
bool shim_shuts_down = false;
|
2015-08-18 12:21:54 +01:00
|
|
|
bool verify_fail = false;
|
|
|
|
bool verify_peer = false;
|
2017-07-01 15:50:56 +01:00
|
|
|
bool verify_peer_if_no_obc = false;
|
2015-08-18 12:21:54 +01:00
|
|
|
bool expect_verify_result = false;
|
2015-09-09 13:44:55 +01:00
|
|
|
std::string signed_cert_timestamps;
|
2015-10-13 00:49:00 +01:00
|
|
|
int expect_total_renegotiations = 0;
|
2015-10-13 00:54:18 +01:00
|
|
|
bool renegotiate_once = false;
|
|
|
|
bool renegotiate_freely = false;
|
2015-11-03 21:34:10 +00:00
|
|
|
bool renegotiate_ignore = false;
|
2018-05-01 22:14:27 +01:00
|
|
|
bool forbid_renegotiation_after_handshake = false;
|
2016-06-21 23:19:24 +01:00
|
|
|
int expect_peer_signature_algorithm = 0;
|
2015-12-19 01:55:44 +00:00
|
|
|
bool enable_all_curves = false;
|
2016-06-30 19:55:33 +01:00
|
|
|
int expect_curve_id = 0;
|
2016-03-10 14:15:01 +00:00
|
|
|
bool use_old_client_cert_callback = false;
|
2016-05-11 03:30:28 +01:00
|
|
|
int initial_timeout_duration_ms = 0;
|
2017-02-28 21:45:39 +00:00
|
|
|
std::string use_client_ca_list;
|
|
|
|
std::string expected_client_ca_list;
|
2016-07-26 23:03:08 +01:00
|
|
|
bool send_alert = false;
|
2016-09-19 18:08:16 +01:00
|
|
|
bool peek_then_read = false;
|
2016-09-03 02:35:25 +01:00
|
|
|
bool enable_grease = false;
|
2016-09-27 00:57:53 +01:00
|
|
|
int max_cert_list = 0;
|
2016-11-01 17:58:25 +00:00
|
|
|
std::string ticket_key;
|
2016-11-01 23:45:06 +00:00
|
|
|
bool use_exporter_between_reads = false;
|
2016-10-31 23:20:42 +00:00
|
|
|
int expect_cipher_aes = 0;
|
|
|
|
int expect_cipher_no_aes = 0;
|
2016-11-15 01:16:54 +00:00
|
|
|
std::string expect_peer_cert_file;
|
2016-11-01 17:39:36 +00:00
|
|
|
int resumption_delay = 0;
|
2017-08-24 07:01:37 +01:00
|
|
|
bool retain_only_sha256_client_cert = false;
|
|
|
|
bool expect_sha256_client_cert = false;
|
2017-01-02 04:19:22 +00:00
|
|
|
bool read_with_unfinished_write = false;
|
2017-01-03 15:49:28 +00:00
|
|
|
bool expect_secure_renegotiation = false;
|
|
|
|
bool expect_no_secure_renegotiation = false;
|
2017-01-06 21:19:28 +00:00
|
|
|
int max_send_fragment = 0;
|
|
|
|
int read_size = 0;
|
2017-01-28 06:39:29 +00:00
|
|
|
bool expect_session_id = false;
|
|
|
|
bool expect_no_session_id = false;
|
2017-03-03 20:05:56 +00:00
|
|
|
int expect_ticket_age_skew = 0;
|
2017-03-26 21:13:51 +01:00
|
|
|
bool no_op_extra_handshake = false;
|
|
|
|
bool handshake_twice = false;
|
2017-04-04 18:52:36 +01:00
|
|
|
bool allow_unknown_alpn_protos = false;
|
2017-03-28 21:38:29 +01:00
|
|
|
bool enable_ed25519 = false;
|
2017-07-11 21:13:10 +01:00
|
|
|
bool use_custom_verify_callback = false;
|
2017-08-01 23:38:41 +01:00
|
|
|
std::string expect_msg_callback;
|
2017-12-01 18:05:12 +00:00
|
|
|
bool allow_false_start_without_alpn = false;
|
2018-08-13 15:54:48 +01:00
|
|
|
bool ignore_tls13_downgrade = false;
|
|
|
|
bool expect_tls13_downgrade = false;
|
2018-01-26 17:17:53 +00:00
|
|
|
bool handoff = false;
|
2018-04-08 18:59:25 +01:00
|
|
|
bool no_rsa_pss_rsae_certs = false;
|
2018-05-11 00:55:02 +01:00
|
|
|
bool use_ocsp_callback = false;
|
|
|
|
bool set_ocsp_in_callback = false;
|
|
|
|
bool decline_ocsp_callback = false;
|
|
|
|
bool fail_ocsp_callback = false;
|
2018-05-02 17:06:48 +01:00
|
|
|
bool install_cert_compression_algs = false;
|
2018-08-10 18:28:47 +01:00
|
|
|
bool reverify_on_resume = false;
|
2018-08-01 16:29:48 +01:00
|
|
|
bool is_handshaker_supported = false;
|
2018-06-23 02:53:05 +01:00
|
|
|
bool handshaker_resume = false;
|
|
|
|
std::string handshaker_path;
|
2018-11-19 21:49:56 +00:00
|
|
|
bool jdk11_workaround = false;
|
2018-11-12 21:53:42 +00:00
|
|
|
bool server_preference = false;
|
2018-06-23 02:53:05 +01:00
|
|
|
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
2018-06-22 23:53:19 +01:00
|
|
|
|
|
|
|
bssl::UniquePtr<SSL_CTX> SetupCtx(SSL_CTX *old_ctx) const;
|
|
|
|
|
|
|
|
bssl::UniquePtr<SSL> NewSSL(SSL_CTX *ssl_ctx, SSL_SESSION *session,
|
|
|
|
bool is_resume,
|
|
|
|
std::unique_ptr<TestState> test_state) const;
|
2014-08-12 00:51:50 +01:00
|
|
|
};
|
|
|
|
|
2017-03-09 19:56:07 +00:00
|
|
|
bool ParseConfig(int argc, char **argv, TestConfig *out_initial,
|
|
|
|
TestConfig *out_resume, TestConfig *out_retry);
|
2014-08-12 00:51:50 +01:00
|
|
|
|
2018-06-22 23:53:19 +01:00
|
|
|
bool SetTestConfig(SSL *ssl, const TestConfig *config);
|
|
|
|
|
|
|
|
const TestConfig *GetTestConfig(const SSL *ssl);
|
|
|
|
|
|
|
|
bool LoadCertificate(bssl::UniquePtr<X509> *out_x509,
|
|
|
|
bssl::UniquePtr<STACK_OF(X509)> *out_chain,
|
|
|
|
const std::string &file);
|
|
|
|
|
|
|
|
bssl::UniquePtr<EVP_PKEY> LoadPrivateKey(const std::string &file);
|
2014-08-12 00:51:50 +01:00
|
|
|
|
|
|
|
#endif // HEADER_TEST_CONFIG
|