diff --git a/ssl/test/bssl_shim.cc b/ssl/test/bssl_shim.cc index 8778bb8d..009bdeb3 100644 --- a/ssl/test/bssl_shim.cc +++ b/ssl/test/bssl_shim.cc @@ -70,6 +70,10 @@ OPENSSL_MSVC_PRAGMA(comment(lib, "Ws2_32.lib")) #include "test_config.h" #include "test_state.h" +#if defined(OPENSSL_LINUX) && !defined(OPENSSL_ANDROID) +#define HANDSHAKER_SUPPORTED +#endif + #if !defined(OPENSSL_WINDOWS) static int closesocket(int sock) { @@ -758,7 +762,7 @@ static bool DoExchange(bssl::UniquePtr *out_session, if (!config->implicit_handshake) { if (config->handoff) { -#if defined(OPENSSL_LINUX) && !defined(OPENSSL_ANDROID) +#if defined(HANDSHAKER_SUPPORTED) if (!DoSplitHandshake(ssl_uniqueptr, writer, is_resume)) { return false; } @@ -1100,6 +1104,15 @@ int main(int argc, char **argv) { return Usage(argv[0]); } + if (initial_config.is_handshaker_supported) { +#if defined(HANDSHAKER_SUPPORTED) + printf("Yes\n"); +#else + printf("No\n"); +#endif + return 0; + } + bssl::UniquePtr ssl_ctx; bssl::UniquePtr session; diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go index 6f2e1110..d1748dd7 100644 --- a/ssl/test/runner/runner.go +++ b/ssl/test/runner/runner.go @@ -1478,9 +1478,22 @@ func bigFromHex(hex string) *big.Int { } func convertToSplitHandshakeTests(tests []testCase) (splitHandshakeTests []testCase) { - if runtime.GOOS != "linux" { - return + var stdout bytes.Buffer + shim := exec.Command(*shimPath, "-is-handshaker-supported") + shim.Stdout = &stdout; + if err := shim.Run(); err != nil { + panic(err) } + + switch strings.TrimSpace(string(stdout.Bytes())) { + case "No": + return + case "Yes": + break + default: + panic("Unknown output from shim: 0x" + hex.EncodeToString(stdout.Bytes())) + } + NextTest: for _, test := range tests { if test.protocol != tls || diff --git a/ssl/test/test_config.cc b/ssl/test/test_config.cc index fc870699..d92cf722 100644 --- a/ssl/test/test_config.cc +++ b/ssl/test/test_config.cc @@ -143,6 +143,7 @@ const Flag kBoolFlags[] = { { "-fail-ocsp-callback", &TestConfig::fail_ocsp_callback }, { "-install-cert-compression-algs", &TestConfig::install_cert_compression_algs }, + { "-is-handshaker-supported", &TestConfig::is_handshaker_supported }, { "-handshaker-resume", &TestConfig::handshaker_resume }, }; diff --git a/ssl/test/test_config.h b/ssl/test/test_config.h index 8fd87ac5..6c9ac3e2 100644 --- a/ssl/test/test_config.h +++ b/ssl/test/test_config.h @@ -166,6 +166,7 @@ struct TestConfig { bool decline_ocsp_callback = false; bool fail_ocsp_callback = false; bool install_cert_compression_algs = false; + bool is_handshaker_supported = false; bool handshaker_resume = false; std::string handshaker_path;