diff --git a/include/ssl_compat.h b/include/ssl_compat.h
index 54e80af..8792c9b 100644
--- a/include/ssl_compat.h
+++ b/include/ssl_compat.h
@@ -27,7 +27,7 @@
 #define HAVE_OPENSSL11 1
 #define SSL_LIBRARY OpenSSL_version(OPENSSL_VERSION)
 #define ERR_remove_state(X) ERR_clear_error()
-#define EVP_CIPHER_CTX_SIZE 168
+#define EVP_CIPHER_CTX_SIZE 176
 #define EVP_MD_CTX_SIZE 48
 #undef EVP_MD_CTX_init
 #define EVP_MD_CTX_init(X) do { bzero((X), EVP_MD_CTX_SIZE); EVP_MD_CTX_reset(X); } while(0)
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index 6358b97..fe7a534 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -210,12 +210,18 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
     NOTE: SSL_CTX_set_cipher_list will return 0 if
     none of the provided ciphers could be selected
   */
-  if (cipher &&
-      SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher) == 0)
+  if (cipher)
   {
-    *error= SSL_INITERR_CIPHERS;
-    DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
-    goto err2;
+    if(
+#ifdef TLS1_3_VERSION
+        SSL_CTX_set_ciphersuites(ssl_fd->ssl_context, cipher) == 0 &&
+#endif
+        SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher) == 0)
+    {
+      *error= SSL_INITERR_CIPHERS;
+      DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
+      goto err2;
+    }
   }
 
   /* Load certs from the trusted ca */
