Ask shim whether it supports split handshakes.

The runner currently expects split handshake tests to work is GOOS is
"linux", but that includes Android, which the shim doesn't support.

Rather than try to align these two conditions, have the runner ask the
shim whether it supports split handshakes or not.

Change-Id: I7bea0d94142c4b6ee42b8f54c67b8611da93feb3
Reviewed-on: https://boringssl-review.googlesource.com/30204
Reviewed-by: Matt Braithwaite <mab@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Adam Langley 2018-08-01 08:29:48 -07:00 committed by CQ bot account: commit-bot@chromium.org
parent 548c27646a
commit e7b78770ec
4 changed files with 31 additions and 3 deletions

View File

@ -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<SSL_SESSION> *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> ssl_ctx;
bssl::UniquePtr<SSL_SESSION> session;

View File

@ -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 ||

View File

@ -143,6 +143,7 @@ const Flag<bool> 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 },
};

View File

@ -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;