Commit e03f4785 authored by unknown's avatar unknown
Browse files

Bug#19575 MySQL-shared-5.0.21-0.glibc23 causes segfault in SSL_library_init

 - Include prefix files that renames all public functions in yaSSLs
   OpenSSL API to ya<function_name>. They will otherwise conflict
   with OpenSSL functions if loaded by an application that uses OpenSSL
   as well as libmysqlclient with yaSSL support.


client/Makefile.am:
  Remove $yassl_includes
  ...and one "suspicious line"
config/ac-macros/yassl.m4:
  Remove yassl_includes as they are the same as "normal" include
extra/yassl/include/openssl/crypto.h:
  Add include file "prefix_crypto.h" to rename SSL_* functions to yaSSL_*
extra/yassl/include/openssl/ssl.h:
  Add include file "prefix_crypto.h" to rename SSL_* functions to yaSSL_*
libmysql/Makefile.am:
  Remove yassl_includes
libmysql_r/Makefile.am:
  Remove yassl_includes
libmysqld/Makefile.am:
  Remove yassl_includes
  And one suspicious line
libmysqld/examples/Makefile.am:
  Remove yassl_includes
server-tools/instance-manager/Makefile.am:
  Remove yassl_includes
sql/Makefile.am:
  Remove yassl_includes
tools/Makefile.am:
  Add link with yaSSL libs
vio/Makefile.am:
  Remove yassl_includes
extra/yassl/include/openssl/generate_prefix_files.pl:
  Add utility script to parse the header files to generate the prefix_* files that renames yaSSL SSL_* functions
extra/yassl/include/openssl/prefix_crypto.h:
  Add prefix file for crypto.h
extra/yassl/include/openssl/prefix_ssl.h:
  Add prefix file for ssl.h
parent f04b9f24
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ endif
INCLUDES =			-I$(top_builddir)/include \
				-I$(top_srcdir)/include \
				-I$(top_srcdir)/regex \
                                $(openssl_includes) $(yassl_includes) 
                                $(openssl_includes)
LIBS =				@CLIENT_LIBS@
LDADD=				@CLIENT_EXTRA_LDFLAGS@ \
                                $(top_builddir)/libmysql/libmysqlclient.la
+0 −2
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
    AC_MSG_RESULT([using bundled yaSSL])
    yassl_dir="extra/yassl"
    yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
    yassl_includes="-I\$(top_srcdir)/extra/yassl/include"
    AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
    AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
    # System specific checks
@@ -40,7 +39,6 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
    AC_MSG_RESULT(no)
  fi
  AC_SUBST(yassl_libs)
  AC_SUBST(yassl_includes)
  AC_SUBST(yassl_dir)
  AM_CONDITIONAL([HAVE_YASSL], [ test "$with_yassl" = "yes" ])
])
+2 −0
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
#ifndef ysSSL_crypto_h__
#define yaSSL_crypto_h__

#include "prefix_crypto.h"

const char* SSLeay_version(int type);

#define SSLEAY_VERSION 0x0900L
+45 −0
Original line number Diff line number Diff line
#!/usr/bin/perl
#
# This script generates defines for all functions
# in yassl/include/openssl/ so they are renamed to
# ya<old_function_name>. Hopefully that is unique enough.
#
# The script is to be run manually when we import
# a new version of yaSSL
#



# Find all functions in "input" and add macros
# to prefix/rename them into "output
sub generate_prefix($$)
{
  my $input= shift;
  my $output= shift;
  open(IN, $input)
      or die("Can't open input file $input: $!");
  open(OUT, ">", $output)
    or mtr_error("Can't open output file $output: $!");

  while (<IN>)
  {
    chomp;

    if ( /typedef/ )
    {
      next;
    }

    if ( /^\s*[a-zA-Z0-9*_ ]+\s+([_a-zA-Z0-9]+)\s*\(/ )
    {
      print OUT "#define $1 ya$1\n";
    }
  }

  close OUT;
  close IN;
}

generate_prefix("ssl.h", "prefix_ssl.h");
generate_prefix("crypto.h", "prefix_crypto.h");
+1 −0
Original line number Diff line number Diff line
#define SSLeay_version yaSSLeay_version
Loading