Debian Codegraph @

debian/rust-vendor/aws-lc-sys/aws-lc/ssl/test/test_config.h

raw
1 // Copyright (c) 2014, Google Inc.
2 // SPDX-License-Identifier: ISC
3
4 #ifndef HEADER_TEST_CONFIG
5 #define HEADER_TEST_CONFIG
6
7 #include <string>
8 #include <utility>
9 #include <vector>
10
11 #include <openssl/base.h>
12 #include <openssl/x509.h>
13
14 #include "test_state.h"
15
16 struct TestConfig {
17 int port = 0;
18 bool ipv6 = false;
19 uint64_t shim_id = 0;
20 bool is_server = false;
21 bool is_dtls = false;
22 bool is_quic = false;
23 int resume_count = 0;
24 std::string write_settings;
25 bool fallback_scsv = false;
26 std::vector<uint16_t> signing_prefs;
27 std::vector<uint16_t> verify_prefs;
28 std::vector<uint16_t> expect_peer_verify_prefs;
29 std::vector<int> curves;
30 std::string key_file;
31 std::string cert_file;
32 std::string trust_cert;
33 std::string expect_server_name;
34 bool enable_ech_grease = false;
35 std::vector<std::string> ech_server_configs;
36 std::vector<std::string> ech_server_keys;
37 std::vector<int> ech_is_retry_config;
38 bool expect_ech_accept = false;
39 std::string expect_ech_name_override;
40 bool expect_no_ech_name_override = false;
41 std::string expect_ech_retry_configs;
42 bool expect_no_ech_retry_configs = false;
43 std::string ech_config_list;
44 std::string expect_certificate_types;
45 bool require_any_client_certificate = false;
46 std::string advertise_npn;
47 std::string expect_next_proto;
48 bool false_start = false;
49 std::string select_next_proto;
50 bool async = false;
51 bool write_different_record_sizes = false;
52 bool cbc_record_splitting = false;
53 bool partial_write = false;
54 bool no_tls13 = false;
55 bool no_tls12 = false;
56 bool no_tls11 = false;
57 bool no_tls1 = false;
58 bool no_ticket = false;
59 std::string expect_channel_id;
60 bool enable_channel_id = false;
61 std::string send_channel_id;
62 bool shim_writes_first = false;
63 std::string host_name;
64 std::string advertise_alpn;
65 std::string expect_alpn;
66 std::string expect_advertised_alpn;
67 std::string select_alpn;
68 bool decline_alpn = false;
69 bool reject_alpn = false;
70 bool select_empty_alpn = false;
71 bool defer_alps = false;
72 std::vector<std::pair<std::string, std::string>> application_settings;
73 std::unique_ptr<std::string> expect_peer_application_settings;
74 bool alps_use_new_codepoint = false;
75 std::string quic_transport_params;
76 std::string expect_quic_transport_params;
77 // Set quic_use_legacy_codepoint to 0 or 1 to configure, -1 uses default.
78 int quic_use_legacy_codepoint = -1;
79 bool expect_session_miss = false;
80 bool expect_extended_master_secret = false;
81 std::string psk;
82 std::string psk_identity;
83 std::string srtp_profiles;
84 bool enable_ocsp_stapling = false;
85 std::string expect_ocsp_response;
86 bool enable_signed_cert_timestamps = false;
87 std::string expect_signed_cert_timestamps;
88 uint16_t min_version = 0;
89 uint16_t max_version = 0;
90 uint16_t expect_version = 0;
91 int mtu = 0;
92 bool implicit_handshake = false;
93 bool use_early_callback = false;
94 bool fail_early_callback = false;
95 bool install_ddos_callback = false;
96 bool fail_ddos_callback = false;
97 bool fail_cert_callback = false;
98 std::string cipher;
99 bool handshake_never_done = false;
100 int export_keying_material = 0;
101 std::string export_label;
102 std::string export_context;
103 bool use_export_context = false;
104 bool tls_unique = false;
105 bool expect_ticket_renewal = false;
106 bool expect_no_session = false;
107 bool expect_ticket_supports_early_data = false;
108 bool expect_accept_early_data = false;
109 bool expect_reject_early_data = false;
110 bool expect_no_offer_early_data = false;
111 bool use_ticket_callback = false;
112 bool renew_ticket = false;
113 bool enable_early_data = false;
114 bool enable_client_custom_extension = false;
115 bool enable_server_custom_extension = false;
116 bool custom_extension_skip = false;
117 bool custom_extension_fail_add = false;
118 std::string ocsp_response;
119 bool check_close_notify = false;
120 bool shim_shuts_down = false;
121 bool verify_fail = false;
122 bool verify_peer = false;
123 bool verify_peer_if_no_obc = false;
124 bool expect_verify_result = false;
125 std::string signed_cert_timestamps;
126 int expect_total_renegotiations = 0;
127 bool renegotiate_once = false;
128 bool renegotiate_freely = false;
129 bool renegotiate_ignore = false;
130 bool renegotiate_explicit = false;
131 bool forbid_renegotiation_after_handshake = false;
132 uint16_t expect_peer_signature_algorithm = 0;
133 uint16_t expect_curve_id = 0;
134 bool use_old_client_cert_callback = false;
135 int initial_timeout_duration_ms = 0;
136 std::string use_client_ca_list;
137 std::string expect_client_ca_list;
138 bool send_alert = false;
139 bool peek_then_read = false;
140 bool enable_grease = false;
141 bool permute_extensions = false;
142 int max_cert_list = 0;
143 std::string ticket_key;
144 bool use_exporter_between_reads = false;
145 uint16_t expect_cipher_aes = 0;
146 uint16_t expect_cipher_no_aes = 0;
147 uint16_t expect_cipher = 0;
148 std::string expect_peer_cert_file;
149 int resumption_delay = 0;
150 bool retain_only_sha256_client_cert = false;
151 bool expect_sha256_client_cert = false;
152 bool read_with_unfinished_write = false;
153 bool expect_secure_renegotiation = false;
154 bool expect_no_secure_renegotiation = false;
155 int max_send_fragment = 0;
156 int read_size = 0;
157 bool expect_session_id = false;
158 bool expect_no_session_id = false;
159 int expect_ticket_age_skew = 0;
160 bool no_op_extra_handshake = false;
161 bool handshake_twice = false;
162 bool allow_unknown_alpn_protos = false;
163 bool use_custom_verify_callback = false;
164 std::string expect_msg_callback;
165 bool allow_false_start_without_alpn = false;
166 bool handoff = false;
167 bool handshake_hints = false;
168 bool allow_hint_mismatch = false;
169 bool use_ocsp_callback = false;
170 bool set_ocsp_in_callback = false;
171 bool decline_ocsp_callback = false;
172 bool fail_ocsp_callback = false;
173 bool install_cert_compression_algs = false;
174 int install_one_cert_compression_alg = 0;
175 bool reverify_on_resume = false;
176 bool enforce_rsa_key_usage = false;
177 bool expect_key_usage_invalid = false;
178 bool is_handshaker_supported = false;
179 bool handshaker_resume = false;
180 std::string handshaker_path;
181 bool jdk11_workaround = false;
182 bool server_preference = false;
183 bool export_traffic_secrets = false;
184 bool key_update = false;
185 bool expect_delegated_credential_used = false;
186 std::string delegated_credential;
187 std::string expect_early_data_reason;
188 bool expect_hrr = false;
189 bool expect_no_hrr = false;
190 bool wait_for_debugger = false;
191 std::string quic_early_data_context;
192 int early_write_after_message = 0;
193 // When check_ssl_transfer is true, bssl checks if the ssl can be transferred.
194 bool check_ssl_transfer = false;
195 // when do_ssl_transfer is false, no transfer will happen.
196 // when do_ssl_transfer is true, transfer will happen if the ssl is server.
197 bool do_ssl_transfer = false;
198 // When not zero this enables read ahead and sets the buffer to this size.
199 int read_ahead_buffer_size = 0;
200 // When not empty, this prefix with random suffix is used to create a file
201 // stores the output of |SSL_to_bytes|.
202 std::string ssl_fuzz_seed_path_prefix;
203 // When not empty, the value is passed to |SSL_CTX_set_ciphersuites|.
204 std::string tls13_ciphersuites;
205 // multiple_certs_slot is used to associate the server with the multiple
206 // certificate/private key slot configuration. The certificate comes first,
207 // then the private key.
208 // When |multiple_certs_slot| is defined, the certificates defined are
209 // prioritized over certs defined with |cert_file| and |key_file|.
210 std::vector<std::pair<std::string, std::string>> multiple_certs_slot;
211 bool no_check_client_certificate_type = false;
212
213 std::vector<const char*> handshaker_args;
214
215 bssl::UniquePtr<SSL_CTX> SetupCtx(SSL_CTX *old_ctx) const;
216
217 bssl::UniquePtr<SSL> NewSSL(SSL_CTX *ssl_ctx, SSL_SESSION *session,
218 std::unique_ptr<TestState> test_state) const;
219 };
220
221 bool ParseConfig(int argc, char **argv, bool is_shim, TestConfig *out_initial,
222 TestConfig *out_resume, TestConfig *out_retry);
223
224 bool SetTestConfig(SSL *ssl, const TestConfig *config);
225
226 const TestConfig *GetTestConfig(const SSL *ssl);
227
228 bool LoadCertificate(bssl::UniquePtr<X509> *out_x509,
229 bssl::UniquePtr<STACK_OF(X509)> *out_chain,
230 const std::string &file);
231
232 bssl::UniquePtr<EVP_PKEY> LoadPrivateKey(const std::string &file);
233
234 #endif // HEADER_TEST_CONFIG