Define HANDSHAKER_SUPPORTED in once place.
Change-Id: Ie5e41c55e36958af5aabd9e365eb2986a488069e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/46525
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/test/bssl_shim.cc b/ssl/test/bssl_shim.cc
index 6df8d60..6a5fca3 100644
--- a/ssl/test/bssl_shim.cc
+++ b/ssl/test/bssl_shim.cc
@@ -66,10 +66,6 @@
#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) {
diff --git a/ssl/test/handshake_util.cc b/ssl/test/handshake_util.cc
index a94fbaf..7fa0fb5 100644
--- a/ssl/test/handshake_util.cc
+++ b/ssl/test/handshake_util.cc
@@ -15,7 +15,7 @@
#include "handshake_util.h"
#include <assert.h>
-#if defined(OPENSSL_LINUX) && !defined(OPENSSL_ANDROID)
+#if defined(HANDSHAKER_SUPPORTED)
#include <errno.h>
#include <fcntl.h>
#include <spawn.h>
@@ -136,7 +136,7 @@
return ret;
}
-#if defined(OPENSSL_LINUX) && !defined(OPENSSL_ANDROID)
+#if defined(HANDSHAKER_SUPPORTED)
// MoveBIOs moves the |BIO|s of |src| to |dst|. It is used for handoff.
static void MoveBIOs(SSL *dest, SSL *src) {
@@ -543,4 +543,4 @@
return true;
}
-#endif // defined(OPENSSL_LINUX) && !defined(OPENSSL_ANDROID)
+#endif // defined(HANDSHAKER_SUPPORTED)
diff --git a/ssl/test/handshake_util.h b/ssl/test/handshake_util.h
index 4fb46db..fa365a4 100644
--- a/ssl/test/handshake_util.h
+++ b/ssl/test/handshake_util.h
@@ -21,6 +21,11 @@
#include "settings_writer.h"
+
+#if defined(OPENSSL_LINUX) && !defined(OPENSSL_ANDROID)
+#define HANDSHAKER_SUPPORTED
+#endif
+
// RetryAsync is called after a failed operation on |ssl| with return code
// |ret|. If the operation should be retried, it simulates one asynchronous
// event and returns true. Otherwise it returns false.
@@ -30,6 +35,7 @@
// errors are idempotent.
int CheckIdempotentError(const char *name, SSL *ssl, std::function<int()> func);
+#if defined(HANDSHAKER_SUPPORTED)
// DoSplitHandshake delegates the SSL handshake to a separate process, called
// the handshaker. This process proxies I/O between the handshaker and the
// client, using the |BIO| from |ssl|. After a successful handshake, |ssl| is
@@ -49,5 +55,6 @@
constexpr int kFdControl = 3; // Bi-directional dgram socket.
constexpr int kFdProxyToHandshaker = 4; // Uni-directional pipe.
constexpr int kFdHandshakerToProxy = 5; // Uni-directional pipe.
+#endif // HANDSHAKER_SUPPORTED
#endif // HEADER_TEST_HANDSHAKE