summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2020-06-16 21:01:16 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2020-06-17 08:35:03 +0200
commit9c577c2b9004a3afbff013a03794ffdfff088ed4 (patch)
tree70fc8bcaa782250736b3dfbac2c5ca693a27a940
parenta0d598a4d220fc3845cdee9c8b46ca10b4c1093e (diff)
downloadmariadb-git-9c577c2b9004a3afbff013a03794ffdfff088ed4.tar.gz
MDEV-22917 wolfssl might crash at startup when both SSL and encryption plugin are enabled
Make sure to initialize SSL early enough, when encryption plugins is loaded
-rw-r--r--include/violite.h2
-rw-r--r--sql/encryption.cc3
-rw-r--r--vio/viosslfactories.c4
3 files changed, 7 insertions, 2 deletions
diff --git a/include/violite.h b/include/violite.h
index 34f59f2e598..9a0e995133d 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -171,6 +171,8 @@ struct st_VioSSLFd
int sslaccept(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr);
int sslconnect(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr);
+void vio_check_ssl_init();
+
struct st_VioSSLFd
*new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
const char *ca_file, const char *ca_path,
diff --git a/sql/encryption.cc b/sql/encryption.cc
index fc07623883e..9c38713fdfa 100644
--- a/sql/encryption.cc
+++ b/sql/encryption.cc
@@ -18,6 +18,7 @@
#include "log.h"
#include "sql_plugin.h"
#include <my_crypt.h>
+#include <violite.h>
/* there can be only one encryption plugin enabled */
static plugin_ref encryption_manager= 0;
@@ -63,6 +64,8 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
if (encryption_manager)
return 1;
+ vio_check_ssl_init();
+
if (plugin->plugin->init && plugin->plugin->init(plugin))
{
sql_print_error("Plugin '%s' init function returned error.",
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 4a31ebd1798..80d1e55f358 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -150,7 +150,7 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file,
}
-static void check_ssl_init()
+void vio_check_ssl_init()
{
if (!ssl_algorithms_added)
{
@@ -243,7 +243,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
crl_file ? crl_file : "NULL",
crl_path ? crl_path : "NULL"));
- check_ssl_init();
+ vio_check_ssl_init();
if (!(ssl_fd= ((struct st_VioSSLFd*)
my_malloc(sizeof(struct st_VioSSLFd),MYF(0)))))