Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: openssl and gcc-6 fallout



On Fri, Feb 16, 2018 at 05:02:33PM +0100, Thomas Klausner wrote:
> mysql-client-5.5.59 -- haven't looked

I've used https://bugs.mysql.com/bug.php?id=83814 to make patches for
mysql57-*. However, I don't expect they'll work with openssl-1.0.

Attached for those interested.
 Thomas
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/databases/mysql57-client/distinfo,v
retrieving revision 1.17
diff -u -r1.17 distinfo
--- distinfo	16 Jan 2018 16:29:41 -0000	1.17
+++ distinfo	20 Feb 2018 12:57:58 -0000
@@ -20,11 +20,13 @@
 SHA1 (patch-libmysql_CMakeLists.txt) = 306c73384226e07bf2a45af5d92b6f05d6044cbe
 SHA1 (patch-mysql-test_CMakeLists.txt) = 8a8e846792077101a01731c4577c37161f70264d
 SHA1 (patch-mysys__ssl_CMakeLists.txt) = 7ec44642cd13c5477175a94a007354c583ca9c3c
+SHA1 (patch-mysys__ssl_my__aes__openssl.cc) = 1c07f48381b046ebca3e5b99ff20c3a04b0ed83f
 SHA1 (patch-mysys_kqueue__timers.c) = 836803e9c7353b813bc22a5b69cc263dea384c9b
 SHA1 (patch-mysys_my__symlink.c) = 23b57cd5922357d0bc72f5c15100a9fe1f89cfb2
 SHA1 (patch-mysys_stacktrace.c) = 3e0794f544f0e35f44a694330885478247657842
 SHA1 (patch-rapid_plugin_group__replication_libmysqlgcs_src_bindings_xcom_xcom_sock__probe__ix.c) = 1a389fca13ada1be74d96276e11baee16bbc2363
 SHA1 (patch-rapid_plugin_group__replication_libmysqlgcs_src_bindings_xcom_xcom_xcom__memory.c) = 7077900830f904c74c79439b856d9d176fc27f15
+SHA1 (patch-rapid_plugin_group__replication_libmysqlgcs_src_bindings_xcom_xcom_xcom__ssl__transport.c) = 05c3b198a307fc49111d421e45c6fa2f136ec4d3
 SHA1 (patch-rapid_plugin_group__replication_libmysqlgcs_src_bindings_xcom_xcom_xcom__transport.c) = d7f87bff5a41ff6a130fcf74dc520b38cedf5924
 SHA1 (patch-rapid_plugin_group__replication_rpcgen.cmake) = 5c14be97bd1fd04b2b845f1a2422452445733474
 SHA1 (patch-rapid_plugin_x_CMakeLists.txt) = e2cc48b4d325060a105057bda715f4bd2fdab255
@@ -35,6 +37,7 @@
 SHA1 (patch-sql_conn__handler_socket__connection.cc) = 12cf83e061edbe59eb073037b1036903b7ba4b00
 SHA1 (patch-sql_item__geofunc__internal.cc) = 752862c3a30231e694e508ced1a215a610649fc6
 SHA1 (patch-sql_log_event.h) = 311dc7fb04ea832df229dc2a28bcfbf263670ebf
+SHA1 (patch-sql_mysqld.cc) = 959a4fd6567e918b7513f381b4325c5db16107e3
 SHA1 (patch-storage_archive_CMakeLists.txt) = 4cf5ed97a226a3844e184c46958b5202eefb9dd5
 SHA1 (patch-storage_blackhole_CMakeLists.txt) = 1d066d686172657ce9f812a505c7323a76111a63
 SHA1 (patch-storage_csv_CMakeLists.txt) = 6208989a32805f8b107cd9de96e3ff0490ec9000
@@ -45,3 +48,4 @@
 SHA1 (patch-storage_myisammrg_CMakeLists.txt) = e4755536adfb6e837f997061690244da9aa7a6d3
 SHA1 (patch-storage_ndb_mcc_frontend_dojo_dojox_mobile_build_build.sh) = e6939ef781054b4bff006038905e28f7c5cd8d7e
 SHA1 (patch-strings_decimal.c) = 069c9d930c735f74510702baa9bef38aec425903
