Treat OpenSSL as a non-portable include
authorChristopher Dykes <cdykes@fb.com>
Tue, 11 Apr 2017 21:17:10 +0000 (14:17 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 11 Apr 2017 21:20:08 +0000 (14:20 -0700)
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

16 files changed:
folly/io/async/AsyncSSLSocket.cpp
folly/io/async/AsyncTransport.h
folly/io/async/SSLContext.cpp
folly/io/async/SSLContext.h
folly/io/async/ssl/OpenSSLPtrTypes.h
folly/io/async/ssl/OpenSSLUtils.cpp
folly/io/async/ssl/OpenSSLUtils.h
folly/io/async/ssl/test/SSLErrorsTest.cpp
folly/io/async/test/AsyncSSLSocketTest.cpp
folly/io/async/test/AsyncSocketExceptionTest.cpp
folly/portability/OpenSSL.h
folly/ssl/OpenSSLCertUtils.cpp
folly/ssl/OpenSSLCertUtils.h
folly/ssl/OpenSSLHash.h
folly/ssl/OpenSSLVersionFinder.h
folly/ssl/test/OpenSSLCertUtilsTest.cpp

index f8e315fb3d0c9648e2cf0e17951df93df0da6801..8c7ab10c3076d9104768936cf93aa5e2f36fb49f 100644 (file)
@@ -22,9 +22,6 @@
 #include <boost/noncopyable.hpp>
 #include <errno.h>
 #include <fcntl.h>
-#include <openssl/err.h>
-#include <openssl/asn1.h>
-#include <openssl/ssl.h>
 #include <sys/types.h>
 #include <chrono>
 
index 6505c287fcaa3faa277d8274f4d05ba1c057914b..d20831f833798de8045873503fa8b9d77771d0d0 100644 (file)
 #include <folly/io/async/DelayedDestruction.h>
 #include <folly/io/async/EventBase.h>
 #include <folly/io/async/ssl/OpenSSLPtrTypes.h>
+#include <folly/portability/OpenSSL.h>
 #include <folly/portability/SysUio.h>
 
-#include <openssl/ssl.h>
-
 constexpr bool kOpenSslModeMoveBufferOwnership =
 #ifdef SSL_MODE_MOVE_BUFFER_OWNERSHIP
   true
index f3ca89f5b4b2af57adf793083d9b030009543933..76bb4aa684ff4969351c773c3b14bb354d51a9b1 100644 (file)
 
 #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/Memory.h>
 #include <folly/Random.h>
index 07fec1cc78afbb538f514901f88e80c6dd06f61f..f4a638ef94f04ac50ba003432d9caaccf7b24e79 100644 (file)
 #include <string>
 #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>
 
 #ifndef FOLLY_NO_CONFIG
@@ -40,6 +33,7 @@
 #include <folly/Range.h>
 #include <folly/io/async/ssl/OpenSSLPtrTypes.h>
 #include <folly/io/async/ssl/OpenSSLUtils.h>
+#include <folly/portability/OpenSSL.h>
 
 namespace folly {
 
index ee0bf13f6466c24fb8fb1648184e505d76d1f471..c465fc13219b1e718f7d0a1478fec02444908adb 100644 (file)
 
 #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/portability/OpenSSL.h>
 
 namespace folly {
 namespace ssl {
index db25b8bd036ab8f623240073fc16c2fdd7f4cb6f..67cc119727519271c6938159081b7db24b7e8ced 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #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 <openssl/bio.h>
-#include <openssl/err.h>
-#include <openssl/rand.h>
-#include <openssl/ssl.h>
-#include <openssl/x509v3.h>
+
 #include <unordered_map>
 
+#include <folly/ScopeGuard.h>
+#include <folly/portability/Sockets.h>
+
 namespace {
 #ifdef OPENSSL_IS_BORINGSSL
 // BoringSSL doesn't (as of May 2016) export the equivalent
index 877df15667433ea8f72ebe7ccb8f93873986bd92..90135928c8233cbb612dcc74ae073d204dbc5f1e 100644 (file)
 
 #include <folly/Range.h>
 #include <folly/io/async/ssl/OpenSSLPtrTypes.h>
+#include <folly/portability/OpenSSL.h>
 #include <folly/portability/Sockets.h>
 
-#include <openssl/ssl.h>
-#include <openssl/x509v3.h>
-
 namespace folly {
 namespace ssl {
 
index 14dacbe3dbcff9f1296d5379cc90abcd3eb8cfda..e07b552f550c412dd6cd7f0e2caecaa6337920b5 100644 (file)
@@ -17,9 +17,7 @@
 #include <folly/io/async/ssl/SSLErrors.h>
 
 #include <folly/portability/GTest.h>
-
-#include <openssl/err.h>
-#include <openssl/x509.h>
+#include <folly/portability/OpenSSL.h>
 
 using namespace testing;
 using namespace folly;
index 723599250a185cfe9ab497d1a1a8c42cc8d53034..bc42103dfa5cce97a36fb1e630fbbb9f8016cb88 100644 (file)
@@ -15,9 +15,8 @@
  */
 #include <folly/io/async/test/AsyncSSLSocketTest.h>
 
-#include <signal.h>
-
 #include <folly/SocketAddress.h>
+#include <folly/io/Cursor.h>
 #include <folly/io/async/AsyncSSLSocket.h>
 #include <folly/io/async/EventBase.h>
 #include <folly/portability/GMock.h>
 #include <folly/io/async/test/BlockingSocket.h>
 
 #include <fcntl.h>
-#include <folly/io/Cursor.h>
-#include <openssl/bio.h>
+#include <signal.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
+
 #include <fstream>
 #include <iostream>
 #include <list>
index 87ad6af937ccc3eefce8fb83f4b5c8d14180790f..277fd799283fdc324e73baf3da41fd2ea5ad75a3 100644 (file)
@@ -17,9 +17,9 @@
 
 #include <folly/io/async/AsyncSocketException.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;
 
index d392578c3770606b760ed838be07fc8f543b96ec..d5d0b0f6c579d2de8a47dfd6b216860113b701f6 100644 (file)
 
 #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/err.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/tls1.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
 // OPENSSL_VERSION_NUMBER to maintain compatibility. The following variables are
index 238fa689131cb81592ce793fed6dfba0461deee9..79800df88be483a389bc37cadfddc60a6065f729 100644 (file)
  * limitations under the License.
  */
 #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/String.h>
+#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
 
 namespace folly {
 namespace ssl {
index c6c3803b58da7ae8bd86a7956d9a74b1af45ab62..be8fbec9187d930796215513037e6409049f272f 100644 (file)
@@ -18,9 +18,8 @@
 #include <string>
 #include <vector>
 
-#include <openssl/x509.h>
-
 #include <folly/Optional.h>
+#include <folly/portability/OpenSSL.h>
 
 namespace folly {
 namespace ssl {
index 5d11e3b7180ad7a7998e77fe189806555181bab3..baf9ec7f56681c85b71a675c474b36fe038a8b1a 100644 (file)
 
 #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/io/IOBuf.h>
+#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
+#include <folly/portability/OpenSSL.h>
 
 namespace folly {
 namespace ssl {
index d826e7067bd058be1d6249a7ceb32ff59f2203c3..19914f97103726d105694db9b8f097c6271d4230 100644 (file)
@@ -18,9 +18,6 @@
 #include <folly/Conv.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
 // OPENSSL_VERSION_NUMBER is insufficient as runtime version may be different
 // from the compile-time version
index 629c15a2282c5c8349a3f0fe469c19f97183fefa..874edb60ba7b01a82be65e367bc7edf6c5f4c097 100644 (file)
@@ -16,9 +16,6 @@
 
 #include <folly/ssl/OpenSSLCertUtils.h>
 
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-
 #include <folly/Range.h>
 #include <folly/String.h>
 #include <folly/io/async/ssl/OpenSSLPtrTypes.h>