Skip to content

Commit c3e0d46

Browse files
authored
Remove support for OpenSSL 1.0.x and below. (#1777)
1 parent 527d22f commit c3e0d46

File tree

5 files changed

+1
-67
lines changed

5 files changed

+1
-67
lines changed

src/factory/MySQLTaskImpl.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,6 @@ CommMessageOut *ComplexMySQLTask::message_out()
213213
auth_switch_req->set_password(password_);
214214
auth_switch_req->set_auth_plugin_name(std::move(conn->str));
215215
auth_switch_req->set_seed(conn->seed);
216-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
217-
WFGlobal::get_ssl_client_ctx();
218-
#endif
219216
break;
220217

221218
case ST_SHA256_PUBLIC_KEY_REQUEST:

src/manager/RouteManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class RouteManager
4646

4747
class RouteTarget : public CommSchedTarget
4848
{
49-
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
5049
public:
5150
int init(const struct sockaddr *addr, socklen_t addrlen, SSL_CTX *ssl_ctx,
5251
int connect_timeout, int ssl_connect_timeout, int response_timeout,
@@ -70,7 +69,6 @@ class RouteManager
7069
if (ssl_ctx)
7170
SSL_CTX_free(ssl_ctx);
7271
}
73-
#endif
7472

7573
public:
7674
int state;

src/manager/WFGlobal.cc

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
#include <mutex>
3232
#include <condition_variable>
3333
#include <openssl/ssl.h>
34-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
35-
# include <openssl/err.h>
36-
# include <openssl/engine.h>
37-
# include <openssl/conf.h>
38-
# include <openssl/crypto.h>
39-
#endif
4034
#include "CommScheduler.h"
4135
#include "Executor.h"
4236
#include "WFResourcePool.h"
@@ -179,18 +173,6 @@ __WFGlobal::__WFGlobal()
179173
sync_max_ = 0;
180174
}
181175

182-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
183-
static std::mutex *__ssl_mutex;
184-
185-
static void ssl_locking_callback(int mode, int type, const char* file, int line)
186-
{
187-
if (mode & CRYPTO_LOCK)
188-
__ssl_mutex[type].lock();
189-
else if (mode & CRYPTO_UNLOCK)
190-
__ssl_mutex[type].unlock();
191-
}
192-
#endif
193-
194176
class __SSLManager
195177
{
196178
public:
@@ -206,15 +188,6 @@ class __SSLManager
206188
private:
207189
__SSLManager()
208190
{
209-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
210-
__ssl_mutex = new std::mutex[CRYPTO_num_locks()];
211-
CRYPTO_set_locking_callback(ssl_locking_callback);
212-
SSL_library_init();
213-
SSL_load_error_strings();
214-
//ERR_load_crypto_strings();
215-
//OpenSSL_add_all_algorithms();
216-
#endif
217-
218191
ssl_client_ctx_ = SSL_CTX_new(SSLv23_client_method());
219192
if (ssl_client_ctx_ == NULL)
220193
abort();
@@ -223,29 +196,6 @@ class __SSLManager
223196
~__SSLManager()
224197
{
225198
SSL_CTX_free(ssl_client_ctx_);
226-
227-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
228-
//free ssl to avoid memory leak
229-
FIPS_mode_set(0);
230-
CRYPTO_set_locking_callback(NULL);
231-
# ifdef CRYPTO_LOCK_ECDH
232-
CRYPTO_THREADID_set_callback(NULL);
233-
# else
234-
CRYPTO_set_id_callback(NULL);
235-
# endif
236-
ENGINE_cleanup();
237-
CONF_modules_unload(1);
238-
ERR_free_strings();
239-
EVP_cleanup();
240-
# ifdef CRYPTO_LOCK_ECDH
241-
ERR_remove_thread_state(NULL);
242-
# else
243-
ERR_remove_state(0);
244-
# endif
245-
CRYPTO_cleanup_all_ex_data();
246-
sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
247-
delete []__ssl_mutex;
248-
#endif
249199
}
250200

251201
private:

src/protocol/MySQLMessage.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ int MySQLRSAAuthRequest::encode(struct iovec vectors[], int max)
583583
EVP_PKEY_CTX *pkey_ctx;
584584
int ret = -1;
585585

586-
bio = BIO_new_mem_buf((void *)public_key_.c_str(), public_key_.size());
586+
bio = BIO_new_mem_buf(public_key_.c_str(), public_key_.size());
587587
if (bio)
588588
{
589589
pkey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL);

src/protocol/SSLWrapper.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@
2525
namespace protocol
2626
{
2727

28-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
29-
static inline BIO *__get_wbio(SSL *ssl)
30-
{
31-
BIO *wbio = SSL_get_wbio(ssl);
32-
BIO *next = BIO_next(wbio);
33-
return next ? next : wbio;
34-
}
35-
36-
# define SSL_get_wbio(ssl) __get_wbio(ssl)
37-
#endif
38-
3928
int SSLHandshaker::encode(struct iovec vectors[], int max)
4029
{
4130
BIO *wbio = SSL_get_wbio(this->ssl);

0 commit comments

Comments
 (0)