Commit c5b9338e authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Treat OpenSSL as a non-portable include

Summary: On Windows, the OpenSSL headers have to be included in a specific order relative to WinSock. Fixing the issues ad-hock is not a viable way to continue, so treat it as completely non-portable and require all includes of it in Folly to go through the portability header.

Reviewed By: yfeldblum

Differential Revision: D4856858

fbshipit-source-id: 56aca1fb0fe095f41a8af12488c6c2080344603d
parent a5a61149
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <openssl/err.h>
#include <openssl/asn1.h>
#include <openssl/ssl.h>
#include <sys/types.h> #include <sys/types.h>
#include <chrono> #include <chrono>
......
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
#include <folly/io/async/DelayedDestruction.h> #include <folly/io/async/DelayedDestruction.h>
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h> #include <folly/io/async/ssl/OpenSSLPtrTypes.h>
#include <folly/portability/OpenSSL.h>
#include <folly/portability/SysUio.h> #include <folly/portability/SysUio.h>
#include <openssl/ssl.h>
constexpr bool kOpenSslModeMoveBufferOwnership = constexpr bool kOpenSslModeMoveBufferOwnership =
#ifdef SSL_MODE_MOVE_BUFFER_OWNERSHIP #ifdef SSL_MODE_MOVE_BUFFER_OWNERSHIP
true true
......
...@@ -16,11 +16,6 @@ ...@@ -16,11 +16,6 @@
#include "SSLContext.h" #include "SSLContext.h"
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/Memory.h> #include <folly/Memory.h>
#include <folly/Random.h> #include <folly/Random.h>
......
...@@ -24,13 +24,6 @@ ...@@ -24,13 +24,6 @@
#include <string> #include <string>
#include <random> #include <random>
// This has to come before SSL.
#include <folly/portability/OpenSSL.h>
#include <folly/portability/Sockets.h>
#include <openssl/ssl.h>
#include <openssl/tls1.h>
#include <glog/logging.h> #include <glog/logging.h>
#ifndef FOLLY_NO_CONFIG #ifndef FOLLY_NO_CONFIG
...@@ -40,6 +33,7 @@ ...@@ -40,6 +33,7 @@
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h> #include <folly/io/async/ssl/OpenSSLPtrTypes.h>
#include <folly/io/async/ssl/OpenSSLUtils.h> #include <folly/io/async/ssl/OpenSSLUtils.h>
#include <folly/portability/OpenSSL.h>
namespace folly { namespace folly {
......
...@@ -18,23 +18,8 @@ ...@@ -18,23 +18,8 @@
#include <glog/logging.h> #include <glog/logging.h>
// This needs to be before any OpenSSL includes.
#include <folly/portability/OpenSSL.h>
#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/bn.h>
#ifndef OPENSSL_NO_EC
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
#endif
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/rsa.h>
#include <openssl/ssl.h>
#include <openssl/x509.h>
#include <folly/Memory.h> #include <folly/Memory.h>
#include <folly/portability/OpenSSL.h>
namespace folly { namespace folly {
namespace ssl { namespace ssl {
......
...@@ -13,18 +13,16 @@ ...@@ -13,18 +13,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <folly/io/async/ssl/OpenSSLUtils.h> #include <folly/io/async/ssl/OpenSSLUtils.h>
#include <folly/ScopeGuard.h>
#include <folly/portability/OpenSSL.h>
#include <folly/portability/Sockets.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
#include <unordered_map> #include <unordered_map>
#include <folly/ScopeGuard.h>
#include <folly/portability/Sockets.h>
namespace { namespace {
#ifdef OPENSSL_IS_BORINGSSL #ifdef OPENSSL_IS_BORINGSSL
// BoringSSL doesn't (as of May 2016) export the equivalent // BoringSSL doesn't (as of May 2016) export the equivalent
......
...@@ -17,11 +17,9 @@ ...@@ -17,11 +17,9 @@
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h> #include <folly/io/async/ssl/OpenSSLPtrTypes.h>
#include <folly/portability/OpenSSL.h>
#include <folly/portability/Sockets.h> #include <folly/portability/Sockets.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
namespace folly { namespace folly {
namespace ssl { namespace ssl {
......
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
#include <folly/io/async/ssl/SSLErrors.h> #include <folly/io/async/ssl/SSLErrors.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
#include <folly/portability/OpenSSL.h>
#include <openssl/err.h>
#include <openssl/x509.h>
using namespace testing; using namespace testing;
using namespace folly; using namespace folly;
......
...@@ -15,9 +15,8 @@ ...@@ -15,9 +15,8 @@
*/ */
#include <folly/io/async/test/AsyncSSLSocketTest.h> #include <folly/io/async/test/AsyncSSLSocketTest.h>
#include <signal.h>
#include <folly/SocketAddress.h> #include <folly/SocketAddress.h>
#include <folly/io/Cursor.h>
#include <folly/io/async/AsyncSSLSocket.h> #include <folly/io/async/AsyncSSLSocket.h>
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/portability/GMock.h> #include <folly/portability/GMock.h>
...@@ -29,10 +28,10 @@ ...@@ -29,10 +28,10 @@
#include <folly/io/async/test/BlockingSocket.h> #include <folly/io/async/test/BlockingSocket.h>
#include <fcntl.h> #include <fcntl.h>
#include <folly/io/Cursor.h> #include <signal.h>
#include <openssl/bio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <list> #include <list>
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
#include <folly/io/async/AsyncSocketException.h> #include <folly/io/async/AsyncSocketException.h>
#include <folly/io/async/ssl/SSLErrors.h> #include <folly/io/async/ssl/SSLErrors.h>
#include <folly/portability/GTest.h>
#include <openssl/ssl.h> #include <folly/portability/GTest.h>
#include <folly/portability/OpenSSL.h>
using namespace testing; using namespace testing;
......
...@@ -21,10 +21,27 @@ ...@@ -21,10 +21,27 @@
#include <folly/Portability.h> #include <folly/Portability.h>
#include <openssl/opensslv.h>
#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/dh.h> #include <openssl/dh.h>
#include <openssl/err.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/sha.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/tls1.h>
#include <openssl/x509.h> #include <openssl/x509.h>
#include <openssl/x509v3.h>
#ifndef OPENSSL_NO_EC
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
#endif
// BoringSSL doesn't have notion of versioning although it defines // BoringSSL doesn't have notion of versioning although it defines
// OPENSSL_VERSION_NUMBER to maintain compatibility. The following variables are // OPENSSL_VERSION_NUMBER to maintain compatibility. The following variables are
......
...@@ -14,13 +14,10 @@ ...@@ -14,13 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
#include <folly/ssl/OpenSSLCertUtils.h> #include <folly/ssl/OpenSSLCertUtils.h>
#include <folly/String.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#include <folly/String.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
namespace folly { namespace folly {
namespace ssl { namespace ssl {
......
...@@ -18,9 +18,8 @@ ...@@ -18,9 +18,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <openssl/x509.h>
#include <folly/Optional.h> #include <folly/Optional.h>
#include <folly/portability/OpenSSL.h>
namespace folly { namespace folly {
namespace ssl { namespace ssl {
......
...@@ -16,14 +16,10 @@ ...@@ -16,14 +16,10 @@
#pragma once #pragma once
#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
#include <folly/portability/OpenSSL.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/sha.h>
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/io/IOBuf.h> #include <folly/io/IOBuf.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
#include <folly/portability/OpenSSL.h>
namespace folly { namespace folly {
namespace ssl { namespace ssl {
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/portability/OpenSSL.h> #include <folly/portability/OpenSSL.h>
#include <openssl/crypto.h>
#include <openssl/opensslv.h>
// This is used to find the OpenSSL version at runtime. Just returning // This is used to find the OpenSSL version at runtime. Just returning
// OPENSSL_VERSION_NUMBER is insufficient as runtime version may be different // OPENSSL_VERSION_NUMBER is insufficient as runtime version may be different
// from the compile-time version // from the compile-time version
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
#include <folly/ssl/OpenSSLCertUtils.h> #include <folly/ssl/OpenSSLCertUtils.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/String.h> #include <folly/String.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h> #include <folly/io/async/ssl/OpenSSLPtrTypes.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment