• Home
  • Raw
  • Download

Lines Matching refs:config

128 static bool SetTestConfig(SSL *ssl, const TestConfig *config) {  in SetTestConfig()  argument
129 return SSL_set_ex_data(ssl, g_config_index, (void *)config) == 1; in SetTestConfig()
450 const TestConfig *config = GetTestConfig(ssl); in GetCertificate() local
452 if (!config->digest_prefs.empty()) { in GetCertificate()
454 OPENSSL_strdup(config->digest_prefs.c_str())); in GetCertificate()
473 if (!config->signing_prefs.empty()) { in GetCertificate()
474 std::vector<uint16_t> u16s(config->signing_prefs.begin(), in GetCertificate()
475 config->signing_prefs.end()); in GetCertificate()
481 if (!config->key_file.empty()) { in GetCertificate()
482 *out_pkey = LoadPrivateKey(config->key_file.c_str()); in GetCertificate()
487 if (!config->cert_file.empty() && in GetCertificate()
488 !LoadCertificate(out_x509, out_chain, config->cert_file.c_str())) { in GetCertificate()
491 if (!config->ocsp_response.empty() && in GetCertificate()
492 !SSL_set_ocsp_response(ssl, (const uint8_t *)config->ocsp_response.data(), in GetCertificate()
493 config->ocsp_response.size())) { in GetCertificate()
509 const TestConfig *config = GetTestConfig(ssl); in InstallCertificate() local
510 if (config->async) { in InstallCertificate()
532 const TestConfig *config = GetTestConfig(client_hello->ssl); in SelectCertificateCallback() local
535 if (!config->expected_server_name.empty()) { in SelectCertificateCallback()
560 (const uint8_t*)config->expected_server_name.data(), in SelectCertificateCallback()
561 config->expected_server_name.size())) { in SelectCertificateCallback()
566 if (config->fail_early_callback) { in SelectCertificateCallback()
571 if (config->use_early_callback) { in SelectCertificateCallback()
574 if (config->async && !early_callback_ready) { in SelectCertificateCallback()
586 const TestConfig *config = GetTestConfig(ssl); in CheckCertificateRequest() local
588 if (!config->expected_certificate_types.empty()) { in CheckCertificateRequest()
592 if (certificate_types_len != config->expected_certificate_types.size() || in CheckCertificateRequest()
594 config->expected_certificate_types.data(), in CheckCertificateRequest()
601 if (!config->expected_client_ca_list.empty()) { in CheckCertificateRequest()
603 DecodeHexX509Names(config->expected_client_ca_list); in CheckCertificateRequest()
665 const TestConfig *config = GetTestConfig(ssl); in CertCallback() local
672 if (config->fail_cert_callback) { in CertCallback()
677 if (!config->async || config->use_early_callback) { in CertCallback()
691 const TestConfig *config = GetTestConfig(ssl); in CheckVerifyCallback() local
692 if (!config->expected_ocsp_response.empty()) { in CheckVerifyCallback()
713 const TestConfig *config = GetTestConfig(ssl); in CertVerifyCallback() local
719 if (config->verify_fail) { in CertVerifyCallback()
729 const TestConfig *config = GetTestConfig(ssl); in NextProtosAdvertisedCallback() local
730 if (config->advertise_npn.empty()) { in NextProtosAdvertisedCallback()
734 *out = (const uint8_t*)config->advertise_npn.data(); in NextProtosAdvertisedCallback()
735 *out_len = config->advertise_npn.size(); in NextProtosAdvertisedCallback()
741 const TestConfig *config = GetTestConfig(ssl); in NextProtoSelectCallback() local
742 if (config->select_next_proto.empty()) { in NextProtoSelectCallback()
746 *out = (uint8_t*)config->select_next_proto.data(); in NextProtoSelectCallback()
747 *outlen = config->select_next_proto.size(); in NextProtoSelectCallback()
760 const TestConfig *config = GetTestConfig(ssl); in AlpnSelectCallback() local
761 if (config->decline_alpn) { in AlpnSelectCallback()
765 if (!config->expected_advertised_alpn.empty() && in AlpnSelectCallback()
766 (config->expected_advertised_alpn.size() != inlen || in AlpnSelectCallback()
767 OPENSSL_memcmp(config->expected_advertised_alpn.data(), in, inlen) != in AlpnSelectCallback()
773 *out = (const uint8_t*)config->select_alpn.data(); in AlpnSelectCallback()
774 *outlen = config->select_alpn.size(); in AlpnSelectCallback()
782 const TestConfig *config = GetTestConfig(ssl); in PskClientCallback() local
784 if (config->psk_identity.empty()) { in PskClientCallback()
790 strcmp(hint, config->psk_identity.c_str()) != 0) { in PskClientCallback()
796 if (config->psk_identity.size() >= max_identity_len || in PskClientCallback()
797 config->psk.size() > max_psk_len) { in PskClientCallback()
802 BUF_strlcpy(out_identity, config->psk_identity.c_str(), in PskClientCallback()
804 OPENSSL_memcpy(out_psk, config->psk.data(), config->psk.size()); in PskClientCallback()
805 return config->psk.size(); in PskClientCallback()
810 const TestConfig *config = GetTestConfig(ssl); in PskServerCallback() local
812 if (strcmp(identity, config->psk_identity.c_str()) != 0) { in PskServerCallback()
817 if (config->psk.size() > max_psk_len) { in PskServerCallback()
822 OPENSSL_memcpy(out_psk, config->psk.data(), config->psk.size()); in PskServerCallback()
823 return config->psk.size(); in PskServerCallback()
850 const TestConfig *config = GetTestConfig(client_hello->ssl); in DDoSCallback() local
854 if (config->fail_ddos_callback || in DDoSCallback()
855 (config->fail_second_ddos_callback && callback_num == 2)) { in DDoSCallback()
975 const TestConfig *config = GetTestConfig(ssl); in ServerNameCallback() local
978 std::string(server_name) != config->expected_server_name) { in ServerNameCallback()
980 config->expected_server_name.c_str()); in ServerNameCallback()
1080 const TestConfig *config) { in SetupCtx() argument
1082 config->is_dtls ? DTLS_method() : TLS_method())); in SetupCtx()
1090 if (!config->is_dtls && in SetupCtx()
1097 if (!config->cipher.empty()) { in SetupCtx()
1098 cipher_list = config->cipher; in SetupCtx()
1105 if (config->async && config->is_server) { in SetupCtx()
1117 if (config->use_old_client_cert_callback) { in SetupCtx()
1123 if (!config->select_next_proto.empty()) { in SetupCtx()
1128 if (!config->select_alpn.empty() || config->decline_alpn) { in SetupCtx()
1139 if (config->use_ticket_callback) { in SetupCtx()
1143 if (config->enable_client_custom_extension && in SetupCtx()
1151 if (config->enable_server_custom_extension && in SetupCtx()
1161 if (!config->signed_cert_timestamps.empty() && in SetupCtx()
1163 ssl_ctx.get(), (const uint8_t *)config->signed_cert_timestamps.data(), in SetupCtx()
1164 config->signed_cert_timestamps.size())) { in SetupCtx()
1168 if (!config->use_client_ca_list.empty()) { in SetupCtx()
1169 if (config->use_client_ca_list == "<NULL>") { in SetupCtx()
1173 DecodeHexX509Names(config->use_client_ca_list); in SetupCtx()
1178 if (config->enable_grease) { in SetupCtx()
1182 if (!config->expected_server_name.empty()) { in SetupCtx()
1186 if (!config->ticket_key.empty() && in SetupCtx()
1187 !SSL_CTX_set_tlsext_ticket_keys(ssl_ctx.get(), config->ticket_key.data(), in SetupCtx()
1188 config->ticket_key.size())) { in SetupCtx()
1192 if (config->enable_early_data) { in SetupCtx()
1197 ssl_ctx.get(), static_cast<enum tls13_variant_t>(config->tls13_variant)); in SetupCtx()
1199 if (config->allow_unknown_alpn_protos) { in SetupCtx()
1203 if (config->enable_ed25519) { in SetupCtx()
1207 if (!config->verify_prefs.empty()) { in SetupCtx()
1208 std::vector<uint16_t> u16s(config->verify_prefs.begin(), in SetupCtx()
1209 config->verify_prefs.end()); in SetupCtx()
1294 const TestConfig *config = GetTestConfig(ssl); in DoRead() local
1298 if (config->async) { in DoRead()
1304 ret = config->peek_then_read ? SSL_peek(ssl, out, max_out) in DoRead()
1306 if (config->async) { in DoRead()
1312 if (config->use_exporter_between_reads) { in DoRead()
1319 } while (config->async && RetryAsync(ssl, ret)); in DoRead()
1321 if (config->peek_then_read && ret > 0) { in DoRead()
1348 const TestConfig *config = GetTestConfig(ssl); in WriteAll() local
1356 } while ((config->async && RetryAsync(ssl, ret)) || (ret > 0 && in_len > 0)); in WriteAll()
1363 const TestConfig *config = GetTestConfig(ssl); in DoShutdown() local
1367 } while (config->async && RetryAsync(ssl, ret)); in DoShutdown()
1374 const TestConfig *config = GetTestConfig(ssl); in DoSendFatalAlert() local
1378 } while (config->async && RetryAsync(ssl, ret)); in DoSendFatalAlert()
1393 const TestConfig *config) { in CheckAuthProperties() argument
1394 if (!config->expected_ocsp_response.empty()) { in CheckAuthProperties()
1398 if (config->expected_ocsp_response.size() != len || in CheckAuthProperties()
1399 OPENSSL_memcmp(config->expected_ocsp_response.data(), data, len) != 0) { in CheckAuthProperties()
1405 if (!config->expected_signed_cert_timestamps.empty()) { in CheckAuthProperties()
1409 if (config->expected_signed_cert_timestamps.size() != len || in CheckAuthProperties()
1410 OPENSSL_memcmp(config->expected_signed_cert_timestamps.data(), data, in CheckAuthProperties()
1417 if (config->expect_verify_result) { in CheckAuthProperties()
1418 int expected_verify_result = config->verify_fail ? in CheckAuthProperties()
1428 if (!config->expect_peer_cert_file.empty()) { in CheckAuthProperties()
1432 config->expect_peer_cert_file)) { in CheckAuthProperties()
1438 if (!config->is_server) { in CheckAuthProperties()
1468 bool expected_sha256_client_cert = config->expect_sha256_client_cert_initial; in CheckAuthProperties()
1470 expected_sha256_client_cert = config->expect_sha256_client_cert_resume; in CheckAuthProperties()
1494 const TestConfig *config) { in CheckHandshakeProperties() argument
1495 if (!CheckAuthProperties(ssl, is_resume, config)) { in CheckHandshakeProperties()
1504 if (config->expect_version != 0 && in CheckHandshakeProperties()
1505 SSL_version(ssl) != config->expect_version) { in CheckHandshakeProperties()
1506 fprintf(stderr, "want version %04x, got %04x\n", config->expect_version, in CheckHandshakeProperties()
1512 is_resume && (!config->expect_session_miss || SSL_in_early_data(ssl)); in CheckHandshakeProperties()
1520 (is_resume || !config->false_start) && !SSL_in_early_data(ssl); in CheckHandshakeProperties()
1527 if (expect_handshake_done && !config->is_server) { in CheckHandshakeProperties()
1529 !config->expect_no_session && in CheckHandshakeProperties()
1530 (!SSL_session_reused(ssl) || config->expect_ticket_renewal) && in CheckHandshakeProperties()
1542 if (config->expect_session_id && !GetTestState(ssl)->got_new_session) { in CheckHandshakeProperties()
1546 if (config->expect_no_session_id && GetTestState(ssl)->got_new_session) { in CheckHandshakeProperties()
1552 if (config->is_server && !GetTestState(ssl)->early_callback_called) { in CheckHandshakeProperties()
1557 if (!config->expected_server_name.empty()) { in CheckHandshakeProperties()
1561 server_name != config->expected_server_name) { in CheckHandshakeProperties()
1563 server_name, config->expected_server_name.c_str()); in CheckHandshakeProperties()
1568 if (!config->expected_next_proto.empty()) { in CheckHandshakeProperties()
1572 if (next_proto_len != config->expected_next_proto.size() || in CheckHandshakeProperties()
1573 OPENSSL_memcmp(next_proto, config->expected_next_proto.data(), in CheckHandshakeProperties()
1580 if (!config->is_server) { in CheckHandshakeProperties()
1584 if (alpn_proto_len != config->expected_alpn.size() || in CheckHandshakeProperties()
1585 OPENSSL_memcmp(alpn_proto, config->expected_alpn.data(), in CheckHandshakeProperties()
1592 if (!config->expected_channel_id.empty()) { in CheckHandshakeProperties()
1598 if (config->expected_channel_id.size() != 64 || in CheckHandshakeProperties()
1599 OPENSSL_memcmp(config->expected_channel_id.data(), channel_id, 64) != in CheckHandshakeProperties()
1606 if (config->expect_extended_master_secret && !SSL_get_extms_support(ssl)) { in CheckHandshakeProperties()
1611 if (config->expect_secure_renegotiation && in CheckHandshakeProperties()
1617 if (config->expect_no_secure_renegotiation && in CheckHandshakeProperties()
1624 if (config->expect_peer_signature_algorithm != 0 && in CheckHandshakeProperties()
1625 config->expect_peer_signature_algorithm != in CheckHandshakeProperties()
1629 config->expect_peer_signature_algorithm); in CheckHandshakeProperties()
1633 if (config->expect_curve_id != 0) { in CheckHandshakeProperties()
1635 if (static_cast<uint16_t>(config->expect_curve_id) != curve_id) { in CheckHandshakeProperties()
1637 static_cast<uint16_t>(config->expect_curve_id)); in CheckHandshakeProperties()
1644 if (config->expect_cipher_aes != 0 && in CheckHandshakeProperties()
1646 static_cast<uint16_t>(config->expect_cipher_aes) != cipher_id) { in CheckHandshakeProperties()
1648 cipher_id, static_cast<uint16_t>(config->expect_cipher_aes)); in CheckHandshakeProperties()
1652 if (config->expect_cipher_no_aes != 0 && in CheckHandshakeProperties()
1654 static_cast<uint16_t>(config->expect_cipher_no_aes) != cipher_id) { in CheckHandshakeProperties()
1656 cipher_id, static_cast<uint16_t>(config->expect_cipher_no_aes)); in CheckHandshakeProperties()
1661 if ((config->expect_accept_early_data && !SSL_early_data_accepted(ssl)) || in CheckHandshakeProperties()
1662 (config->expect_reject_early_data && SSL_early_data_accepted(ssl))) { in CheckHandshakeProperties()
1670 if (!config->psk.empty()) { in CheckHandshakeProperties()
1675 } else if (!config->is_server || config->require_any_client_certificate) { in CheckHandshakeProperties()
1682 if (is_resume && config->expect_ticket_age_skew != 0 && in CheckHandshakeProperties()
1683 SSL_get_ticket_age_skew(ssl) != config->expect_ticket_age_skew) { in CheckHandshakeProperties()
1685 SSL_get_ticket_age_skew(ssl), config->expect_ticket_age_skew); in CheckHandshakeProperties()
1692 static bool WriteSettings(int i, const TestConfig *config, in WriteSettings() argument
1694 if (config->write_settings.empty()) { in WriteSettings()
1701 std::string path = config->write_settings + buf; in WriteSettings()
1724 if (config->is_server && in WriteSettings()
1725 (config->require_any_client_certificate || config->verify_peer) && in WriteSettings()
1730 if (config->tls13_variant != 0 && in WriteSettings()
1732 !CBB_add_u8(cbb.get(), static_cast<uint8_t>(config->tls13_variant)))) { in WriteSettings()
1754 const TestConfig *config, bool is_resume, bool is_retry);
1761 SSL_CTX *ssl_ctx, const TestConfig *config, in DoConnection() argument
1769 if (!SetTestConfig(ssl.get(), config) || in DoConnection()
1776 if (config->fallback_scsv && in DoConnection()
1781 if (!config->use_early_callback && in DoConnection()
1782 !config->use_old_client_cert_callback && in DoConnection()
1783 !config->async && in DoConnection()
1787 if (!config->use_old_client_cert_callback) { in DoConnection()
1790 if (config->require_any_client_certificate) { in DoConnection()
1794 if (config->verify_peer) { in DoConnection()
1797 if (config->verify_peer_if_no_obc) { in DoConnection()
1805 if (config->false_start) { in DoConnection()
1808 if (config->cbc_record_splitting) { in DoConnection()
1811 if (config->partial_write) { in DoConnection()
1814 if (config->no_tls13) { in DoConnection()
1817 if (config->no_tls12) { in DoConnection()
1820 if (config->no_tls11) { in DoConnection()
1823 if (config->no_tls1) { in DoConnection()
1826 if (config->no_ssl3) { in DoConnection()
1829 if (!config->expected_channel_id.empty() || in DoConnection()
1830 config->enable_channel_id) { in DoConnection()
1833 if (!config->send_channel_id.empty()) { in DoConnection()
1835 if (!config->async) { in DoConnection()
1837 bssl::UniquePtr<EVP_PKEY> pkey = LoadPrivateKey(config->send_channel_id); in DoConnection()
1843 if (!config->host_name.empty() && in DoConnection()
1844 !SSL_set_tlsext_host_name(ssl.get(), config->host_name.c_str())) { in DoConnection()
1847 if (!config->advertise_alpn.empty() && in DoConnection()
1849 (const uint8_t *)config->advertise_alpn.data(), in DoConnection()
1850 config->advertise_alpn.size()) != 0) { in DoConnection()
1853 if (!config->psk.empty()) { in DoConnection()
1857 if (!config->psk_identity.empty() && in DoConnection()
1858 !SSL_use_psk_identity_hint(ssl.get(), config->psk_identity.c_str())) { in DoConnection()
1861 if (!config->srtp_profiles.empty() && in DoConnection()
1862 !SSL_set_srtp_profiles(ssl.get(), config->srtp_profiles.c_str())) { in DoConnection()
1865 if (config->enable_ocsp_stapling) { in DoConnection()
1868 if (config->enable_signed_cert_timestamps) { in DoConnection()
1871 if (config->min_version != 0 && in DoConnection()
1872 !SSL_set_min_proto_version(ssl.get(), (uint16_t)config->min_version)) { in DoConnection()
1875 if (config->max_version != 0 && in DoConnection()
1876 !SSL_set_max_proto_version(ssl.get(), (uint16_t)config->max_version)) { in DoConnection()
1879 if (config->mtu != 0) { in DoConnection()
1881 SSL_set_mtu(ssl.get(), config->mtu); in DoConnection()
1883 if (config->install_ddos_callback) { in DoConnection()
1886 if (config->renegotiate_once) { in DoConnection()
1889 if (config->renegotiate_freely) { in DoConnection()
1892 if (config->renegotiate_ignore) { in DoConnection()
1895 if (!config->check_close_notify) { in DoConnection()
1898 if (config->p384_only) { in DoConnection()
1904 if (config->enable_all_curves) { in DoConnection()
1914 if (config->initial_timeout_duration_ms > 0) { in DoConnection()
1916 config->initial_timeout_duration_ms); in DoConnection()
1918 if (config->max_cert_list > 0) { in DoConnection()
1919 SSL_set_max_cert_list(ssl.get(), config->max_cert_list); in DoConnection()
1921 if (!is_resume && config->retain_only_sha256_client_cert_initial) { in DoConnection()
1924 if (is_resume && config->retain_only_sha256_client_cert_resume) { in DoConnection()
1927 if (config->max_send_fragment > 0) { in DoConnection()
1928 SSL_set_max_send_fragment(ssl.get(), config->max_send_fragment); in DoConnection()
1931 int sock = Connect(config->port); in DoConnection()
1941 if (config->is_dtls) { in DoConnection()
1950 if (config->async) { in DoConnection()
1952 config->is_dtls ? AsyncBioCreateDatagram() : AsyncBioCreate(); in DoConnection()
1964 if (!config->is_server) { in DoConnection()
1968 } else if (config->async) { in DoConnection()
1981 if (config->is_server) { in DoConnection()
1987 bool ret = DoExchange(out_session, ssl.get(), config, is_resume, false); in DoConnection()
1988 if (!config->is_server && is_resume && config->expect_reject_early_data) { in DoConnection()
2002 !CheckHandshakeProperties(ssl.get(), is_resume, config)) { in DoConnection()
2027 const TestConfig *config, bool is_resume, in DoExchange() argument
2030 if (!config->implicit_handshake) { in DoExchange()
2033 } while (config->async && RetryAsync(ssl, ret)); in DoExchange()
2035 !CheckHandshakeProperties(ssl, is_resume, config)) { in DoExchange()
2039 if (config->handshake_twice) { in DoExchange()
2042 } while (config->async && RetryAsync(ssl, ret)); in DoExchange()
2049 if (config->no_op_extra_handshake && in DoExchange()
2060 if (config->export_keying_material > 0) { in DoExchange()
2062 static_cast<size_t>(config->export_keying_material)); in DoExchange()
2064 ssl, result.data(), result.size(), config->export_label.data(), in DoExchange()
2065 config->export_label.size(), in DoExchange()
2066 reinterpret_cast<const uint8_t *>(config->export_context.data()), in DoExchange()
2067 config->export_context.size(), config->use_export_context)) { in DoExchange()
2076 if (config->tls_unique) { in DoExchange()
2096 if (config->send_alert) { in DoExchange()
2103 if (config->write_different_record_sizes) { in DoExchange()
2104 if (config->is_dtls) { in DoExchange()
2128 if (config->read_with_unfinished_write) { in DoExchange()
2129 if (!config->async) { in DoExchange()
2143 } else if (config->shim_writes_first) { in DoExchange()
2148 if (!config->shim_shuts_down) { in DoExchange()
2152 size_t read_size = config->is_dtls ? 16384 : 512; in DoExchange()
2153 if (config->read_size > 0) { in DoExchange()
2154 read_size = config->read_size; in DoExchange()
2181 if (!config->is_server && is_resume && !is_retry && in DoExchange()
2182 config->expect_reject_early_data) { in DoExchange()
2214 if (!config->is_server && !config->false_start && in DoExchange()
2215 !config->implicit_handshake && in DoExchange()
2223 if (GetProtocolVersion(ssl) >= TLS1_3_VERSION && !config->is_server) { in DoExchange()
2225 !config->expect_no_session && !config->shim_shuts_down; in DoExchange()
2236 if (config->expect_early_data_info != got_early_data_info) { in DoExchange()
2253 if (config->shim_shuts_down && config->check_close_notify) { in DoExchange()
2279 if (!CheckAuthProperties(ssl, is_resume, config)) { in DoExchange()
2284 if (SSL_total_renegotiations(ssl) != config->expect_total_renegotiations) { in DoExchange()
2286 config->expect_total_renegotiations, SSL_total_renegotiations(ssl)); in DoExchange()
2345 TestConfig *config = is_resume ? &resume_config : &initial_config; in main() local
2346 ssl_ctx = SetupCtx(ssl_ctx.get(), config); in main()
2358 if (!WriteSettings(i, config, offer_session.get())) { in main()
2362 if (!DoConnection(&session, ssl_ctx.get(), config, &retry_config, is_resume, in main()
2369 if (config->resumption_delay != 0) { in main()
2370 g_clock.tv_sec += config->resumption_delay; in main()