Skip to content

Commit

Permalink
add support for OpenSSL 3.1.x
Browse files Browse the repository at this point in the history
Summary:
Fedora 39 will ship OpenSSL 3.1.x, and at least one of the Folly tests fail
because it tests for error messages based on the detected OpenSSL variant, and
currently we can only test for OpenSSL 3.0.x and not OpenSSL 3.x.

Add `FOLLY_OPENSSL_IS_3X` that is more generic than `FOLLY_OPENSSL_IS_30X` and
use it for the SSL certificate error in `SSLErrorsTest`.

Reviewed By: Orvid

Differential Revision: D49154593

fbshipit-source-id: e8d5585bd98caf497ba35db771c2bbfa7883088a
  • Loading branch information
michel-slm authored and facebook-github-bot committed Sep 14, 2023
1 parent 30a1823 commit 77101e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion folly/io/async/ssl/test/SSLErrorsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TEST(SSLErrorsTest, TestMessage) {
std::string expectedMsg =
"AsyncSocketException: error:0b000069:X.509 certificate routines:"
"OPENSSL_internal:CERT_ALREADY_IN_HASH_TABLE, type = SSL error";
#elif FOLLY_OPENSSL_IS_30X
#elif FOLLY_OPENSSL_IS_3X
std::string expectedMsg =
"AsyncSocketException: error:05800065:x509 certificate routines::"
"cert already in hash table, type = SSL error";
Expand Down
3 changes: 3 additions & 0 deletions folly/portability/OpenSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@
// OPENSSL_VERSION_{MAJOR,MINOR} only introduced in 3.0, so need to
// test if they are defined first
#if defined(OPENSSL_VERSION_MAJOR) && defined(OPENSSL_VERSION_MINOR)
#define FOLLY_OPENSSL_IS_3X OPENSSL_VERSION_MAJOR == 3

#define FOLLY_OPENSSL_IS_30X \
OPENSSL_VERSION_MAJOR == 3 && OPENSSL_VERSION_MINOR == 0
#else
#define FOLLY_OPENSSL_IS_3X 0
#define FOLLY_OPENSSL_IS_30X 0
#endif

Expand Down

0 comments on commit 77101e0

Please sign in to comment.