Home | History | Annotate | Download | only in test
      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>
     19 #include <vector>
     20 
     21 
     22 struct TestConfig {
     23   int port = 0;
     24   bool is_server = false;
     25   bool is_dtls = false;
     26   int resume_count = 0;
     27   std::string write_settings;
     28   bool fallback_scsv = false;
     29   std::string digest_prefs;
     30   std::vector<int> signing_prefs;
     31   std::vector<int> verify_prefs;
     32   std::string key_file;
     33   std::string cert_file;
     34   std::string expected_server_name;
     35   std::string expected_certificate_types;
     36   bool require_any_client_certificate = false;
     37   std::string advertise_npn;
     38   std::string expected_next_proto;
     39   bool false_start = false;
     40   std::string select_next_proto;
     41   bool async = false;
     42   bool write_different_record_sizes = false;
     43   bool cbc_record_splitting = false;
     44   bool partial_write = false;
     45   bool no_tls13 = false;
     46   bool no_tls12 = false;
     47   bool no_tls11 = false;
     48   bool no_tls1 = false;
     49   bool no_ssl3 = false;
     50   std::string expected_channel_id;
     51   bool enable_channel_id = false;
     52   std::string send_channel_id;
     53   bool shim_writes_first = false;
     54   std::string host_name;
     55   std::string advertise_alpn;
     56   std::string expected_alpn;
     57   std::string expected_late_alpn;
     58   std::string expected_advertised_alpn;
     59   std::string select_alpn;
     60   bool decline_alpn = false;
     61   bool expect_session_miss = false;
     62   bool expect_extended_master_secret = false;
     63   std::string psk;
     64   std::string psk_identity;
     65   std::string srtp_profiles;
     66   bool enable_ocsp_stapling = false;
     67   std::string expected_ocsp_response;
     68   bool enable_signed_cert_timestamps = false;
     69   std::string expected_signed_cert_timestamps;
     70   int min_version = 0;
     71   int max_version = 0;
     72   int expect_version = 0;
     73   int mtu = 0;
     74   bool implicit_handshake = false;
     75   bool use_early_callback = false;
     76   bool fail_early_callback = false;
     77   bool install_ddos_callback = false;
     78   bool fail_ddos_callback = false;
     79   bool fail_second_ddos_callback = false;
     80   bool fail_cert_callback = false;
     81   std::string cipher;
     82   bool handshake_never_done = false;
     83   int export_keying_material = 0;
     84   std::string export_label;
     85   std::string export_context;
     86   bool use_export_context = false;
     87   bool tls_unique = false;
     88   bool expect_ticket_renewal = false;
     89   bool expect_no_session = false;
     90   bool expect_early_data_info = false;
     91   bool expect_accept_early_data = false;
     92   bool expect_reject_early_data = false;
     93   bool use_ticket_callback = false;
     94   bool renew_ticket = false;
     95   bool enable_early_data = false;
     96   int tls13_variant = 0;
     97   bool enable_client_custom_extension = false;
     98   bool enable_server_custom_extension = false;
     99   bool custom_extension_skip = false;
    100   bool custom_extension_fail_add = false;
    101   std::string ocsp_response;
    102   bool check_close_notify = false;
    103   bool shim_shuts_down = false;
    104   bool verify_fail = false;
    105   bool verify_peer = false;
    106   bool verify_peer_if_no_obc = false;
    107   bool expect_verify_result = false;
    108   std::string signed_cert_timestamps;
    109   int expect_total_renegotiations = 0;
    110   bool renegotiate_once = false;
    111   bool renegotiate_freely = false;
    112   bool renegotiate_ignore = false;
    113   int expect_peer_signature_algorithm = 0;
    114   bool p384_only = false;
    115   bool enable_all_curves = false;
    116   int expect_curve_id = 0;
    117   bool use_old_client_cert_callback = false;
    118   int initial_timeout_duration_ms = 0;
    119   std::string use_client_ca_list;
    120   std::string expected_client_ca_list;
    121   bool send_alert = false;
    122   bool peek_then_read = false;
    123   bool enable_grease = false;
    124   int max_cert_list = 0;
    125   std::string ticket_key;
    126   bool use_exporter_between_reads = false;
    127   int expect_cipher_aes = 0;
    128   int expect_cipher_no_aes = 0;
    129   std::string expect_peer_cert_file;
    130   int resumption_delay = 0;
    131   bool retain_only_sha256_client_cert_initial = false;
    132   bool retain_only_sha256_client_cert_resume = false;
    133   bool expect_sha256_client_cert_initial = false;
    134   bool expect_sha256_client_cert_resume = false;
    135   bool read_with_unfinished_write = false;
    136   bool expect_secure_renegotiation = false;
    137   bool expect_no_secure_renegotiation = false;
    138   int max_send_fragment = 0;
    139   int read_size = 0;
    140   bool expect_session_id = false;
    141   bool expect_no_session_id = false;
    142   int expect_ticket_age_skew = 0;
    143   bool no_op_extra_handshake = false;
    144   bool handshake_twice = false;
    145   bool allow_unknown_alpn_protos = false;
    146   bool enable_ed25519 = false;
    147 };
    148 
    149 bool ParseConfig(int argc, char **argv, TestConfig *out_initial,
    150                  TestConfig *out_resume, TestConfig *out_retry);
    151 
    152 
    153 #endif  // HEADER_TEST_CONFIG
    154