8000 Remove superflous OPENSSL version guards (#17888) · hicder/arangodb@f0031e9 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit f0031e9

Browse files
authored
Remove superflous OPENSSL version guards (arangodb#17888)
1 parent 337dc32 commit f0031e9

File tree

6 files changed

+1
-62
lines changed

6 files changed

+1
-62
lines changed

arangod/GeneralServer/AcceptorTcp.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ bool tls_h2_negotiated(SSL* ssl) {
191191
const unsigned char* next_proto = nullptr;
192192
unsigned int next_proto_len = 0;
193193

194-
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
195194
SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len);
196-
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
197195

198196
// allowed value is "h2"
199197
// http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml

arangod/GeneralServer/SslServerFeature.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ asio_ns::ssl::context SslServerFeature::createSslContextInternal(
401401
}
402402
}
403403

404-
#if OPENSSL_VERSION_NUMBER >= 0x0090800fL
405404
if (!_ecdhCurve.empty()) {
406405
int sslEcdhNid = OBJ_sn2nid(_ecdhCurve.c_str());
407406

@@ -431,7 +430,6 @@ asio_ns::ssl::context SslServerFeature::createSslContextInternal(
431430
EC_KEY_free(ecdhKey);
432431
SSL_CTX_set_options(nativeContext, SSL_OP_SINGLE_ECDH_USE);
433432
}
434-
#endif
435433

436434
// set ssl context
437435
int res = SSL_CTX_set_session_id_context(

arangod/RocksDBEngine/RocksDBChecksumEnv.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@
3535

3636
namespace arangodb::checksum {
3737

38-
ChecksumCalculator::ChecksumCalculator()
39-
:
40-
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
41-
_context(EVP_MD_CTX_new()) {
42-
#else
43-
_context(EVP_MD_CTX_create()) {
44-
#endif
38+
ChecksumCalculator::ChecksumCalculator() : _context(EVP_MD_CTX_new()) {
4539
if (_context == nullptr) {
4640
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
4741
}

lib/SimpleHttpClient/SslClientConnection.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -245,48 +245,29 @@ void SslClientConnection::init(uint64_t sslProtocol) {
245245
break;
246246

247247
case TLS_V1:
248-
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
249248
meth = TLS_client_method();
250-
#else
251-
meth = TLSv1_method();
252-
#endif
253249
break;
254250

255251
case TLS_V12:
256-
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
257252
meth = TLS_client_method();
258-
#else
259-
meth = TLSv1_2_method();
260-
#endif
261253
break;
262254

263-
// TLS 1.3, only supported from OpenSSL 1.1.1 onwards
264-
265-
// openssl version number format is
266-
// MNNFFPPS: major minor fix patch status
267-
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
268255
case TLS_V13:
269256
meth = TLS_client_method();
270257
break;
271-
#endif
272258

273259
case TLS_GENERIC:
274260
meth = TLS_client_method();
275261
break;
276262

277263
case SSL_UNKNOWN:
278264
default:
279-
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
280265
// The actual protocol version used will be negotiated to the highest
281266
// version mutually supported by the client and the server. The supported
282267
// protocols are SSLv3, TLSv1, TLSv1.1 and TLSv1.2. Applications should
283268
// use these methods, and avoid the version-specific methods described
284269
6D40 // below.
285270
meth = TLS_method();
286-
#else
287-
// default to TLS 1.2
288-
meth = TLSv1_2_method();
289-
#endif
290271
break;
291272
}
292273

@@ -342,9 +323,7 @@ bool SslClientConnection::connectSocket() {
342323
switch (SslProtocol(_sslProtocol)) {
343324
case TLS_V1:
344325
case TLS_V12:
345-
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
346326
case TLS_V13:
347-
#endif
348327
case TLS_GENERIC:
349328
default:
350329
SSL_set_tlsext_host_name(_ssl, _endpoint->host().c_str());

lib/Ssl/ssl-helper.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,9 @@ asio_ns::ssl::context arangodb::sslContext(SslProtocol protocol,
7878
meth = asio_ns::ssl::context::method::tlsv12_server;
7979
break;
8080

81-
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
8281
case TLS_V13:
83-
// TLS 1.3, only supported from OpenSSL 1.1.1 onwards
84-
// openssl version number format is
85-
// MNNFFPPS: major minor fix patch status
8682
meth = asio_ns::ssl::context::method::tlsv13_server;
8783
break;
88-
#endif
8984

9085
case TLS_GENERIC:
9186
meth = asio_ns::ssl::context::method::tls_server;
@@ -123,9 +118,6 @@ asio_ns::ssl::context arangodb::sslContext(SslProtocol protocol,
123118
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER,
124119
"unable to read key from keyfile");
125120
}
126-
#if (OPENSSL_VERSION_NUMBER < 0x00905100L)
127-
sslctx.set_verify_depth(1);
128-
#endif
129121

130122
return sslctx;
131123
}
@@ -151,10 +143,8 @@ std::string arangodb::protocolName(SslProtocol protocol) {
151143
case TLS_V12:
152144
return "TLSv12";
153145

154-
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
155146
case TLS_V13:
156147
return "TLSv13";
157-
#endif
158148

159149
case TLS_GENERIC:
160150
return "TLS";
@@ -167,31 +157,17 @@ std::string arangodb::protocolName(SslProtocol protocol) {
167157
std::unordered_set<uint64_t> arangodb::availableSslProtocols() {
168158
// openssl version number format is
169159
// MNNFFPPS: major minor fix patch status
170-
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
171160
// TLS 1.3, only support from OpenSSL 1.1.1 onwards
172161
return std::unordered_set<uint64_t>{
173162
SslProtocol::SSL_V2, // unsupported!
174163
SslProtocol::SSL_V23, SslProtocol::SSL_V3, SslProtocol::TLS_V1,
175164
SslProtocol::TLS_V12, SslProtocol::TLS_V13, SslProtocol::TLS_GENERIC};
176-
#else
177-
// no support for TLS 1.3
178-
return std::unordered_set<uint64_t>{
179-
SslProtocol::SSL_V2, // unsupported!
180-
SslProtocol::SSL_V23, SslProtocol::SSL_V3, SslProtocol::TLS_V1,
181-
SslProtocol::TLS_V12, SslProtocol::TLS_GENERIC};
182-
#endif
183165
}
184166

185167
std::string arangodb::availableSslProtocolsDescription() {
186-
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
187168
return "The SSL protocol (1 = SSLv2 (unsupported), 2 = SSLv2 or SSLv3 "
188169
"(negotiated), 3 = SSLv3, 4 = TLSv1, 5 = TLSv1.2, 6 = TLSv1.3, "
189170
"9 = generic TLS (negotiated))";
190-
#else
191-
return "The SSL protocol (1 = SSLv2 (unsupported), 2 = SSLv2 or SSLv3 "
192-
"(negotiated), 3 = SSLv3, 4 = TLSv1, 5 = TLSv1.2, "
193-
"9 = generic TLS (negotiated))";
194-
#endif
195171
}
196172

197173
////////////////////////////////////////////////////////////////////////////////

lib/Ssl/ssl-helper.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,13 @@ enum SslProtocol {
4949
SSL_V3 = 3,
5050
TLS_V1 = 4,
5151
TLS_V12 = 5,
52-
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
5352
TLS_V13 = 6,
54-
#endif
5553
TLS_GENERIC = 9,
5654

5755
SSL_LAST
5856
};
5957

60-
#if (OPENSSL_VERSION_NUMBER < 0x00999999L)
61-
#define SSL_CONST /* */
62-
#else
6358
#define SSL_CONST const
64-
#endif
6559

6660
/// @brief returns a set with all available SSL protocols
6761
std::unordered_set<uint64_t> availableSslProtocols();

0 commit comments

Comments
 (0)
0