Move Trusty workaround to the OPENSSL_LINUX define.
See b/169780122. This CL should be a no-op (the only other OPENSSL_LINUX
defines are in urandom/getrandom logic, which Trusty doesn't use), but
should be easier to work for future code.
Change-Id: I7676ce234a20ddaf54a881f2da1e1fcd680d1c78
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/43224
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/fipsmodule/rand/fork_detect.c b/crypto/fipsmodule/rand/fork_detect.c
index 96cb595..8dd2c95 100644
--- a/crypto/fipsmodule/rand/fork_detect.c
+++ b/crypto/fipsmodule/rand/fork_detect.c
@@ -20,7 +20,7 @@
#include "fork_detect.h"
-#if defined(OPENSSL_LINUX) && !defined(OPENSSL_TRUSTY)
+#if defined(OPENSSL_LINUX)
#include <sys/mman.h>
#include <unistd.h>
#include <stdlib.h>
diff --git a/include/openssl/base.h b/include/openssl/base.h
index d681bdf..0bdb1db 100644
--- a/include/openssl/base.h
+++ b/include/openssl/base.h
@@ -138,7 +138,10 @@
#define OPENSSL_WINDOWS
#endif
-#if defined(__linux__)
+// Trusty isn't Linux but currently defines __linux__. As a workaround, we
+// exclude it here.
+// TODO(b/169780122): Remove this workaround once Trusty no longer defines it.
+#if defined(__linux__) && !defined(TRUSTY)
#define OPENSSL_LINUX
#endif