+SHA1 (patch-vio_viosslfactories.c) = 2af6111aa5ea342e535729cca5e75f373b1314fb
Index: patches/patch-mysys__ssl_my__aes__openssl.cc
===================================================================
RCS file: patches/patch-mysys__ssl_my__aes__openssl.cc
diff -N patches/patch-mysys__ssl_my__aes__openssl.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-mysys__ssl_my__aes__openssl.cc	20 Feb 2018 12:57:59 -0000
@@ -0,0 +1,86 @@
+$NetBSD$
+
+Fix build with openssl-1.1.
+From https://bugs.mysql.com/bug.php?id=83814
+
+--- mysys_ssl/my_aes_openssl.cc.orig	2017-12-28 03:46:26.000000000 +0000
++++ mysys_ssl/my_aes_openssl.cc
+@@ -122,7 +122,7 @@ int my_aes_encrypt(const unsigned char *
+                    enum my_aes_opmode mode, const unsigned char *iv,
+                    bool padding)
+ {
+-  EVP_CIPHER_CTX ctx;
++  EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
+   const EVP_CIPHER *cipher= aes_evp_type(mode);
+   int u_len, f_len;
+   /* The real key to be used for encryption */
+@@ -132,23 +132,23 @@ int my_aes_encrypt(const unsigned char *
+   if (!cipher || (EVP_CIPHER_iv_length(cipher) > 0 && !iv))
+     return MY_AES_BAD_DATA;
+ 
+-  if (!EVP_EncryptInit(&ctx, cipher, rkey, iv))
++  if (!EVP_EncryptInit(ctx, cipher, rkey, iv))
+     goto aes_error;                             /* Error */
+-  if (!EVP_CIPHER_CTX_set_padding(&ctx, padding))
++  if (!EVP_CIPHER_CTX_set_padding(ctx, padding))
+     goto aes_error;                             /* Error */
+-  if (!EVP_EncryptUpdate(&ctx, dest, &u_len, source, source_length))
++  if (!EVP_EncryptUpdate(ctx, dest, &u_len, source, source_length))
+     goto aes_error;                             /* Error */
+ 
+-  if (!EVP_EncryptFinal(&ctx, dest + u_len, &f_len))
++  if (!EVP_EncryptFinal(ctx, dest + u_len, &f_len))
+     goto aes_error;                             /* Error */
+ 
+-  EVP_CIPHER_CTX_cleanup(&ctx);
++  EVP_CIPHER_CTX_free(ctx);
+   return u_len + f_len;
+ 
+ aes_error:
+   /* need to explicitly clean up the error if we want to ignore it */
+   ERR_clear_error();
+-  EVP_CIPHER_CTX_cleanup(&ctx);
++  EVP_CIPHER_CTX_free(ctx);
+   return MY_AES_BAD_DATA;
+ }
+ 
+@@ -159,7 +159,7 @@ int my_aes_decrypt(const unsigned char *
+                    bool padding)
+ {
+ 
+-  EVP_CIPHER_CTX ctx;
++  EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
+   const EVP_CIPHER *cipher= aes_evp_type(mode);
+   int u_len, f_len;
+ 
+@@ -170,24 +170,22 @@ int my_aes_decrypt(const unsigned char *
+   if (!cipher || (EVP_CIPHER_iv_length(cipher) > 0 && !iv))
+     return MY_AES_BAD_DATA;
+ 
+-  EVP_CIPHER_CTX_init(&ctx);
+-
+-  if (!EVP_DecryptInit(&ctx, aes_evp_type(mode), rkey, iv))
++  if (!EVP_DecryptInit(ctx, aes_evp_type(mode), rkey, iv))
+     goto aes_error;                             /* Error */
+-  if (!EVP_CIPHER_CTX_set_padding(&ctx, padding))
++  if (!EVP_CIPHER_CTX_set_padding(ctx, padding))
+     goto aes_error;                             /* Error */
+-  if (!EVP_DecryptUpdate(&ctx, dest, &u_len, source, source_length))
++  if (!EVP_DecryptUpdate(ctx, dest, &u_len, source, source_length))
+     goto aes_error;                             /* Error */
+-  if (!EVP_DecryptFinal_ex(&ctx, dest + u_len, &f_len))
++  if (!EVP_DecryptFinal_ex(ctx, dest + u_len, &f_len))
+     goto aes_error;                             /* Error */
+ 
+-  EVP_CIPHER_CTX_cleanup(&ctx);
++  EVP_CIPHER_CTX_free(ctx);
+   return u_len + f_len;
+ 
+ aes_error:
+   /* need to explicitly clean up the error if we want to ignore it */
+   ERR_clear_error();
+-  EVP_CIPHER_CTX_cleanup(&ctx);
++  EVP_CIPHER_CTX_free(ctx);
+   return MY_AES_BAD_DATA;
+ }
+ 
Index: patches/patch-rapid_plugin_group__replication_libmysqlgcs_src_bindings_xcom_xcom_xcom__ssl__transport.c
===================================================================
RCS file: patches/patch-rapid_plugin_group__replication_libmysqlgcs_src_bindings_xcom_xcom_xcom__ssl__transport.c
diff -N patches/patch-rapid_plugin_group__replication_libmysqlgcs_src_bindings_xcom_xcom_xcom__ssl__transport.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-rapid_plugin_group__replication_libmysqlgcs_src_bindings_xcom_xcom_xcom__ssl__transport.c	20 Feb 2018 12:57:59 -0000
@@ -0,0 +1,48 @@
+$NetBSD$
+
+Fix build with openssl-1.1.
+From https://bugs.mysql.com/bug.php?id=83814
+
+--- rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.c.orig	2017-12-28 03:46:26.000000000 +0000
++++ rapid/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/xcom_ssl_transport.c
+@@ -104,7 +104,7 @@ static const char* tls_cipher_blocked= "
+   mjxx/bg6bOOjpgZapvB6ABWlWmRmAAWFtwIBBQ==
+   -----END DH PARAMETERS-----
+  */
+-static unsigned char dh2048_p[]=
++static unsigned char dhp_2048[]=
+ {
+   0x8A, 0x5D, 0xFA, 0xC0, 0x66, 0x76, 0x4E, 0x61, 0xFA, 0xCA, 0xC0, 0x37,
+   0x57, 0x5C, 0x6D, 0x3F, 0x83, 0x0A, 0xA1, 0xF5, 0xF1, 0xE6, 0x7F, 0x3C,
+@@ -131,20 +131,24 @@ static unsigned char dh2048_p[]=
+ };
+ 
+ 
+-static unsigned char dh2048_g[]={
++static unsigned char dhg_2048[]={
+   0x05,
+ };
+ 
+ static DH *get_dh2048(void)
+ {
+-  DH *dh;
+-  if ((dh=DH_new()))
+-  {
+-    dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
+-    dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
+-    if (! dh->p || ! dh->g)
++  DH *dh = DH_new();
++  BIGNUM *dhp_bn, *dhg_bn;
++  if (dh != NULL)
++  {
++    dhp_bn = BN_bin2bn(dhp_2048, sizeof (dhp_2048), NULL);
++    dhg_bn = BN_bin2bn(dhg_2048, sizeof (dhg_2048), NULL);
++    if (dhp_bn == NULL || dhg_bn == NULL
++        || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) 
+     {
+       DH_free(dh);
++      BN_free(dhp_bn);
++      BN_free(dhg_bn);
+       dh=0;
+     }
+   }
Index: patches/patch-sql_mysqld.cc
===================================================================
RCS file: patches/patch-sql_mysqld.cc
diff -N patches/patch-sql_mysqld.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-sql_mysqld.cc	20 Feb 2018 12:57:59 -0000
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Fix build with openssl-1.1.
+From https://bugs.mysql.com/bug.php?id=83814
+
+--- sql/mysqld.cc.orig	2017-12-28 03:46:26.000000000 +0000
++++ sql/mysqld.cc
+@@ -3398,7 +3398,7 @@ static int init_ssl()
+ {
+ #ifdef HAVE_OPENSSL
+ #ifndef HAVE_YASSL
+-  CRYPTO_malloc_init();
++  OPENSSL_malloc_init();
+ #endif
+   ssl_start();
+ #ifndef EMBEDDED_LIBRARY
Index: patches/patch-vio_viosslfactories.c
===================================================================
RCS file: patches/patch-vio_viosslfactories.c
diff -N patches/patch-vio_viosslfactories.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-vio_viosslfactories.c	20 Feb 2018 12:57:59 -0000
@@ -0,0 +1,48 @@
+$NetBSD$
+
+Fix build with openssl-1.1.
+From https://bugs.mysql.com/bug.php?id=83814
+
+--- vio/viosslfactories.c.orig	2017-12-28 03:46:26.000000000 +0000
++++ vio/viosslfactories.c
+@@ -86,7 +86,7 @@ static my_bool     ssl_initialized      
+   mjxx/bg6bOOjpgZapvB6ABWlWmRmAAWFtwIBBQ==
+   -----END DH PARAMETERS-----
+  */
+-static unsigned char dh2048_p[]=
++static unsigned char dhp_2048[]=
+ {
+   0x8A, 0x5D, 0xFA, 0xC0, 0x66, 0x76, 0x4E, 0x61, 0xFA, 0xCA, 0xC0, 0x37,
+   0x57, 0x5C, 0x6D, 0x3F, 0x83, 0x0A, 0xA1, 0xF5, 0xF1, 0xE6, 0x7F, 0x3C,
+@@ -112,20 +112,25 @@ static unsigned char dh2048_p[]=
+   0x00, 0x05, 0x85, 0xB7,
+ };
+ 
+-static unsigned char dh2048_g[]={
++static unsigned char dhg_2048[]={
+   0x05,
+ };
+ 
+ static DH *get_dh2048(void)
+ {
+-  DH *dh;
+-  if ((dh=DH_new()))
++  DH *dh = DH_new();
++  BIGNUM *dhp_bn, *dhg_bn;
++
++  if (dh != NULL)
+   {
+-    dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
+-    dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
+-    if (! dh->p || ! dh->g)
++    dhp_bn = BN_bin2bn(dhp_2048, sizeof (dhp_2048), NULL);
++    dhg_bn = BN_bin2bn(dhg_2048, sizeof (dhg_2048), NULL);
++    if (dhp_bn == NULL || dhg_bn == NULL
++        || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) 
+     {
+       DH_free(dh);
++      BN_free(dhp_bn);
++      BN_free(dhg_bn);
+       dh=0;
+     }
+   }


Home | Main Index | Thread Index | Old Index