Avoid setting OPENSSL_IS_{101,102,110} when using BoringSSL.
authorZonr Chang <zonr.net@gmail.com>
Thu, 13 Oct 2016 21:07:57 +0000 (14:07 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Thu, 13 Oct 2016 21:11:39 +0000 (14:11 -0700)
Summary: Closes https://github.com/facebook/folly/pull/497

Reviewed By: anirudhvr

Differential Revision: D4016114

Pulled By: Orvid

fbshipit-source-id: ce9da1e20390a2c834e376a7a06f6002103ff1e4

folly/ssl/detail/OpenSSLVersionFinder.h

index 8ff6cdd938d80856c0f961362aa18b83d0f720c2..5360ff695a5f653cd6cd8ce4ec5ea70396181169 100644 (file)
 #include <openssl/crypto.h>
 #include <openssl/opensslv.h>
 
-#define OPENSSL_IS_101                      \
-  (OPENSSL_VERSION_NUMBER >= 0x1000105fL && \
-   OPENSSL_VERSION_NUMBER < 0x1000200fL)
-#define OPENSSL_IS_102                      \
-  (OPENSSL_VERSION_NUMBER >= 0x1000200fL && \
-   OPENSSL_VERSION_NUMBER < 0x10100000L)
-#define OPENSSL_IS_110 (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+// BoringSSL doesn't have notion of versioning although it defines
+// OPENSSL_VERSION_NUMBER to maintain compatibility. The following variables are
+// intended to be specific to OpenSSL.
+#if !defined(OPENSSL_IS_BORINGSSL)
+# define OPENSSL_IS_101                       \
+    (OPENSSL_VERSION_NUMBER >= 0x1000105fL && \
+     OPENSSL_VERSION_NUMBER < 0x1000200fL)
+# define OPENSSL_IS_102                       \
+    (OPENSSL_VERSION_NUMBER >= 0x1000200fL && \
+     OPENSSL_VERSION_NUMBER < 0x10100000L)
+# define OPENSSL_IS_110 (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+#endif  // !defined(OPENSSL_IS_BORINGSSL)
 
 // This is used to find the OpenSSL version at runtime. Just returning
 // OPENSSL_VERSION_NUMBER is insufficient as runtime version may be different