Lines Matching refs:config

103 static bool SetConfigPtr(SSL *ssl, const TestConfig *config) {  in SetConfigPtr()  argument
104 return SSL_set_ex_data(ssl, g_config_index, (void *)config) == 1; in SetConfigPtr()
133 const TestConfig *config = GetConfigPtr(ssl); in InstallCertificate() local
134 if (!config->key_file.empty() && in InstallCertificate()
135 !SSL_use_PrivateKey_file(ssl, config->key_file.c_str(), in InstallCertificate()
139 if (!config->cert_file.empty() && in InstallCertificate()
140 !SSL_use_certificate_file(ssl, config->cert_file.c_str(), in InstallCertificate()
148 const TestConfig *config = GetConfigPtr(ctx->ssl); in SelectCertificateCallback() local
151 if (!config->expected_server_name.empty()) { in SelectCertificateCallback()
176 (const uint8_t*)config->expected_server_name.data(), in SelectCertificateCallback()
177 config->expected_server_name.size())) { in SelectCertificateCallback()
182 if (config->fail_early_callback) { in SelectCertificateCallback()
187 if (config->use_early_callback) { in SelectCertificateCallback()
188 if (config->async) { in SelectCertificateCallback()
205 const TestConfig *config = GetConfigPtr(ssl); in NextProtosAdvertisedCallback() local
206 if (config->advertise_npn.empty()) { in NextProtosAdvertisedCallback()
210 *out = (const uint8_t*)config->advertise_npn.data(); in NextProtosAdvertisedCallback()
211 *out_len = config->advertise_npn.size(); in NextProtosAdvertisedCallback()
217 const TestConfig *config = GetConfigPtr(ssl); in NextProtoSelectCallback() local
218 if (config->select_next_proto.empty()) { in NextProtoSelectCallback()
222 *out = (uint8_t*)config->select_next_proto.data(); in NextProtoSelectCallback()
223 *outlen = config->select_next_proto.size(); in NextProtoSelectCallback()
229 const TestConfig *config = GetConfigPtr(ssl); in AlpnSelectCallback() local
230 if (config->select_alpn.empty()) { in AlpnSelectCallback()
234 if (!config->expected_advertised_alpn.empty() && in AlpnSelectCallback()
235 (config->expected_advertised_alpn.size() != inlen || in AlpnSelectCallback()
236 memcmp(config->expected_advertised_alpn.data(), in AlpnSelectCallback()
242 *out = (const uint8_t*)config->select_alpn.data(); in AlpnSelectCallback()
243 *outlen = config->select_alpn.size(); in AlpnSelectCallback()
251 const TestConfig *config = GetConfigPtr(ssl); in PskClientCallback() local
253 if (strcmp(hint ? hint : "", config->psk_identity.c_str()) != 0) { in PskClientCallback()
259 if (config->psk_identity.size() >= max_identity_len || in PskClientCallback()
260 config->psk.size() > max_psk_len) { in PskClientCallback()
265 BUF_strlcpy(out_identity, config->psk_identity.c_str(), in PskClientCallback()
267 memcpy(out_psk, config->psk.data(), config->psk.size()); in PskClientCallback()
268 return config->psk.size(); in PskClientCallback()
273 const TestConfig *config = GetConfigPtr(ssl); in PskServerCallback() local
275 if (strcmp(identity, config->psk_identity.c_str()) != 0) { in PskServerCallback()
280 if (config->psk.size() > max_psk_len) { in PskServerCallback()
285 memcpy(out_psk, config->psk.data(), config->psk.size()); in PskServerCallback()
286 return config->psk.size(); in PskServerCallback()
321 const TestConfig *config = GetConfigPtr(early_context->ssl); in DDoSCallback() local
325 if (config->fail_ddos_callback || in DDoSCallback()
326 (config->fail_second_ddos_callback && callback_num == 2)) { in DDoSCallback()
402 static ScopedSSL_CTX SetupCtx(const TestConfig *config) { in SetupCtx() argument
404 config->is_dtls ? DTLS_method() : TLS_method())); in SetupCtx()
418 if (config->async && config->is_server) { in SetupCtx()
432 if (!config->select_next_proto.empty()) { in SetupCtx()
437 if (!config->select_alpn.empty()) { in SetupCtx()
511 const TestConfig *config = GetConfigPtr(ssl); in DoRead() local
515 } while (config->async && RetryAsync(ssl, ret)); in DoRead()
522 const TestConfig *config = GetConfigPtr(ssl); in WriteAll() local
530 } while ((config->async && RetryAsync(ssl, ret)) || (ret > 0 && in_len > 0)); in WriteAll()
539 const TestConfig *config, bool is_resume, in DoExchange() argument
546 if (!SetConfigPtr(ssl.get(), config) || in DoExchange()
551 if (config->fallback_scsv && in DoExchange()
555 if (!config->use_early_callback) { in DoExchange()
556 if (config->async) { in DoExchange()
563 if (config->require_any_client_certificate) { in DoExchange()
567 if (config->false_start) { in DoExchange()
570 if (config->cbc_record_splitting) { in DoExchange()
573 if (config->partial_write) { in DoExchange()
576 if (config->no_tls12) { in DoExchange()
579 if (config->no_tls11) { in DoExchange()
582 if (config->no_tls1) { in DoExchange()
585 if (config->no_ssl3) { in DoExchange()
588 if (config->tls_d5_bug) { in DoExchange()
591 if (config->allow_unsafe_legacy_renegotiation) { in DoExchange()
594 if (config->no_legacy_server_connect) { in DoExchange()
597 if (!config->expected_channel_id.empty()) { in DoExchange()
600 if (!config->send_channel_id.empty()) { in DoExchange()
602 if (!config->async) { in DoExchange()
604 ScopedEVP_PKEY pkey = LoadPrivateKey(config->send_channel_id); in DoExchange()
610 if (!config->host_name.empty() && in DoExchange()
611 !SSL_set_tlsext_host_name(ssl.get(), config->host_name.c_str())) { in DoExchange()
614 if (!config->advertise_alpn.empty() && in DoExchange()
616 (const uint8_t *)config->advertise_alpn.data(), in DoExchange()
617 config->advertise_alpn.size()) != 0) { in DoExchange()
620 if (!config->psk.empty()) { in DoExchange()
624 if (!config->psk_identity.empty() && in DoExchange()
625 !SSL_use_psk_identity_hint(ssl.get(), config->psk_identity.c_str())) { in DoExchange()
628 if (!config->srtp_profiles.empty() && in DoExchange()
629 !SSL_set_srtp_profiles(ssl.get(), config->srtp_profiles.c_str())) { in DoExchange()
632 if (config->enable_ocsp_stapling && in DoExchange()
636 if (config->enable_signed_cert_timestamps && in DoExchange()
640 SSL_enable_fastradio_padding(ssl.get(), config->fastradio_padding); in DoExchange()
641 if (config->min_version != 0) { in DoExchange()
642 SSL_set_min_version(ssl.get(), (uint16_t)config->min_version); in DoExchange()
644 if (config->max_version != 0) { in DoExchange()
645 SSL_set_max_version(ssl.get(), (uint16_t)config->max_version); in DoExchange()
647 if (config->mtu != 0) { in DoExchange()
649 SSL_set_mtu(ssl.get(), config->mtu); in DoExchange()
651 if (config->install_ddos_callback) { in DoExchange()
654 if (!config->cipher.empty() && in DoExchange()
655 !SSL_set_cipher_list(ssl.get(), config->cipher.c_str())) { in DoExchange()
658 if (!config->reject_peer_renegotiations) { in DoExchange()
663 int sock = Connect(config->port); in DoExchange()
673 if (config->is_dtls) { in DoExchange()
679 if (config->async) { in DoExchange()
681 config->is_dtls ? AsyncBioCreateDatagram() : AsyncBioCreate(); in DoExchange()
690 if (!config->is_server) { in DoExchange()
694 } else if (config->async) { in DoExchange()
708 if (config->implicit_handshake) { in DoExchange()
709 if (config->is_server) { in DoExchange()
716 if (config->is_server) { in DoExchange()
721 } while (config->async && RetryAsync(ssl.get(), ret)); in DoExchange()
732 (!!SSL_session_reused(ssl.get()) == config->expect_session_miss)) { in DoExchange()
738 bool expect_handshake_done = is_resume || !config->false_start; in DoExchange()
745 if (config->is_server && !GetTestState(ssl.get())->early_callback_called) { in DoExchange()
750 if (!config->expected_server_name.empty()) { in DoExchange()
753 if (server_name != config->expected_server_name) { in DoExchange()
755 server_name, config->expected_server_name.c_str()); in DoExchange()
760 if (!config->expected_certificate_types.empty()) { in DoExchange()
765 (int)config->expected_certificate_types.size() || in DoExchange()
767 config->expected_certificate_types.data(), in DoExchange()
774 if (!config->expected_next_proto.empty()) { in DoExchange()
778 if (next_proto_len != config->expected_next_proto.size() || in DoExchange()
779 memcmp(next_proto, config->expected_next_proto.data(), in DoExchange()
786 if (!config->expected_alpn.empty()) { in DoExchange()
790 if (alpn_proto_len != config->expected_alpn.size() || in DoExchange()
791 memcmp(alpn_proto, config->expected_alpn.data(), in DoExchange()
798 if (!config->expected_channel_id.empty()) { in DoExchange()
804 if (config->expected_channel_id.size() != 64 || in DoExchange()
805 memcmp(config->expected_channel_id.data(), in DoExchange()
812 if (config->expect_extended_master_secret) { in DoExchange()
819 if (!config->expected_ocsp_response.empty()) { in DoExchange()
823 if (config->expected_ocsp_response.size() != len || in DoExchange()
824 memcmp(config->expected_ocsp_response.data(), data, len) != 0) { in DoExchange()
830 if (!config->expected_signed_cert_timestamps.empty()) { in DoExchange()
834 if (config->expected_signed_cert_timestamps.size() != len || in DoExchange()
835 memcmp(config->expected_signed_cert_timestamps.data(), in DoExchange()
843 if (config->export_keying_material > 0) { in DoExchange()
845 static_cast<size_t>(config->export_keying_material)); in DoExchange()
848 config->export_label.data(), config->export_label.size(), in DoExchange()
849 reinterpret_cast<const uint8_t*>(config->export_context.data()), in DoExchange()
850 config->export_context.size(), config->use_export_context)) { in DoExchange()
859 if (config->tls_unique) { in DoExchange()
879 if (config->write_different_record_sizes) { in DoExchange()
880 if (config->is_dtls) { in DoExchange()
902 if (config->shim_writes_first) { in DoExchange()
985 TestConfig config; in main() local
986 if (!ParseConfig(argc - 1, argv + 1, &config)) { in main()
990 ScopedSSL_CTX ssl_ctx = SetupCtx(&config); in main()
997 if (!DoExchange(&session, ssl_ctx.get(), &config, false /* is_resume */, in main()
1003 if (config.resume && in main()
1004 !DoExchange(NULL, ssl_ctx.get(), &config, true /* is_resume */, in main()