diff --git a/include/ssl_compat.h b/include/ssl_compat.h
index b0e3ed4..9249890 100644
--- a/include/ssl_compat.h
+++ b/include/ssl_compat.h
@@ -30,10 +30,19 @@
 #define EVP_CIPHER_CTX_SIZE 168
 #define EVP_MD_CTX_SIZE 48
 #undef EVP_MD_CTX_init
+#undef EVP_CIPHER_CTX_cleanup
+#define EVP_CIPHER_CTX_cleanup EVP_CIPHER_CTX_reset
+#undef X509_get_notBefore
+#define X509_get_notBefore (ASN1_TIME *)X509_get0_notBefore
+#undef X509_get_notAfter
+#define X509_get_notAfter (ASN1_TIME *)X509_get0_notAfter
 #define EVP_MD_CTX_init(X) do { bzero((X), EVP_MD_CTX_SIZE); EVP_MD_CTX_reset(X); } while(0)
 #undef EVP_CIPHER_CTX_init
 #define EVP_CIPHER_CTX_init(X) do { bzero((X), EVP_CIPHER_CTX_SIZE); EVP_CIPHER_CTX_reset(X); } while(0)
-
+#undef SSLEAY_VERSION
+#define SSLEAY_VERSION OPENSSL_VERSION
+#undef SSLeay_version
+#define SSLeay_version(t) OpenSSL_version((t))
 #else
 #define HAVE_OPENSSL10 1
 /*
diff --git a/mysql-test/t/openssl_6975.test b/mysql-test/t/openssl_6975.test
index 6a82d01..5b7436b 100644
--- a/mysql-test/t/openssl_6975.test
+++ b/mysql-test/t/openssl_6975.test
@@ -30,6 +30,7 @@ exec $mysql --user ssl_tls12 --ssl-cipher=TLSv1.2;
 
 echo SSLv3 ciphers: user is ok with any cipher;
 exec $mysql                  --ssl-cipher=AES256-SHA;
+--replace_result ECDHE-RSA-AES256-SHA DHE-RSA-AES256-SHA
 exec $mysql                  --ssl-cipher=SSLv3;
 echo SSLv3 ciphers: user requires SSLv3 cipher AES128-SHA;
 exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA;
diff --git a/mysys_ssl/openssl.c b/mysys_ssl/openssl.c
index 2587c5e..0f5d4b7 100644
--- a/mysys_ssl/openssl.c
+++ b/mysys_ssl/openssl.c
@@ -15,6 +15,11 @@
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 #include <my_global.h>
+
+#ifndef HAVE_YASSL
+#include <openssl/evp.h>
+#endif
+
 #include <ssl_compat.h>
 
 #ifdef HAVE_YASSL
@@ -24,7 +29,6 @@ int check_openssl_compatibility()
   return 0;
 }
 #else
-#include <openssl/evp.h>
 
 #ifdef HAVE_OPENSSL11
 typedef void *(*CRYPTO_malloc_t)(size_t, const char *, int);
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 209b17f..984e543 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -62,6 +62,7 @@
 #include "sql_repl.h"
 #include "opt_range.h"
 #include "rpl_parallel.h"
+#include <ssl_compat.h>
 
 /*
   The rule for this file: everything should be 'static'. When a sys_var
diff --git a/vio/vio.c b/vio/vio.c
index 2c5f37a..003fe5e 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -391,8 +391,10 @@ void vio_end(void)
 #elif defined(HAVE_OPENSSL)
   // This one is needed on the client side
   ERR_remove_state(0);
+#ifndef HAVE_OPENSSL11
   ERR_free_strings();
   EVP_cleanup();
   CRYPTO_cleanup_all_ex_data();
 #endif
+#endif
 }
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 71ef287..5bfd5d5 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -162,7 +162,9 @@ static void check_ssl_init()
   if (!ssl_error_strings_loaded)
   {
     ssl_error_strings_loaded= TRUE;
+#ifndef HAVE_OPENSSL11
     SSL_load_error_strings();
+#endif
   }
 }
 
