Skip to content

Commit 2e97e76

Browse files
authored
impl(auth): check GOOGLE_CLOUD_CPP_HAVE_OPENSSL in ssl_ec_curves (#16579)
1 parent 86976f0 commit 2e97e76

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎google/cloud/internal/openssl/ssl_ec_curves.cc‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515
#ifndef _WIN32
1616
#include "google/cloud/internal/ssl_ec_curves.h"
17+
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENSSL
1718
#include <openssl/ec.h>
1819
#include <openssl/ssl.h>
20+
#endif
1921
#include <algorithm>
2022
#include <memory>
2123
#include <string>
@@ -26,6 +28,7 @@ namespace cloud {
2628
namespace rest_internal {
2729
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2830

31+
#if GOOGLE_CLOUD_CPP_HAVE_OPENSSL
2932
#if OPENSSL_VERSION_NUMBER >= 0x30500000L
3033
namespace {
3134
struct OpenSslDeleter {
@@ -35,10 +38,12 @@ struct OpenSslDeleter {
3538
void operator()(SSL_CTX* ptr) { SSL_CTX_free(ptr); }
3639
};
3740
} // namespace
38-
#endif
41+
#endif // OPENSSL_VERSION_NUMBER >= 0x30500000L
42+
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENSSL
3943

4044
std::vector<std::string> AvailableCryptoGroups() {
4145
std::vector<std::string> groups;
46+
#if GOOGLE_CLOUD_CPP_HAVE_OPENSSL
4247
#if OPENSSL_VERSION_NUMBER >= 0x30500000L
4348
auto ctx =
4449
std::unique_ptr<SSL_CTX, OpenSslDeleter>(SSL_CTX_new(TLS_method()));
@@ -75,6 +80,7 @@ std::vector<std::string> AvailableCryptoGroups() {
7580
if (name != nullptr) groups.emplace_back(name);
7681
}
7782
#endif // OPENSSL_VERSION_NUMBER >= 0x30500000L
83+
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENSSL
7884
return groups;
7985
}
8086

0 commit comments

Comments
 (0)