Lines Matching refs:config

120 static bool SetConfigPtr(SSL *ssl, const TestConfig *config) {  in SetConfigPtr()  argument
121 return SSL_set_ex_data(ssl, g_config_index, (void *)config) == 1; in SetConfigPtr()
295 const TestConfig *config = GetConfigPtr(ssl); in InstallCertificate() local
298 if (!config->digest_prefs.empty()) { in InstallCertificate()
300 strdup(config->digest_prefs.c_str())); in InstallCertificate()
319 if (!config->key_file.empty()) { in InstallCertificate()
320 if (config->async) { in InstallCertificate()
321 test_state->private_key = LoadPrivateKey(config->key_file.c_str()); in InstallCertificate()
326 } else if (!SSL_use_PrivateKey_file(ssl, config->key_file.c_str(), in InstallCertificate()
331 if (!config->cert_file.empty() && in InstallCertificate()
332 !SSL_use_certificate_file(ssl, config->cert_file.c_str(), in InstallCertificate()
336 if (!config->ocsp_response.empty() && in InstallCertificate()
338 (const uint8_t *)config->ocsp_response.data(), in InstallCertificate()
339 config->ocsp_response.size())) { in InstallCertificate()
346 const TestConfig *config = GetConfigPtr(ctx->ssl); in SelectCertificateCallback() local
349 if (!config->expected_server_name.empty()) { in SelectCertificateCallback()
374 (const uint8_t*)config->expected_server_name.data(), in SelectCertificateCallback()
375 config->expected_server_name.size())) { in SelectCertificateCallback()
380 if (config->fail_early_callback) { in SelectCertificateCallback()
385 if (config->use_early_callback) { in SelectCertificateCallback()
386 if (config->async) { in SelectCertificateCallback()
400 const TestConfig *config = GetConfigPtr(ssl); in VerifySucceed() local
402 if (!config->expected_ocsp_response.empty()) { in VerifySucceed()
422 const TestConfig *config = GetConfigPtr(ssl); in NextProtosAdvertisedCallback() local
423 if (config->advertise_npn.empty()) { in NextProtosAdvertisedCallback()
427 *out = (const uint8_t*)config->advertise_npn.data(); in NextProtosAdvertisedCallback()
428 *out_len = config->advertise_npn.size(); in NextProtosAdvertisedCallback()
434 const TestConfig *config = GetConfigPtr(ssl); in NextProtoSelectCallback() local
435 if (config->select_next_proto.empty()) { in NextProtoSelectCallback()
439 *out = (uint8_t*)config->select_next_proto.data(); in NextProtoSelectCallback()
440 *outlen = config->select_next_proto.size(); in NextProtoSelectCallback()
446 const TestConfig *config = GetConfigPtr(ssl); in AlpnSelectCallback() local
447 if (config->select_alpn.empty()) { in AlpnSelectCallback()
451 if (!config->expected_advertised_alpn.empty() && in AlpnSelectCallback()
452 (config->expected_advertised_alpn.size() != inlen || in AlpnSelectCallback()
453 memcmp(config->expected_advertised_alpn.data(), in AlpnSelectCallback()
459 *out = (const uint8_t*)config->select_alpn.data(); in AlpnSelectCallback()
460 *outlen = config->select_alpn.size(); in AlpnSelectCallback()
468 const TestConfig *config = GetConfigPtr(ssl); in PskClientCallback() local
470 if (strcmp(hint ? hint : "", config->psk_identity.c_str()) != 0) { in PskClientCallback()
476 if (config->psk_identity.size() >= max_identity_len || in PskClientCallback()
477 config->psk.size() > max_psk_len) { in PskClientCallback()
482 BUF_strlcpy(out_identity, config->psk_identity.c_str(), in PskClientCallback()
484 memcpy(out_psk, config->psk.data(), config->psk.size()); in PskClientCallback()
485 return config->psk.size(); in PskClientCallback()
490 const TestConfig *config = GetConfigPtr(ssl); in PskServerCallback() local
492 if (strcmp(identity, config->psk_identity.c_str()) != 0) { in PskServerCallback()
497 if (config->psk.size() > max_psk_len) { in PskServerCallback()
502 memcpy(out_psk, config->psk.data(), config->psk.size()); in PskServerCallback()
503 return config->psk.size(); in PskServerCallback()
538 const TestConfig *config = GetConfigPtr(early_context->ssl); in DDoSCallback() local
542 if (config->fail_ddos_callback || in DDoSCallback()
543 (config->fail_second_ddos_callback && callback_num == 2)) { in DDoSCallback()
707 static ScopedSSL_CTX SetupCtx(const TestConfig *config) { in SetupCtx() argument
709 config->is_dtls ? DTLS_method() : TLS_method())); in SetupCtx()
715 if (!config->cipher.empty()) { in SetupCtx()
716 cipher_list = config->cipher; in SetupCtx()
723 if (!config->cipher_tls10.empty() && in SetupCtx()
725 config->cipher_tls10.c_str())) { in SetupCtx()
728 if (!config->cipher_tls11.empty() && in SetupCtx()
730 config->cipher_tls11.c_str())) { in SetupCtx()
736 if (config->use_sparse_dh_prime) { in SetupCtx()
757 if (config->async && config->is_server) { in SetupCtx()
771 if (!config->select_next_proto.empty()) { in SetupCtx()
776 if (!config->select_alpn.empty()) { in SetupCtx()
788 if (config->use_ticket_callback) { in SetupCtx()
792 if (config->enable_client_custom_extension && in SetupCtx()
800 if (config->enable_server_custom_extension && in SetupCtx()
808 if (config->verify_fail) { in SetupCtx()
814 if (!config->signed_cert_timestamps.empty() && in SetupCtx()
816 ssl_ctx.get(), (const uint8_t *)config->signed_cert_timestamps.data(), in SetupCtx()
817 config->signed_cert_timestamps.size())) { in SetupCtx()
833 const TestConfig *config = GetConfigPtr(ssl); in RetryAsync() local
846 if (config->async) { in RetryAsync()
850 if (config->async) { in RetryAsync()
898 const TestConfig *config = GetConfigPtr(ssl); in DoRead() local
902 if (config->async) { in DoRead()
909 if (config->async) { in DoRead()
912 } while (config->async && RetryAsync(ssl, ret)); in DoRead()
919 const TestConfig *config = GetConfigPtr(ssl); in WriteAll() local
927 } while ((config->async && RetryAsync(ssl, ret)) || (ret > 0 && in_len > 0)); in WriteAll()
934 const TestConfig *config = GetConfigPtr(ssl); in DoShutdown() local
938 } while (config->async && RetryAsync(ssl, ret)); in DoShutdown()
946 const TestConfig *config = GetConfigPtr(ssl); in CheckHandshakeProperties() local
954 (!!SSL_session_reused(ssl) == config->expect_session_miss)) { in CheckHandshakeProperties()
960 bool expect_handshake_done = is_resume || !config->false_start; in CheckHandshakeProperties()
967 if (expect_handshake_done && !config->is_server) { in CheckHandshakeProperties()
969 !config->expect_no_session && in CheckHandshakeProperties()
970 (!SSL_session_reused(ssl) || config->expect_ticket_renewal); in CheckHandshakeProperties()
979 if (config->is_server && !GetTestState(ssl)->early_callback_called) { in CheckHandshakeProperties()
984 if (!config->expected_server_name.empty()) { in CheckHandshakeProperties()
987 if (server_name != config->expected_server_name) { in CheckHandshakeProperties()
989 server_name, config->expected_server_name.c_str()); in CheckHandshakeProperties()
994 if (!config->expected_certificate_types.empty()) { in CheckHandshakeProperties()
998 if (certificate_types_len != config->expected_certificate_types.size() || in CheckHandshakeProperties()
1000 config->expected_certificate_types.data(), in CheckHandshakeProperties()
1007 if (!config->expected_next_proto.empty()) { in CheckHandshakeProperties()
1011 if (next_proto_len != config->expected_next_proto.size() || in CheckHandshakeProperties()
1012 memcmp(next_proto, config->expected_next_proto.data(), in CheckHandshakeProperties()
1019 if (!config->expected_alpn.empty()) { in CheckHandshakeProperties()
1023 if (alpn_proto_len != config->expected_alpn.size() || in CheckHandshakeProperties()
1024 memcmp(alpn_proto, config->expected_alpn.data(), in CheckHandshakeProperties()
1031 if (!config->expected_channel_id.empty()) { in CheckHandshakeProperties()
1037 if (config->expected_channel_id.size() != 64 || in CheckHandshakeProperties()
1038 memcmp(config->expected_channel_id.data(), in CheckHandshakeProperties()
1045 if (config->expect_extended_master_secret) { in CheckHandshakeProperties()
1052 if (!config->expected_ocsp_response.empty()) { in CheckHandshakeProperties()
1056 if (config->expected_ocsp_response.size() != len || in CheckHandshakeProperties()
1057 memcmp(config->expected_ocsp_response.data(), data, len) != 0) { in CheckHandshakeProperties()
1063 if (!config->expected_signed_cert_timestamps.empty()) { in CheckHandshakeProperties()
1067 if (config->expected_signed_cert_timestamps.size() != len || in CheckHandshakeProperties()
1068 memcmp(config->expected_signed_cert_timestamps.data(), in CheckHandshakeProperties()
1075 if (config->expect_verify_result) { in CheckHandshakeProperties()
1076 int expected_verify_result = config->verify_fail ? in CheckHandshakeProperties()
1086 if (config->expect_server_key_exchange_hash != 0 && in CheckHandshakeProperties()
1087 config->expect_server_key_exchange_hash != in CheckHandshakeProperties()
1091 config->expect_server_key_exchange_hash); in CheckHandshakeProperties()
1095 if (config->expect_key_exchange_info != 0) { in CheckHandshakeProperties()
1097 if (static_cast<uint32_t>(config->expect_key_exchange_info) != info) { in CheckHandshakeProperties()
1099 info, static_cast<uint32_t>(config->expect_key_exchange_info)); in CheckHandshakeProperties()
1104 if (!config->is_server) { in CheckHandshakeProperties()
1107 if (config->psk.empty()) { in CheckHandshakeProperties()
1125 const TestConfig *config, bool is_resume, in DoExchange() argument
1132 if (!SetConfigPtr(ssl.get(), config) || in DoExchange()
1137 if (config->fallback_scsv && in DoExchange()
1141 if (!config->use_early_callback) { in DoExchange()
1142 if (config->async) { in DoExchange()
1149 if (config->require_any_client_certificate) { in DoExchange()
1153 if (config->verify_peer) { in DoExchange()
1156 if (config->false_start) { in DoExchange()
1159 if (config->cbc_record_splitting) { in DoExchange()
1162 if (config->partial_write) { in DoExchange()
1165 if (config->no_tls12) { in DoExchange()
1168 if (config->no_tls11) { in DoExchange()
1171 if (config->no_tls1) { in DoExchange()
1174 if (config->no_ssl3) { in DoExchange()
1177 if (!config->expected_channel_id.empty()) { in DoExchange()
1180 if (!config->send_channel_id.empty()) { in DoExchange()
1182 if (!config->async) { in DoExchange()
1184 ScopedEVP_PKEY pkey = LoadPrivateKey(config->send_channel_id); in DoExchange()
1190 if (!config->host_name.empty() && in DoExchange()
1191 !SSL_set_tlsext_host_name(ssl.get(), config->host_name.c_str())) { in DoExchange()
1194 if (!config->advertise_alpn.empty() && in DoExchange()
1196 (const uint8_t *)config->advertise_alpn.data(), in DoExchange()
1197 config->advertise_alpn.size()) != 0) { in DoExchange()
1200 if (!config->psk.empty()) { in DoExchange()
1204 if (!config->psk_identity.empty() && in DoExchange()
1205 !SSL_use_psk_identity_hint(ssl.get(), config->psk_identity.c_str())) { in DoExchange()
1208 if (!config->srtp_profiles.empty() && in DoExchange()
1209 !SSL_set_srtp_profiles(ssl.get(), config->srtp_profiles.c_str())) { in DoExchange()
1212 if (config->enable_ocsp_stapling && in DoExchange()
1216 if (config->enable_signed_cert_timestamps && in DoExchange()
1220 if (config->min_version != 0) { in DoExchange()
1221 SSL_set_min_version(ssl.get(), (uint16_t)config->min_version); in DoExchange()
1223 if (config->max_version != 0) { in DoExchange()
1224 SSL_set_max_version(ssl.get(), (uint16_t)config->max_version); in DoExchange()
1226 if (config->mtu != 0) { in DoExchange()
1228 SSL_set_mtu(ssl.get(), config->mtu); in DoExchange()
1230 if (config->install_ddos_callback) { in DoExchange()
1233 if (config->renegotiate_once) { in DoExchange()
1236 if (config->renegotiate_freely) { in DoExchange()
1239 if (config->renegotiate_ignore) { in DoExchange()
1242 if (!config->check_close_notify) { in DoExchange()
1245 if (config->disable_npn) { in DoExchange()
1248 if (config->p384_only) { in DoExchange()
1254 if (config->enable_all_curves) { in DoExchange()
1264 int sock = Connect(config->port); in DoExchange()
1274 if (config->is_dtls) { in DoExchange()
1280 if (config->async) { in DoExchange()
1282 config->is_dtls ? AsyncBioCreateDatagram() : AsyncBioCreate(); in DoExchange()
1291 if (!config->is_server) { in DoExchange()
1295 } else if (config->async) { in DoExchange()
1309 if (config->implicit_handshake) { in DoExchange()
1310 if (config->is_server) { in DoExchange()
1317 if (config->is_server) { in DoExchange()
1322 } while (config->async && RetryAsync(ssl.get(), ret)); in DoExchange()
1333 if (config->export_keying_material > 0) { in DoExchange()
1335 static_cast<size_t>(config->export_keying_material)); in DoExchange()
1338 config->export_label.data(), config->export_label.size(), in DoExchange()
1339 reinterpret_cast<const uint8_t*>(config->export_context.data()), in DoExchange()
1340 config->export_context.size(), config->use_export_context)) { in DoExchange()
1349 if (config->tls_unique) { in DoExchange()
1369 if (config->write_different_record_sizes) { in DoExchange()
1370 if (config->is_dtls) { in DoExchange()
1393 if (config->shim_writes_first) { in DoExchange()
1399 if (!config->shim_shuts_down) { in DoExchange()
1406 int n = DoRead(ssl.get(), buf.get(), config->is_dtls ? kBufLen : 512); in DoExchange()
1446 if (!config->is_server && !config->false_start && in DoExchange()
1447 !config->implicit_handshake && in DoExchange()
1459 if (config->shim_shuts_down && config->check_close_notify) { in DoExchange()
1476 config->expect_total_renegotiations) { in DoExchange()
1478 config->expect_total_renegotiations, in DoExchange()
1511 TestConfig config; in main() local
1512 if (!ParseConfig(argc - 1, argv + 1, &config)) { in main()
1516 ScopedSSL_CTX ssl_ctx = SetupCtx(&config); in main()
1523 if (!DoExchange(&session, ssl_ctx.get(), &config, false /* is_resume */, in main()
1529 if (config.resume && in main()
1530 !DoExchange(NULL, ssl_ctx.get(), &config, true /* is_resume */, in main()