From 161d4e269f051232add00a5416eb724f289621a5 Mon Sep 17 00:00:00 2001 From: idk1703 Date: Thu, 30 Nov 2023 12:49:06 +0200 Subject: [PATCH] Move mysql-ext to using mariadb connector --- .gitmodules | 8 + AMBuildScript | 26 - configure.py | 6 - extensions/mysql/AMBuilder | 87 +-- extensions/mysql/mariadb/AMBuilder | 106 +++ extensions/mysql/mariadb/connector | 1 + extensions/mysql/mariadb/include/ma_config.h | 185 +++++ .../mysql/mariadb/include/mariadb_version.h | 54 ++ extensions/mysql/mariadb/include/zconf.h | 547 ++++++++++++++ extensions/mysql/mariadb/ma_client_plugin.c | 511 +++++++++++++ extensions/mysql/msvc15hack.c | 128 ---- extensions/mysql/mysql/MyDriver.h | 2 - extensions/mysql/openssl/AMBuilder | 687 ++++++++++++++++++ extensions/mysql/openssl/include/buildinf.h | 26 + .../mysql/openssl/include/internal/bn_conf.h | 34 + .../mysql/openssl/include/internal/dso_conf.h | 15 + .../openssl/include/openssl/opensslconf.h | 224 ++++++ extensions/mysql/openssl/lib | 1 + tools/checkout-deps.sh | 59 +- 19 files changed, 2446 insertions(+), 261 deletions(-) create mode 100644 extensions/mysql/mariadb/AMBuilder create mode 160000 extensions/mysql/mariadb/connector create mode 100644 extensions/mysql/mariadb/include/ma_config.h create mode 100644 extensions/mysql/mariadb/include/mariadb_version.h create mode 100644 extensions/mysql/mariadb/include/zconf.h create mode 100644 extensions/mysql/mariadb/ma_client_plugin.c delete mode 100644 extensions/mysql/msvc15hack.c create mode 100644 extensions/mysql/openssl/AMBuilder create mode 100644 extensions/mysql/openssl/include/buildinf.h create mode 100644 extensions/mysql/openssl/include/internal/bn_conf.h create mode 100644 extensions/mysql/openssl/include/internal/dso_conf.h create mode 100644 extensions/mysql/openssl/include/openssl/opensslconf.h create mode 160000 extensions/mysql/openssl/lib diff --git a/.gitmodules b/.gitmodules index e799562e2a..0960eef4fc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,3 +6,11 @@ path = sourcepawn url = https://github.com/alliedmodders/sourcepawn shallow = true +[submodule "extensions/mysql/openssl/lib"] + path = extensions/mysql/openssl/lib + url = https://github.com/openssl/openssl + shallow = true +[submodule "extensions/mysql/mariadb/connector"] + path = extensions/mysql/mariadb/connector + url = https://github.com/mariadb-corporation/mariadb-connector-c + shallow = true diff --git a/AMBuildScript b/AMBuildScript index e00bdce74a..2417adbb07 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -121,7 +121,6 @@ class SMConfig(object): self.extensions = [] self.generated_headers = None self.mms_root = None - self.mysql_root = {} self.spcomp = None self.spcomp_bins = [] self.smx_files = {} @@ -215,31 +214,6 @@ class SMConfig(object): raise Exception('Could not find a source copy of Metamod:Source') self.mms_root = Normalize(self.mms_root) - if builder.options.hasMySql: - if 'x86' in self.target_archs: - if builder.options.mysql_path: - self.mysql_root['x86'] = builder.options.mysql_path - else: - for i in range(10): - self.mysql_root['x86'] = ResolveEnvPath('MYSQL55', 'mysql-5.' + str(i)) - if self.mysql_root['x86']: - break - if not self.mysql_root['x86'] or not os.path.isdir(self.mysql_root['x86']): - raise Exception('Could not find a path to MySQL. Configure with --no-mysql to disable it.') - self.mysql_root['x86'] = Normalize(self.mysql_root['x86']) - - if 'x86_64' in self.target_archs: - if builder.options.mysql64_path: - self.mysql_root['x86_64'] = builder.options.mysql64_path - else: - for i in range(10): - self.mysql_root['x86_64'] = ResolveEnvPath('MYSQL55_64', 'mysql-5.' + str(i) + '-x86_64') - if self.mysql_root['x86_64']: - break - if not self.mysql_root['x86_64'] or not os.path.isdir(self.mysql_root['x86_64']): - raise Exception('Could not find a path to 64-bit MySQL!') - self.mysql_root['x86_64'] = Normalize(self.mysql_root['x86_64']) - def configure(self): builder.AddConfigureFile('pushbuild.txt') diff --git a/configure.py b/configure.py index edb6437127..21ccf900ae 100644 --- a/configure.py +++ b/configure.py @@ -21,18 +21,12 @@ parser = run.BuildParser(sourcePath=sys.path[0], api='2.2') parser.options.add_argument('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None, help='Root search folder for HL2SDKs') -parser.options.add_argument('--mysql-path', type=str, dest='mysql_path', default=None, - help='Path to MySQL 5') -parser.options.add_argument('--mysql64-path', type=str, dest='mysql64_path', default=None, - help='Path to 64-bit MySQL 5') parser.options.add_argument('--mms-path', type=str, dest='mms_path', default=None, help='Path to Metamod:Source') parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug', help='Enable debugging symbols') parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt', help='Enable optimization') -parser.options.add_argument('--no-mysql', action='store_false', default=True, dest='hasMySql', - help='Disable building MySQL extension') parser.options.add_argument('-s', '--sdks', default='present', dest='sdks', help='Build against specified SDKs; valid args are "none", "all", "present",' ' or comma-delimited list of engine names') diff --git a/extensions/mysql/AMBuilder b/extensions/mysql/AMBuilder index d017f6847b..e7079607d2 100644 --- a/extensions/mysql/AMBuilder +++ b/extensions/mysql/AMBuilder @@ -1,49 +1,54 @@ # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python: import os -if SM.mysql_root: - for cxx in builder.targets: - arch = cxx.target.arch - binary = SM.ExtLibrary(builder, cxx, 'dbi.mysql.ext') - binary.compiler.cxxincludes += [ - os.path.join(SM.mysql_root[arch], 'include'), - os.path.join(SM.mms_root, 'core', 'sourcehook') - ] - if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang': - binary.compiler.cxxflags += ['-fno-rtti'] - elif binary.compiler.family == 'msvc': - binary.compiler.cxxflags += ['/GR-'] +libmariadb = builder.Build('mariadb/AMBuilder') +libopenssl = {} +if os.name != 'nt': + libopenssl = builder.Build('openssl/AMBuilder') + +for cxx in builder.targets: + arch = cxx.target.arch + binary = SM.ExtLibrary(builder, cxx, 'dbi.mysql.ext') + binary.compiler.cxxincludes += [ + os.path.join(SM.mms_root, 'core', 'sourcehook'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'mariadb', 'include'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'mariadb', 'connector', 'include'), + ] + if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang': + binary.compiler.cxxflags += ['-fno-rtti'] + elif binary.compiler.family == 'msvc': + binary.compiler.cxxflags += ['/GR-'] - if binary.compiler.target.platform == 'linux' or binary.compiler.target.platform == 'mac': - binary.compiler.postlink += [ - os.path.join(SM.mysql_root[arch], 'lib', 'libmysqlclient_r.a'), - '-lz', - '-lpthread', - '-lm', - ] - if binary.compiler.target.platform == 'linux': - binary.compiler.postlink += ['-lrt'] - elif binary.compiler.target.platform == 'windows': - binary.compiler.defines += ['WIN32_LEAN_AND_MEAN'] - binary.compiler.postlink += [ - os.path.join(SM.mysql_root[arch], 'lib', 'mysqlclient.lib'), - 'wsock32.lib' - ] + binary.compiler.postlink += [ + libmariadb[arch].binary, + ] - binary.sources += [ - '../../public/smsdk_ext.cpp', - 'mysql/MyBasicResults.cpp', - 'mysql/MyBoundResults.cpp', - 'mysql/MyDatabase.cpp', - 'mysql/MyDriver.cpp', - 'mysql/MyStatement.cpp', - 'extension.cpp' + if binary.compiler.target.platform == 'linux': + binary.compiler.postlink += [ + '-lz', + '-lpthread', + '-lm', + '-lrt', + libopenssl['ssl-' + arch].binary, + libopenssl['crypto-' + arch].binary, + ] + elif binary.compiler.target.platform == 'windows': + binary.compiler.defines += ['WIN32_LEAN_AND_MEAN'] + binary.compiler.postlink += [ + 'ws2_32.lib', + 'shlwapi.lib', + 'crypt32.lib', + 'secur32.lib', ] - - if binary.compiler.family == 'msvc' and binary.compiler.version >= 1900: - binary.sources += [ 'msvc15hack.c' ] - binary.compiler.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib'] - binary.compiler.defines += ['HAVE_STRUCT_TIMESPEC'] - SM.extensions += [builder.Add(binary)] + binary.sources += [ + '../../public/smsdk_ext.cpp', + 'mysql/MyBasicResults.cpp', + 'mysql/MyBoundResults.cpp', + 'mysql/MyDatabase.cpp', + 'mysql/MyDriver.cpp', + 'mysql/MyStatement.cpp', + 'extension.cpp' + ] + SM.extensions += [builder.Add(binary)] \ No newline at end of file diff --git a/extensions/mysql/mariadb/AMBuilder b/extensions/mysql/mariadb/AMBuilder new file mode 100644 index 0000000000..91ad3a713c --- /dev/null +++ b/extensions/mysql/mariadb/AMBuilder @@ -0,0 +1,106 @@ +# vim: sts=2 ts=8 sw=2 tw=99 et ft=python: +import os, platform + +builder.SetBuildFolder('libmariadb') + +rvalue = {} +for cxx in builder.targets: + binary = SM.StaticLibrary(builder, cxx, 'mariadb') + binary.compiler.includes += [ + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'mariadb', 'include'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'mariadb', 'connector', 'include'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'mariadb', 'connector', 'libmariadb'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'mariadb', 'connector', 'external', 'zlib'), + + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'include'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib', 'include'), + ] + + binary.compiler.defines += [ + 'HAVE_COMPRESS', + 'LIBMARIADB', + 'THREAD', + ] + # Work around mariadb warnings. + if binary.compiler.target.platform == 'linux': + binary.compiler.cflags += [ + '-Wno-shift-count-overflow', + '-Wno-tautological-constant-out-of-range-compare', + ] + + binary.sources += [ + 'connector/plugins/auth/my_auth.c', + 'connector/plugins/auth/old_password.c', + 'connector/plugins/compress/c_zlib.c', + 'connector/plugins/pvio/pvio_socket.c', + 'connector/libmariadb/ma_array.c', + 'connector/libmariadb/ma_charset.c', + 'connector/libmariadb/ma_decimal.c', + 'connector/libmariadb/ma_hashtbl.c', + 'connector/libmariadb/ma_net.c', + 'connector/libmariadb/mariadb_charset.c', + 'connector/libmariadb/ma_time.c', + 'connector/libmariadb/ma_default.c', + 'connector/libmariadb/ma_errmsg.c', + 'connector/libmariadb/mariadb_lib.c', + 'connector/libmariadb/ma_list.c', + 'connector/libmariadb/ma_pvio.c', + 'connector/libmariadb/ma_tls.c', + 'connector/libmariadb/ma_alloc.c', + 'connector/libmariadb/ma_compress.c', + 'connector/libmariadb/ma_init.c', + 'connector/libmariadb/ma_password.c', + 'connector/libmariadb/ma_ll2str.c', + 'connector/libmariadb/ma_sha1.c', + 'connector/libmariadb/mariadb_stmt.c', + 'connector/libmariadb/ma_loaddata.c', + 'connector/libmariadb/ma_stmt_codec.c', + 'connector/libmariadb/ma_string.c', + 'connector/libmariadb/ma_dtoa.c', + 'connector/libmariadb/mariadb_rpl.c', + 'connector/libmariadb/ma_io.c', + 'connector/libmariadb/mariadb_async.c', + 'connector/libmariadb/ma_context.c', + 'ma_client_plugin.c', + ] + + if binary.compiler.target.platform == 'linux': + # TLS + binary.compiler.defines += [ + 'HAVE_OPENSSL', 'HAVE_TLS' + ] + binary.sources += [ + 'connector/libmariadb/secure/openssl.c', + ] + elif binary.compiler.target.platform == 'windows': + binary.compiler.defines += [ + 'HAVE_DLOPEN', + '_CRT_SECURE_NO_WARNINGS', + '_CRT_NONSTDC_NO_DEPRECATE', + 'HAVE_SCHANNEL', 'HAVE_TLS' + ] + binary.sources += [ + 'connector/libmariadb/win32_errmsg.c', + # TLS + 'connector/libmariadb/secure/schannel.c', + 'connector/libmariadb/secure/ma_schannel.c', + 'connector/libmariadb/secure/schannel_certs.c', + # ZLIB + 'connector/external/zlib/adler32.c', + 'connector/external/zlib/compress.c', + 'connector/external/zlib/crc32.c', + 'connector/external/zlib/deflate.c', + 'connector/external/zlib/gzclose.c', + 'connector/external/zlib/gzlib.c', + 'connector/external/zlib/gzread.c', + 'connector/external/zlib/gzwrite.c', + 'connector/external/zlib/infback.c', + 'connector/external/zlib/inffast.c', + 'connector/external/zlib/inflate.c', + 'connector/external/zlib/inftrees.c', + 'connector/external/zlib/trees.c', + 'connector/external/zlib/uncompr.c', + 'connector/external/zlib/zutil.c', + ] + + rvalue[binary.compiler.target.arch] = builder.Add(binary) \ No newline at end of file diff --git a/extensions/mysql/mariadb/connector b/extensions/mysql/mariadb/connector new file mode 160000 index 0000000000..458a4396b4 --- /dev/null +++ b/extensions/mysql/mariadb/connector @@ -0,0 +1 @@ +Subproject commit 458a4396b443dcefedcf464067560078aa09d8b4 diff --git a/extensions/mysql/mariadb/include/ma_config.h b/extensions/mysql/mariadb/include/ma_config.h new file mode 100644 index 0000000000..f72896545a --- /dev/null +++ b/extensions/mysql/mariadb/include/ma_config.h @@ -0,0 +1,185 @@ +/* + * Include file constants (processed in LibmysqlIncludeFiles.txt 1 + */ +/* #undef HAVE_OPENSSL_APPLINK_C */ +#if defined(__linux__) +#define HAVE_ALLOCA_H 1 +#endif +/* #undef HAVE_BIGENDIAN */ +#define HAVE_SETLOCALE 1 +#if defined(__linux__) +#define HAVE_NL_LANGINFO 1 +#define HAVE_DLFCN_H 1 +#endif +#define HAVE_FCNTL_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#if defined(__linux__) +#define HAVE_LINUX_LIMITS_H 1 +#define HAVE_PWD_H 1 +#endif +/* #undef HAVE_SELECT_H */ +#define HAVE_STDDEF_H 1 +#if defined(__linux__) +#define HAVE_STDINT_H 1 +#endif +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#if defined(__linux__) +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_SYS_SOCKET_H 1 +#endif +/* #undef HAVE_SYS_STREAM_H */ +#define HAVE_SYS_STAT_H 1 +/* #undef HAVE_SYS_SYSCTL_H */ +#define HAVE_SYS_TYPES_H 1 +#if defined(__linux__) +#define HAVE_SYS_UN_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UCONTEXT_H 1 +#endif + +/* + * function definitions - processed in LibmysqlFunctions.txt + */ + +/* #undef HAVE_DLERROR */ +/* #undef HAVE_DLOPEN */ +#if defined(__linux__) +#define HAVE_GETPWUID 1 +#define HAVE_POLL 1 +#endif +#define HAVE_MEMCPY 1 +/* #undef HAVE_STRTOK_R */ +#if defined(_WIN32) +#define HAVE_STRTOL 1 +#endif +/* #undef HAVE_STRTOLL */ +#if defined(_WIN32) +#define HAVE_STRTOUL 1 +#endif +/* #undef HAVE_STRTOULL */ +#if defined(_WIN32) +#define HAVE_TELL 1 +#endif +/* #undef HAVE_THR_SETCONCURRENCY */ +/* #undef HAVE_THR_YIELD */ +/* #undef HAVE_VASPRINTF */ +#if defined(_WIN32) +#define HAVE_VSNPRINTF 1 +#endif +#if defined(__linux__) +#define HAVE_CUSERID 1 +#endif + +/* + * types and sizes + */ + + +#define SIZEOF_CHARP 8 +#if defined(SIZEOF_CHARP) +# define HAVE_CHARP 1 +#endif + + +#define SIZEOF_INT 4 +#if defined(SIZEOF_INT) +# define HAVE_INT 1 +#endif + +#if defined(__linux__) +#define SIZEOF_LONG 8 +#elif defined(_WIN32) +#define SIZEOF_LONG 4 +#endif +#if defined(SIZEOF_LONG) +# define HAVE_LONG 1 +#endif + +#define SIZEOF_LONG_LONG 8 +#if defined(SIZEOF_LONG_LONG) +# define HAVE_LONG_LONG 1 +#endif + + +#define SIZEOF_SIZE_T 8 +#if defined(SIZEOF_SIZE_T) +# define HAVE_SIZE_T 1 +#endif + +#if defined(__linux__) +#define SIZEOF_UINT 4 +#endif +#if defined(SIZEOF_UINT) +# define HAVE_UINT 1 +#endif + +#if defined(__linux__) +#define SIZEOF_USHORT 4 +#endif +#if defined(SIZEOF_USHORT) +# define HAVE_USHORT 1 +#endif + +#if defined(__linux__) +#define SIZEOF_ULONG 8 +#endif +#if defined(SIZEOF_ULONG) +# define HAVE_ULONG 1 +#endif + +/* #undef SIZEOF_INT8 */ +#if defined(SIZEOF_INT8) +# define HAVE_INT8 1 +#endif +/* #undef SIZEOF_UINT8 */ +#if defined(SIZEOF_UINT8) +# define HAVE_UINT8 1 +#endif + +/* #undef SIZEOF_INT16 */ +#if defined(SIZEOF_INT16) +# define HAVE_INT16 1 +#endif +/* #undef SIZEOF_UINT16 */ +#if defined(SIZEOF_UINT16) +# define HAVE_UINT16 1 +#endif + +/* #undef SIZEOF_INT32 */ +#if defined(SIZEOF_INT32) +# define HAVE_INT32 1 +#endif +/* #undef SIZEOF_UINT32 */ +#if defined(SIZEOF_UINT32) +# define HAVE_UINT32 1 +#endif + +/* #undef SIZEOF_INT64 */ +#if defined(SIZEOF_INT64) +# define HAVE_INT64 1 +#endif +/* #undef SIZEOF_UINT64 */ +#if defined(SIZEOF_UINT64) +# define HAVE_UINT64 1 +#endif + +/* #undef SIZEOF_SOCKLEN_T */ +#if defined(SIZEOF_SOCKLEN_T) +# define HAVE_SOCKLEN_T 1 +#endif + +#if defined(__linux__) +#define SOCKET_SIZE_TYPE socklen_t +#elif defined(_WIN32) +#define SOCKET_SIZE_TYPE int +#endif + +#define LOCAL_INFILE_MODE_OFF 0 +#define LOCAL_INFILE_MODE_ON 1 +#define LOCAL_INFILE_MODE_AUTO 2 +#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_AUTO + +#define MARIADB_DEFAULT_CHARSET "utf8mb4" \ No newline at end of file diff --git a/extensions/mysql/mariadb/include/mariadb_version.h b/extensions/mysql/mariadb/include/mariadb_version.h new file mode 100644 index 0000000000..44e0aabaa9 --- /dev/null +++ b/extensions/mysql/mariadb/include/mariadb_version.h @@ -0,0 +1,54 @@ +/* Copyright Abandoned 1996, 1999, 2001 MySQL AB + This file is public domain and comes with NO WARRANTY of any kind */ + +/* Version numbers for protocol & mysqld */ + +#ifndef _mariadb_version_h_ +#define _mariadb_version_h_ + +#ifdef _CUSTOMCONFIG_ +#include +#else +#define PROTOCOL_VERSION 10 +#define MARIADB_CLIENT_VERSION_STR "10.8.8" +#define MARIADB_BASE_VERSION "mariadb-10.8" +#define MARIADB_VERSION_ID 100808 +#define MARIADB_PORT 3306 +#define MARIADB_UNIX_ADDR "/tmp/mysql.sock" +#ifndef MYSQL_UNIX_ADDR +#define MYSQL_UNIX_ADDR MARIADB_UNIX_ADDR +#endif +#ifndef MYSQL_PORT +#define MYSQL_PORT MARIADB_PORT +#endif + +#define MYSQL_CONFIG_NAME "my" +#define MYSQL_VERSION_ID 100808 +#define MYSQL_SERVER_VERSION "10.8.8-MariaDB" + +#define MARIADB_PACKAGE_VERSION "3.3.8" +#define MARIADB_PACKAGE_VERSION_ID 30308 +#if defined(__linux__) +#define MARIADB_SYSTEM_TYPE "Linux" +#define MARIADB_PLUGINDIR "/usr/local/lib/mariadb/plugin" +#elif defined(_WIN32) +#define MARIADB_SYSTEM_TYPE "Windows" +#define MARIADB_PLUGINDIR "C:/Program Files (x86)/mariadb-connector-c/lib/mariadb/plugin" +#endif + +#if defined(__x86_64__) || defined(_M_X64) +#define MARIADB_MACHINE_TYPE "x86_64" +#elif defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86) +#define MARIADB_MACHINE_TYPE "x86" +#endif + +/* mysqld compile time options */ +#ifndef MYSQL_CHARSET +#define MYSQL_CHARSET "" +#endif +#endif + +/* Source information */ +#define CC_SOURCE_REVISION "458a4396b443dcefedcf464067560078aa09d8b4" + +#endif /* _mariadb_version_h_ */ \ No newline at end of file diff --git a/extensions/mysql/mariadb/include/zconf.h b/extensions/mysql/mariadb/include/zconf.h new file mode 100644 index 0000000000..e43207d95f --- /dev/null +++ b/extensions/mysql/mariadb/include/zconf.h @@ -0,0 +1,547 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols and init macros */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op +# define crc32_z z_crc32_z +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary +# define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateValidate z_inflateValidate +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# ifndef Z_SOLO +# define uncompress z_uncompress +# define uncompress2 z_uncompress2 +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + +#ifdef Z_SOLO + typedef unsigned long z_size_t; +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +#ifndef Z_ARG /* function prototypes for stdarg */ +# if defined(STDC) || defined(Z_HAVE_STDARG_H) +# define Z_ARG(args) args +# else +# define Z_ARG(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + +#ifdef _WIN32 +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#else +# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# define z_off64_t __int64 +# else +# define z_off64_t z_off_t +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ \ No newline at end of file diff --git a/extensions/mysql/mariadb/ma_client_plugin.c b/extensions/mysql/mariadb/ma_client_plugin.c new file mode 100644 index 0000000000..94f2777754 --- /dev/null +++ b/extensions/mysql/mariadb/ma_client_plugin.c @@ -0,0 +1,511 @@ +/* Copyright (C) 2010 - 2012 Sergei Golubchik and Monty Program Ab + 2015-2016 MariaDB Corporation AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not see + or write to the Free Software Foundation, Inc., + 51 Franklin St., Fifth Floor, Boston, MA 02110, USA */ + +/** + @file + + Support code for the client side (libmariadb) plugins + + Client plugins are somewhat different from server plugins, they are simpler. + + They do not need to be installed or in any way explicitly loaded on the + client, they are loaded automatically on demand. + One client plugin per shared object, soname *must* match the plugin name. + + There is no reference counting and no unloading either. +*/ + +/* Silence warnings about variable 'unused' being used. */ +#define FORCE_INIT_OF_VARS 1 + +#include +#include +#include +#include +#include + +#include "errmsg.h" +#include + +#ifndef WIN32 +#include +#endif + +struct st_client_plugin_int { + struct st_client_plugin_int *next; + void *dlhandle; + struct st_mysql_client_plugin *plugin; +}; + +static my_bool initialized= 0; +static MA_MEM_ROOT mem_root; + +static uint valid_plugins[][2]= { + {MYSQL_CLIENT_AUTHENTICATION_PLUGIN, MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION}, + {MARIADB_CLIENT_PVIO_PLUGIN, MARIADB_CLIENT_PVIO_PLUGIN_INTERFACE_VERSION}, + {MARIADB_CLIENT_TRACE_PLUGIN, MARIADB_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION}, + {MARIADB_CLIENT_REMOTEIO_PLUGIN, MARIADB_CLIENT_REMOTEIO_PLUGIN_INTERFACE_VERSION}, + {MARIADB_CLIENT_CONNECTION_PLUGIN, MARIADB_CLIENT_CONNECTION_PLUGIN_INTERFACE_VERSION}, + {MARIADB_CLIENT_COMPRESSION_PLUGIN, MARIADB_CLIENT_COMPRESSION_PLUGIN_INTERFACE_VERSION}, + {0, 0} +}; + +/* + Loaded plugins are stored in a linked list. + The list is append-only, the elements are added to the head (like in a stack). + The elements are added under a mutex, but the list can be read and traversed + without any mutex because once an element is added to the list, it stays + there. The main purpose of a mutex is to prevent two threads from + loading the same plugin twice in parallel. +*/ + + +struct st_client_plugin_int *plugin_list[MYSQL_CLIENT_MAX_PLUGINS + MARIADB_CLIENT_MAX_PLUGINS]; +#ifdef THREAD +static pthread_mutex_t LOCK_load_client_plugin; +#endif + +extern struct st_mysql_client_plugin mysql_native_password_client_plugin; +extern struct st_mysql_client_plugin mysql_old_password_client_plugin; +extern struct st_mysql_client_plugin zlib_client_plugin; +extern struct st_mysql_client_plugin pvio_socket_client_plugin; + + +struct st_mysql_client_plugin *mysql_client_builtins[]= +{ + (struct st_mysql_client_plugin *)&mysql_native_password_client_plugin, + (struct st_mysql_client_plugin *)&mysql_old_password_client_plugin, + (struct st_mysql_client_plugin *)&zlib_client_plugin, + (struct st_mysql_client_plugin *)&pvio_socket_client_plugin, + + 0 +}; + + +static int is_not_initialized(MYSQL *mysql, const char *name) +{ + if (initialized) + return 0; + + my_set_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD, + SQLSTATE_UNKNOWN, ER(CR_AUTH_PLUGIN_CANNOT_LOAD), + name, "not initialized"); + return 1; +} + +static int get_plugin_nr(uint type) +{ + uint i= 0; + for(; valid_plugins[i][1]; i++) + if (valid_plugins[i][0] == type) + return i; + return -1; +} + +static const char *check_plugin_version(struct st_mysql_client_plugin *plugin, unsigned int version) +{ + if (plugin->interface_version < version || + (plugin->interface_version >> 8) > (version >> 8)) + return "Incompatible client plugin interface"; + return 0; +} + +/** + finds a plugin in the list + + @param name plugin name to search for + @param type plugin type + + @note this does NOT necessarily need a mutex, take care! + + @retval a pointer to a found plugin or 0 +*/ +static struct st_mysql_client_plugin *find_plugin(const char *name, int type) +{ + struct st_client_plugin_int *p; + int plugin_nr= get_plugin_nr(type); + + DBUG_ASSERT(initialized); + if (plugin_nr == -1) + return 0; + + if (!name) + return plugin_list[plugin_nr]->plugin; + + for (p= plugin_list[plugin_nr]; p; p= p->next) + { + if (strcmp(p->plugin->name, name) == 0) + return p->plugin; + } + return NULL; +} + + +/** + verifies the plugin and adds it to the list + + @param mysql MYSQL structure (for error reporting) + @param plugin plugin to install + @param dlhandle a handle to the shared object (returned by dlopen) + or 0 if the plugin was not dynamically loaded + @param argc number of arguments in the 'va_list args' + @param args arguments passed to the plugin initialization function + + @retval a pointer to an installed plugin or 0 +*/ + +static struct st_mysql_client_plugin * +add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle, + int argc, va_list args) +{ + const char *errmsg; + struct st_client_plugin_int plugin_int, *p; + char errbuf[1024]; + int plugin_nr; + + DBUG_ASSERT(initialized); + + plugin_int.plugin= plugin; + plugin_int.dlhandle= dlhandle; + + if ((plugin_nr= get_plugin_nr(plugin->type)) == -1) + { + errmsg= "Unknown client plugin type"; + goto err1; + } + if ((errmsg= check_plugin_version(plugin, valid_plugins[plugin_nr][1]))) + goto err1; + + /* Call the plugin initialization function, if any */ + if (plugin->init && plugin->init(errbuf, sizeof(errbuf), argc, args)) + { + errmsg= errbuf; + goto err1; + } + + p= (struct st_client_plugin_int *) + ma_memdup_root(&mem_root, (char *)&plugin_int, sizeof(plugin_int)); + + if (!p) + { + errmsg= "Out of memory"; + goto err2; + } + + + p->next= plugin_list[plugin_nr]; + plugin_list[plugin_nr]= p; + + return plugin; + +err2: + if (plugin->deinit) + plugin->deinit(); +err1: + my_set_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD, SQLSTATE_UNKNOWN, + ER(CR_AUTH_PLUGIN_CANNOT_LOAD), plugin->name, errmsg); + if (dlhandle) + (void)dlclose(dlhandle); + return NULL; +} + + +/** + Loads plugins which are specified in the environment variable + LIBMYSQL_PLUGINS. + + Multiple plugins must be separated by semicolon. This function doesn't + return or log an error. + + The function is be called by mysql_client_plugin_init + + @todo + Support extended syntax, passing parameters to plugins, for example + LIBMYSQL_PLUGINS="plugin1(param1,param2);plugin2;..." + or + LIBMYSQL_PLUGINS="plugin1=int:param1,str:param2;plugin2;..." +*/ + +static void load_env_plugins(MYSQL *mysql) +{ + char *plugs, *free_env, *s= getenv("LIBMYSQL_PLUGINS"); + + if (ma_check_env_str(s)) + return; + + free_env= strdup(s); + plugs= s= free_env; + + do { + if ((s= strchr(plugs, ';'))) + *s= '\0'; + mysql_load_plugin(mysql, plugs, -1, 0); + plugs= s + 1; + } while (s); + + free(free_env); +} + +/********** extern functions to be used by libmariadb *********************/ + +/** + Initializes the client plugin layer. + + This function must be called before any other client plugin function. + + @retval 0 successful + @retval != 0 error occurred +*/ + +int mysql_client_plugin_init() +{ + MYSQL mysql; + struct st_mysql_client_plugin **builtin; + va_list unused; + LINT_INIT_STRUCT(unused); + + if (initialized) + return 0; + + memset(&mysql, 0, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */ + + pthread_mutex_init(&LOCK_load_client_plugin, NULL); + ma_init_alloc_root(&mem_root, 128, 128); + + memset(&plugin_list, 0, sizeof(plugin_list)); + + initialized= 1; + + pthread_mutex_lock(&LOCK_load_client_plugin); + for (builtin= mysql_client_builtins; *builtin; builtin++) + add_plugin(&mysql, *builtin, 0, 0, unused); + + pthread_mutex_unlock(&LOCK_load_client_plugin); + + load_env_plugins(&mysql); + + return 0; +} + + +/** + Deinitializes the client plugin layer. + + Unloades all client plugins and frees any associated resources. +*/ + +void mysql_client_plugin_deinit() +{ + int i; + struct st_client_plugin_int *p; + + if (!initialized) + return; + + for (i=0; i < MYSQL_CLIENT_MAX_PLUGINS; i++) + for (p= plugin_list[i]; p; p= p->next) + { + if (p->plugin->deinit) + p->plugin->deinit(); + if (p->dlhandle) + (void)dlclose(p->dlhandle); + } + + memset(&plugin_list, 0, sizeof(plugin_list)); + initialized= 0; + ma_free_root(&mem_root, MYF(0)); + pthread_mutex_destroy(&LOCK_load_client_plugin); +} + +/************* public facing functions, for client consumption *********/ + +/* see for a full description */ +struct st_mysql_client_plugin * STDCALL +mysql_client_register_plugin(MYSQL *mysql, + struct st_mysql_client_plugin *plugin) +{ + struct st_mysql_client_plugin *found_plugin= NULL; + va_list unused; + LINT_INIT_STRUCT(unused); + + if (is_not_initialized(mysql, plugin->name)) + return NULL; + + pthread_mutex_lock(&LOCK_load_client_plugin); + + /* make sure the plugin wasn't loaded meanwhile */ + if (!(found_plugin= find_plugin(plugin->name, plugin->type))) + found_plugin= add_plugin(mysql, plugin, 0, 0, unused); + + pthread_mutex_unlock(&LOCK_load_client_plugin); + return found_plugin; +} + + +/* see for a full description */ +struct st_mysql_client_plugin * STDCALL +mysql_load_plugin_v(MYSQL *mysql, const char *name, int type, + int argc, va_list args) +{ + const char *errmsg; +#ifdef _WIN32 + char errbuf[1024]; +#endif + char dlpath[FN_REFLEN+1]; + void *sym, *dlhandle = NULL; + struct st_mysql_client_plugin *plugin; + char *env_plugin_dir= getenv("MARIADB_PLUGIN_DIR"); + + CLEAR_CLIENT_ERROR(mysql); + if (is_not_initialized(mysql, name)) + return NULL; + + pthread_mutex_lock(&LOCK_load_client_plugin); + + /* make sure the plugin wasn't loaded meanwhile */ + if (type >= 0 && find_plugin(name, type)) + { + errmsg= "it is already loaded"; + goto err; + } + + /* Compile dll path */ +#ifndef WIN32 + snprintf(dlpath, sizeof(dlpath) - 1, "%s/%s%s", + mysql->options.extension && mysql->options.extension->plugin_dir ? + mysql->options.extension->plugin_dir : (env_plugin_dir) ? env_plugin_dir : + MARIADB_PLUGINDIR, name, SO_EXT); +#else + { + char *p= (mysql->options.extension && mysql->options.extension->plugin_dir) ? + mysql->options.extension->plugin_dir : env_plugin_dir; + snprintf(dlpath, sizeof(dlpath), "%s%s%s%s", p ? p : "", p ? "\\" : "", name, SO_EXT); + } +#endif + + if (strpbrk(name, "()[]!@#$%^&/*;.,'?\\")) + { + errmsg= "invalid plugin name"; + goto err; + } + + + /* Open new dll handle */ + if (!(dlhandle= dlopen((const char *)dlpath, RTLD_NOW))) + { +#ifdef _WIN32 + char winmsg[255]; + size_t len; + winmsg[0] = 0; + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + winmsg, 255, NULL); + len= strlen(winmsg); + while (len > 0 && (winmsg[len - 1] == '\n' || winmsg[len - 1] == '\r')) + len--; + if (len) + winmsg[len] = 0; + snprintf(errbuf, sizeof(errbuf), "%s Library path is '%s'", winmsg, dlpath); + errmsg= errbuf; +#else + errmsg= dlerror(); +#endif + goto err; + } + + + if (!(sym= dlsym(dlhandle, plugin_declarations_sym))) + { + errmsg= "not a plugin"; + (void)dlclose(dlhandle); + goto err; + } + + plugin= (struct st_mysql_client_plugin*)sym; + + if (type >=0 && type != plugin->type) + { + errmsg= "type mismatch"; + goto err; + } + + if (strcmp(name, plugin->name)) + { + errmsg= "name mismatch"; + goto err; + } + + if (type < 0 && find_plugin(name, plugin->type)) + { + errmsg= "it is already loaded"; + goto err; + } + + plugin= add_plugin(mysql, plugin, dlhandle, argc, args); + + pthread_mutex_unlock(&LOCK_load_client_plugin); + + return plugin; + +err: + if (dlhandle) + dlclose(dlhandle); + pthread_mutex_unlock(&LOCK_load_client_plugin); + my_set_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD, SQLSTATE_UNKNOWN, + ER(CR_AUTH_PLUGIN_CANNOT_LOAD), name, errmsg); + return NULL; +} + + +/* see for a full description */ +struct st_mysql_client_plugin * STDCALL +mysql_load_plugin(MYSQL *mysql, const char *name, int type, int argc, ...) +{ + struct st_mysql_client_plugin *p; + va_list args; + va_start(args, argc); + p= mysql_load_plugin_v(mysql, name, type, argc, args); + va_end(args); + return p; +} + +/* see for a full description */ +struct st_mysql_client_plugin * STDCALL +mysql_client_find_plugin(MYSQL *mysql, const char *name, int type) +{ + struct st_mysql_client_plugin *p; + int plugin_nr= get_plugin_nr(type); + + if (is_not_initialized(mysql, name)) + return NULL; + + if (plugin_nr == -1) + { + my_set_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD, SQLSTATE_UNKNOWN, + ER(CR_AUTH_PLUGIN_CANNOT_LOAD), name, "invalid type"); + } + + if ((p= find_plugin(name, type))) + return p; + + /* not found, load it */ + return mysql_load_plugin(mysql, name, type, 0); +} + diff --git a/extensions/mysql/msvc15hack.c b/extensions/mysql/msvc15hack.c deleted file mode 100644 index ed4f1fb09d..0000000000 --- a/extensions/mysql/msvc15hack.c +++ /dev/null @@ -1,128 +0,0 @@ - -#include -#include -#include -#include - -// Fix from from https://stackoverflow.com/a/34655235. -// -// __iob_func required by the MySQL we use, -// but no longer exists in the VS 14.0+ crt. - -#pragma intrinsic(_ReturnAddress) - -FILE * __cdecl __iob_func(void) -{ - unsigned char const * assembly = (unsigned char const *)_ReturnAddress(); - if (!assembly) - { - return NULL; - } - - if (*assembly == 0x83 && *(assembly + 1) == 0xC0 && (*(assembly + 2) == 0x20 || *(assembly + 2) == 0x40)) - { - if (*(assembly + 2) == 32) - { - return (FILE*)((unsigned char *)stdout - 32); - } - if (*(assembly + 2) == 64) - { - return (FILE*)((unsigned char *)stderr - 64); - } - } - - return stdin; -} - -// Adapted from dosmap.c in Visual Studio 12.0 CRT sources. -// -// The _dosmaperr function is required by the MySQL lib we use, -// but no longer exists in the VS 14.0+ crt. - -static struct errentry -{ - DWORD oscode; // OS return value - int errnocode; // System V error code - -} errtable[] = -{ - { ERROR_INVALID_FUNCTION, EINVAL }, /* 1 */ - { ERROR_FILE_NOT_FOUND, ENOENT }, /* 2 */ - { ERROR_PATH_NOT_FOUND, ENOENT }, /* 3 */ - { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, /* 4 */ - { ERROR_ACCESS_DENIED, EACCES }, /* 5 */ - { ERROR_INVALID_HANDLE, EBADF }, /* 6 */ - { ERROR_ARENA_TRASHED, ENOMEM }, /* 7 */ - { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, /* 8 */ - { ERROR_INVALID_BLOCK, ENOMEM }, /* 9 */ - { ERROR_BAD_ENVIRONMENT, E2BIG }, /* 10 */ - { ERROR_BAD_FORMAT, ENOEXEC }, /* 11 */ - { ERROR_INVALID_ACCESS, EINVAL }, /* 12 */ - { ERROR_INVALID_DATA, EINVAL }, /* 13 */ - { ERROR_INVALID_DRIVE, ENOENT }, /* 15 */ - { ERROR_CURRENT_DIRECTORY, EACCES }, /* 16 */ - { ERROR_NOT_SAME_DEVICE, EXDEV }, /* 17 */ - { ERROR_NO_MORE_FILES, ENOENT }, /* 18 */ - { ERROR_LOCK_VIOLATION, EACCES }, /* 33 */ - { ERROR_BAD_NETPATH, ENOENT }, /* 53 */ - { ERROR_NETWORK_ACCESS_DENIED, EACCES }, /* 65 */ - { ERROR_BAD_NET_NAME, ENOENT }, /* 67 */ - { ERROR_FILE_EXISTS, EEXIST }, /* 80 */ - { ERROR_CANNOT_MAKE, EACCES }, /* 82 */ - { ERROR_FAIL_I24, EACCES }, /* 83 */ - { ERROR_INVALID_PARAMETER, EINVAL }, /* 87 */ - { ERROR_NO_PROC_SLOTS, EAGAIN }, /* 89 */ - { ERROR_DRIVE_LOCKED, EACCES }, /* 108 */ - { ERROR_BROKEN_PIPE, EPIPE }, /* 109 */ - { ERROR_DISK_FULL, ENOSPC }, /* 112 */ - { ERROR_INVALID_TARGET_HANDLE, EBADF }, /* 114 */ - { ERROR_INVALID_HANDLE, EINVAL }, /* 124 */ - { ERROR_WAIT_NO_CHILDREN, ECHILD }, /* 128 */ - { ERROR_CHILD_NOT_COMPLETE, ECHILD }, /* 129 */ - { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, /* 130 */ - { ERROR_NEGATIVE_SEEK, EINVAL }, /* 131 */ - { ERROR_SEEK_ON_DEVICE, EACCES }, /* 132 */ - { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, /* 145 */ - { ERROR_NOT_LOCKED, EACCES }, /* 158 */ - { ERROR_BAD_PATHNAME, ENOENT }, /* 161 */ - { ERROR_MAX_THRDS_REACHED, EAGAIN }, /* 164 */ - { ERROR_LOCK_FAILED, EACCES }, /* 167 */ - { ERROR_ALREADY_EXISTS, EEXIST }, /* 183 */ - { ERROR_FILENAME_EXCED_RANGE, ENOENT }, /* 206 */ - { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, /* 215 */ - { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } /* 1816 */ -}; - -// The following two constants must be the minimum and maximum -// values in the (contiguous) range of Exec Failure errors. -#define MIN_EXEC_ERROR ERROR_INVALID_STARTING_CODESEG -#define MAX_EXEC_ERROR ERROR_INFLOOP_IN_RELOC_CHAIN - -// These are the low and high value in the range of errors that are -// access violations -#define MIN_EACCES_RANGE ERROR_WRITE_PROTECT -#define MAX_EACCES_RANGE ERROR_SHARING_BUFFER_EXCEEDED - -void _dosmaperr(DWORD oserrno) -{ - _doserrno = oserrno; - - // Check the table for the OS error code - for (size_t i = 0; i < _countof(errtable); ++i) - { - if (oserrno == errtable[i].oscode) - { - errno = errtable[i].errnocode; - } - } - - // The error code wasn't in the table. We check for a range of - // EACCES errors or exec failure errors (ENOEXEC). Otherwise - // EINVAL is returned. - if (oserrno >= MIN_EACCES_RANGE && oserrno <= MAX_EACCES_RANGE) - errno = EACCES; - else if (oserrno >= MIN_EXEC_ERROR && oserrno <= MAX_EXEC_ERROR) - errno = ENOEXEC; - else - errno = EINVAL; -} diff --git a/extensions/mysql/mysql/MyDriver.h b/extensions/mysql/mysql/MyDriver.h index 86c9dfa603..4cc0d4c4e0 100644 --- a/extensions/mysql/mysql/MyDriver.h +++ b/extensions/mysql/mysql/MyDriver.h @@ -39,8 +39,6 @@ #include #endif -#include -#include #include // On macOS, the MySQL includes define min/max. diff --git a/extensions/mysql/openssl/AMBuilder b/extensions/mysql/openssl/AMBuilder new file mode 100644 index 0000000000..0ad69fc23d --- /dev/null +++ b/extensions/mysql/openssl/AMBuilder @@ -0,0 +1,687 @@ +# vim: sts=2 ts=8 sw=2 tw=99 et ft=python: +import os + +builder.SetBuildFolder('openssl') + +rvalue = {} +for cxx in builder.targets: + crypto = SM.StaticLibrary(builder, cxx, 'crypto') + crypto.compiler.includes = [ + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'include'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib', 'include'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib', 'crypto', 'include'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib', 'crypto', 'modes'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib', 'crypto', 'ec', 'curve448'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib', 'crypto', 'ec', 'curve448', 'arch_32'), + ] + + crypto.compiler.defines += [ + 'OPENSSL_USE_NODELETE', + 'OPENSSLDIR="/usr/local/ssl"', + 'ENGINESDIR="/usr/local/lib/engines-1.1"', + ] + + crypto.sources += [ + 'lib/crypto/aes/aes_cbc.c', + 'lib/crypto/aes/aes_cfb.c', + 'lib/crypto/aes/aes_core.c', + 'lib/crypto/aes/aes_ecb.c', + 'lib/crypto/aes/aes_ige.c', + 'lib/crypto/aes/aes_misc.c', + 'lib/crypto/aes/aes_ofb.c', + 'lib/crypto/aes/aes_wrap.c', + 'lib/crypto/aria/aria.c', + 'lib/crypto/asn1/a_bitstr.c', + 'lib/crypto/asn1/a_d2i_fp.c', + 'lib/crypto/asn1/a_digest.c', + 'lib/crypto/asn1/a_dup.c', + 'lib/crypto/asn1/a_gentm.c', + 'lib/crypto/asn1/a_i2d_fp.c', + 'lib/crypto/asn1/a_int.c', + 'lib/crypto/asn1/a_mbstr.c', + 'lib/crypto/asn1/a_object.c', + 'lib/crypto/asn1/a_octet.c', + 'lib/crypto/asn1/a_print.c', + 'lib/crypto/asn1/a_sign.c', + 'lib/crypto/asn1/a_strex.c', + 'lib/crypto/asn1/a_strnid.c', + 'lib/crypto/asn1/a_time.c', + 'lib/crypto/asn1/a_type.c', + 'lib/crypto/asn1/a_utctm.c', + 'lib/crypto/asn1/a_utf8.c', + 'lib/crypto/asn1/a_verify.c', + 'lib/crypto/asn1/ameth_lib.c', + 'lib/crypto/asn1/asn1_err.c', + 'lib/crypto/asn1/asn1_gen.c', + 'lib/crypto/asn1/asn1_item_list.c', + 'lib/crypto/asn1/asn1_lib.c', + 'lib/crypto/asn1/asn1_par.c', + 'lib/crypto/asn1/asn_mime.c', + 'lib/crypto/asn1/asn_moid.c', + 'lib/crypto/asn1/asn_mstbl.c', + 'lib/crypto/asn1/asn_pack.c', + 'lib/crypto/asn1/bio_asn1.c', + 'lib/crypto/asn1/bio_ndef.c', + 'lib/crypto/asn1/d2i_pr.c', + 'lib/crypto/asn1/d2i_pu.c', + 'lib/crypto/asn1/evp_asn1.c', + 'lib/crypto/asn1/f_int.c', + 'lib/crypto/asn1/f_string.c', + 'lib/crypto/asn1/i2d_pr.c', + 'lib/crypto/asn1/i2d_pu.c', + 'lib/crypto/asn1/n_pkey.c', + 'lib/crypto/asn1/nsseq.c', + 'lib/crypto/asn1/p5_pbe.c', + 'lib/crypto/asn1/p5_pbev2.c', + 'lib/crypto/asn1/p5_scrypt.c', + 'lib/crypto/asn1/p8_pkey.c', + 'lib/crypto/asn1/t_bitst.c', + 'lib/crypto/asn1/t_pkey.c', + 'lib/crypto/asn1/t_spki.c', + 'lib/crypto/asn1/tasn_dec.c', + 'lib/crypto/asn1/tasn_enc.c', + 'lib/crypto/asn1/tasn_fre.c', + 'lib/crypto/asn1/tasn_new.c', + 'lib/crypto/asn1/tasn_prn.c', + 'lib/crypto/asn1/tasn_scn.c', + 'lib/crypto/asn1/tasn_typ.c', + 'lib/crypto/asn1/tasn_utl.c', + 'lib/crypto/asn1/x_algor.c', + 'lib/crypto/asn1/x_bignum.c', + 'lib/crypto/asn1/x_info.c', + 'lib/crypto/asn1/x_int64.c', + 'lib/crypto/asn1/x_long.c', + 'lib/crypto/asn1/x_pkey.c', + 'lib/crypto/asn1/x_sig.c', + 'lib/crypto/asn1/x_spki.c', + 'lib/crypto/asn1/x_val.c', + 'lib/crypto/async/arch/async_null.c', + 'lib/crypto/async/arch/async_posix.c', + 'lib/crypto/async/arch/async_win.c', + 'lib/crypto/async/async.c', + 'lib/crypto/async/async_err.c', + 'lib/crypto/async/async_wait.c', + 'lib/crypto/bf/bf_cfb64.c', + 'lib/crypto/bf/bf_ecb.c', + 'lib/crypto/bf/bf_enc.c', + 'lib/crypto/bf/bf_ofb64.c', + 'lib/crypto/bf/bf_skey.c', + 'lib/crypto/bio/b_addr.c', + 'lib/crypto/bio/b_dump.c', + 'lib/crypto/bio/b_print.c', + 'lib/crypto/bio/b_sock.c', + 'lib/crypto/bio/b_sock2.c', + 'lib/crypto/bio/bf_buff.c', + 'lib/crypto/bio/bf_lbuf.c', + 'lib/crypto/bio/bf_nbio.c', + 'lib/crypto/bio/bf_null.c', + 'lib/crypto/bio/bio_cb.c', + 'lib/crypto/bio/bio_err.c', + 'lib/crypto/bio/bio_lib.c', + 'lib/crypto/bio/bio_meth.c', + 'lib/crypto/bio/bss_acpt.c', + 'lib/crypto/bio/bss_bio.c', + 'lib/crypto/bio/bss_conn.c', + 'lib/crypto/bio/bss_dgram.c', + 'lib/crypto/bio/bss_fd.c', + 'lib/crypto/bio/bss_file.c', + 'lib/crypto/bio/bss_log.c', + 'lib/crypto/bio/bss_mem.c', + 'lib/crypto/bio/bss_null.c', + 'lib/crypto/bio/bss_sock.c', + 'lib/crypto/blake2/blake2b.c', + 'lib/crypto/blake2/blake2s.c', + 'lib/crypto/blake2/m_blake2b.c', + 'lib/crypto/blake2/m_blake2s.c', + 'lib/crypto/bn/bn_add.c', + 'lib/crypto/bn/bn_asm.c', + 'lib/crypto/bn/bn_blind.c', + 'lib/crypto/bn/bn_const.c', + 'lib/crypto/bn/bn_ctx.c', + 'lib/crypto/bn/bn_depr.c', + 'lib/crypto/bn/bn_dh.c', + 'lib/crypto/bn/bn_div.c', + 'lib/crypto/bn/bn_err.c', + 'lib/crypto/bn/bn_exp.c', + 'lib/crypto/bn/bn_exp2.c', + 'lib/crypto/bn/bn_gcd.c', + 'lib/crypto/bn/bn_gf2m.c', + 'lib/crypto/bn/bn_intern.c', + 'lib/crypto/bn/bn_kron.c', + 'lib/crypto/bn/bn_lib.c', + 'lib/crypto/bn/bn_mod.c', + 'lib/crypto/bn/bn_mont.c', + 'lib/crypto/bn/bn_mpi.c', + 'lib/crypto/bn/bn_mul.c', + 'lib/crypto/bn/bn_nist.c', + 'lib/crypto/bn/bn_prime.c', + 'lib/crypto/bn/bn_print.c', + 'lib/crypto/bn/bn_rand.c', + 'lib/crypto/bn/bn_recp.c', + 'lib/crypto/bn/bn_shift.c', + 'lib/crypto/bn/bn_sqr.c', + 'lib/crypto/bn/bn_sqrt.c', + 'lib/crypto/bn/bn_srp.c', + 'lib/crypto/bn/bn_word.c', + 'lib/crypto/bn/bn_x931p.c', + 'lib/crypto/buffer/buf_err.c', + 'lib/crypto/buffer/buffer.c', + 'lib/crypto/camellia/camellia.c', + 'lib/crypto/camellia/cmll_cbc.c', + 'lib/crypto/camellia/cmll_cfb.c', + 'lib/crypto/camellia/cmll_ctr.c', + 'lib/crypto/camellia/cmll_ecb.c', + 'lib/crypto/camellia/cmll_misc.c', + 'lib/crypto/camellia/cmll_ofb.c', + 'lib/crypto/cast/c_cfb64.c', + 'lib/crypto/cast/c_ecb.c', + 'lib/crypto/cast/c_enc.c', + 'lib/crypto/cast/c_ofb64.c', + 'lib/crypto/cast/c_skey.c', + 'lib/crypto/chacha/chacha_enc.c', + 'lib/crypto/cmac/cm_ameth.c', + 'lib/crypto/cmac/cm_pmeth.c', + 'lib/crypto/cmac/cmac.c', + 'lib/crypto/cms/cms_asn1.c', + 'lib/crypto/cms/cms_att.c', + 'lib/crypto/cms/cms_cd.c', + 'lib/crypto/cms/cms_dd.c', + 'lib/crypto/cms/cms_enc.c', + 'lib/crypto/cms/cms_env.c', + 'lib/crypto/cms/cms_err.c', + 'lib/crypto/cms/cms_ess.c', + 'lib/crypto/cms/cms_io.c', + 'lib/crypto/cms/cms_kari.c', + 'lib/crypto/cms/cms_lib.c', + 'lib/crypto/cms/cms_pwri.c', + 'lib/crypto/cms/cms_sd.c', + 'lib/crypto/cms/cms_smime.c', + 'lib/crypto/conf/conf_api.c', + 'lib/crypto/conf/conf_def.c', + 'lib/crypto/conf/conf_err.c', + 'lib/crypto/conf/conf_lib.c', + 'lib/crypto/conf/conf_mall.c', + 'lib/crypto/conf/conf_mod.c', + 'lib/crypto/conf/conf_sap.c', + 'lib/crypto/conf/conf_ssl.c', + 'lib/crypto/cpt_err.c', + 'lib/crypto/cryptlib.c', + 'lib/crypto/ctype.c', + 'lib/crypto/cversion.c', + 'lib/crypto/des/cbc_cksm.c', + 'lib/crypto/des/cbc_enc.c', + 'lib/crypto/des/cfb64ede.c', + 'lib/crypto/des/cfb64enc.c', + 'lib/crypto/des/cfb_enc.c', + 'lib/crypto/des/des_enc.c', + 'lib/crypto/des/ecb3_enc.c', + 'lib/crypto/des/ecb_enc.c', + 'lib/crypto/des/fcrypt.c', + 'lib/crypto/des/fcrypt_b.c', + 'lib/crypto/des/ofb64ede.c', + 'lib/crypto/des/ofb64enc.c', + 'lib/crypto/des/ofb_enc.c', + 'lib/crypto/des/pcbc_enc.c', + 'lib/crypto/des/qud_cksm.c', + 'lib/crypto/des/rand_key.c', + 'lib/crypto/des/set_key.c', + 'lib/crypto/des/str2key.c', + 'lib/crypto/des/xcbc_enc.c', + 'lib/crypto/dh/dh_ameth.c', + 'lib/crypto/dh/dh_asn1.c', + 'lib/crypto/dh/dh_check.c', + 'lib/crypto/dh/dh_depr.c', + 'lib/crypto/dh/dh_err.c', + 'lib/crypto/dh/dh_gen.c', + 'lib/crypto/dh/dh_kdf.c', + 'lib/crypto/dh/dh_key.c', + 'lib/crypto/dh/dh_lib.c', + 'lib/crypto/dh/dh_meth.c', + 'lib/crypto/dh/dh_pmeth.c', + 'lib/crypto/dh/dh_prn.c', + 'lib/crypto/dh/dh_rfc5114.c', + 'lib/crypto/dh/dh_rfc7919.c', + 'lib/crypto/dsa/dsa_ameth.c', + 'lib/crypto/dsa/dsa_asn1.c', + 'lib/crypto/dsa/dsa_depr.c', + 'lib/crypto/dsa/dsa_err.c', + 'lib/crypto/dsa/dsa_gen.c', + 'lib/crypto/dsa/dsa_key.c', + 'lib/crypto/dsa/dsa_lib.c', + 'lib/crypto/dsa/dsa_meth.c', + 'lib/crypto/dsa/dsa_ossl.c', + 'lib/crypto/dsa/dsa_pmeth.c', + 'lib/crypto/dsa/dsa_prn.c', + 'lib/crypto/dsa/dsa_sign.c', + 'lib/crypto/dsa/dsa_vrf.c', + 'lib/crypto/dso/dso_dl.c', + 'lib/crypto/dso/dso_dlfcn.c', + 'lib/crypto/dso/dso_err.c', + 'lib/crypto/dso/dso_lib.c', + 'lib/crypto/dso/dso_openssl.c', + 'lib/crypto/dso/dso_vms.c', + 'lib/crypto/dso/dso_win32.c', + 'lib/crypto/ebcdic.c', + 'lib/crypto/ec/curve25519.c', + 'lib/crypto/ec/curve448/arch_32/f_impl.c', + 'lib/crypto/ec/curve448/curve448.c', + 'lib/crypto/ec/curve448/curve448_tables.c', + 'lib/crypto/ec/curve448/eddsa.c', + 'lib/crypto/ec/curve448/f_generic.c', + 'lib/crypto/ec/curve448/scalar.c', + 'lib/crypto/ec/ec2_oct.c', + 'lib/crypto/ec/ec2_smpl.c', + 'lib/crypto/ec/ec_ameth.c', + 'lib/crypto/ec/ec_asn1.c', + 'lib/crypto/ec/ec_check.c', + 'lib/crypto/ec/ec_curve.c', + 'lib/crypto/ec/ec_cvt.c', + 'lib/crypto/ec/ec_err.c', + 'lib/crypto/ec/ec_key.c', + 'lib/crypto/ec/ec_kmeth.c', + 'lib/crypto/ec/ec_lib.c', + 'lib/crypto/ec/ec_mult.c', + 'lib/crypto/ec/ec_oct.c', + 'lib/crypto/ec/ec_pmeth.c', + 'lib/crypto/ec/ec_print.c', + 'lib/crypto/ec/ecdh_kdf.c', + 'lib/crypto/ec/ecdh_ossl.c', + 'lib/crypto/ec/ecdsa_ossl.c', + 'lib/crypto/ec/ecdsa_sign.c', + 'lib/crypto/ec/ecdsa_vrf.c', + 'lib/crypto/ec/eck_prn.c', + 'lib/crypto/ec/ecp_mont.c', + 'lib/crypto/ec/ecp_nist.c', + 'lib/crypto/ec/ecp_nistp224.c', + 'lib/crypto/ec/ecp_nistp256.c', + 'lib/crypto/ec/ecp_nistp521.c', + 'lib/crypto/ec/ecp_nistputil.c', + 'lib/crypto/ec/ecp_oct.c', + 'lib/crypto/ec/ecp_smpl.c', + 'lib/crypto/ec/ecx_meth.c', + 'lib/crypto/err/err.c', + 'lib/crypto/err/err_all.c', + 'lib/crypto/err/err_prn.c', + 'lib/crypto/evp/bio_b64.c', + 'lib/crypto/evp/bio_enc.c', + 'lib/crypto/evp/bio_md.c', + 'lib/crypto/evp/bio_ok.c', + 'lib/crypto/evp/c_allc.c', + 'lib/crypto/evp/c_alld.c', + 'lib/crypto/evp/cmeth_lib.c', + 'lib/crypto/evp/digest.c', + 'lib/crypto/evp/e_aes.c', + 'lib/crypto/evp/e_aes_cbc_hmac_sha1.c', + 'lib/crypto/evp/e_aes_cbc_hmac_sha256.c', + 'lib/crypto/evp/e_aria.c', + 'lib/crypto/evp/e_bf.c', + 'lib/crypto/evp/e_camellia.c', + 'lib/crypto/evp/e_cast.c', + 'lib/crypto/evp/e_chacha20_poly1305.c', + 'lib/crypto/evp/e_des.c', + 'lib/crypto/evp/e_des3.c', + 'lib/crypto/evp/e_idea.c', + 'lib/crypto/evp/e_null.c', + 'lib/crypto/evp/e_old.c', + 'lib/crypto/evp/e_rc2.c', + 'lib/crypto/evp/e_rc4.c', + 'lib/crypto/evp/e_rc4_hmac_md5.c', + 'lib/crypto/evp/e_rc5.c', + 'lib/crypto/evp/e_seed.c', + 'lib/crypto/evp/e_sm4.c', + 'lib/crypto/evp/e_xcbc_d.c', + 'lib/crypto/evp/encode.c', + 'lib/crypto/evp/evp_cnf.c', + 'lib/crypto/evp/evp_enc.c', + 'lib/crypto/evp/evp_err.c', + 'lib/crypto/evp/evp_key.c', + 'lib/crypto/evp/evp_lib.c', + 'lib/crypto/evp/evp_pbe.c', + 'lib/crypto/evp/evp_pkey.c', + 'lib/crypto/evp/m_md2.c', + 'lib/crypto/evp/m_md4.c', + 'lib/crypto/evp/m_md5.c', + 'lib/crypto/evp/m_md5_sha1.c', + 'lib/crypto/evp/m_mdc2.c', + 'lib/crypto/evp/m_null.c', + 'lib/crypto/evp/m_ripemd.c', + 'lib/crypto/evp/m_sha1.c', + 'lib/crypto/evp/m_sha3.c', + 'lib/crypto/evp/m_sigver.c', + 'lib/crypto/evp/m_wp.c', + 'lib/crypto/evp/names.c', + 'lib/crypto/evp/p5_crpt.c', + 'lib/crypto/evp/p5_crpt2.c', + 'lib/crypto/evp/p_dec.c', + 'lib/crypto/evp/p_enc.c', + 'lib/crypto/evp/p_lib.c', + 'lib/crypto/evp/p_open.c', + 'lib/crypto/evp/p_seal.c', + 'lib/crypto/evp/p_sign.c', + 'lib/crypto/evp/p_verify.c', + 'lib/crypto/evp/pbe_scrypt.c', + 'lib/crypto/evp/pmeth_fn.c', + 'lib/crypto/evp/pmeth_gn.c', + 'lib/crypto/evp/pmeth_lib.c', + 'lib/crypto/ex_data.c', + 'lib/crypto/hmac/hm_ameth.c', + 'lib/crypto/hmac/hm_pmeth.c', + 'lib/crypto/hmac/hmac.c', + 'lib/crypto/idea/i_cbc.c', + 'lib/crypto/idea/i_cfb64.c', + 'lib/crypto/idea/i_ecb.c', + 'lib/crypto/idea/i_ofb64.c', + 'lib/crypto/idea/i_skey.c', + 'lib/crypto/init.c', + 'lib/crypto/kdf/hkdf.c', + 'lib/crypto/kdf/kdf_err.c', + 'lib/crypto/kdf/scrypt.c', + 'lib/crypto/kdf/tls1_prf.c', + 'lib/crypto/lhash/lh_stats.c', + 'lib/crypto/lhash/lhash.c', + 'lib/crypto/md4/md4_dgst.c', + 'lib/crypto/md4/md4_one.c', + 'lib/crypto/md5/md5_dgst.c', + 'lib/crypto/md5/md5_one.c', + 'lib/crypto/mdc2/mdc2_one.c', + 'lib/crypto/mdc2/mdc2dgst.c', + 'lib/crypto/mem.c', + 'lib/crypto/mem_clr.c', + 'lib/crypto/mem_dbg.c', + 'lib/crypto/mem_sec.c', + 'lib/crypto/modes/cbc128.c', + 'lib/crypto/modes/ccm128.c', + 'lib/crypto/modes/cfb128.c', + 'lib/crypto/modes/ctr128.c', + 'lib/crypto/modes/cts128.c', + 'lib/crypto/modes/gcm128.c', + 'lib/crypto/modes/ocb128.c', + 'lib/crypto/modes/ofb128.c', + 'lib/crypto/modes/wrap128.c', + 'lib/crypto/modes/xts128.c', + 'lib/crypto/o_dir.c', + 'lib/crypto/o_fips.c', + 'lib/crypto/o_fopen.c', + 'lib/crypto/o_init.c', + 'lib/crypto/o_str.c', + 'lib/crypto/o_time.c', + 'lib/crypto/objects/o_names.c', + 'lib/crypto/objects/obj_dat.c', + 'lib/crypto/objects/obj_err.c', + 'lib/crypto/objects/obj_lib.c', + 'lib/crypto/objects/obj_xref.c', + 'lib/crypto/ocsp/ocsp_asn.c', + 'lib/crypto/ocsp/ocsp_cl.c', + 'lib/crypto/ocsp/ocsp_err.c', + 'lib/crypto/ocsp/ocsp_ext.c', + 'lib/crypto/ocsp/ocsp_ht.c', + 'lib/crypto/ocsp/ocsp_lib.c', + 'lib/crypto/ocsp/ocsp_prn.c', + 'lib/crypto/ocsp/ocsp_srv.c', + 'lib/crypto/ocsp/ocsp_vfy.c', + 'lib/crypto/ocsp/v3_ocsp.c', + 'lib/crypto/pem/pem_all.c', + 'lib/crypto/pem/pem_err.c', + 'lib/crypto/pem/pem_info.c', + 'lib/crypto/pem/pem_lib.c', + 'lib/crypto/pem/pem_oth.c', + 'lib/crypto/pem/pem_pk8.c', + 'lib/crypto/pem/pem_pkey.c', + 'lib/crypto/pem/pem_sign.c', + 'lib/crypto/pem/pem_x509.c', + 'lib/crypto/pem/pem_xaux.c', + 'lib/crypto/pem/pvkfmt.c', + 'lib/crypto/pkcs12/p12_add.c', + 'lib/crypto/pkcs12/p12_asn.c', + 'lib/crypto/pkcs12/p12_attr.c', + 'lib/crypto/pkcs12/p12_crpt.c', + 'lib/crypto/pkcs12/p12_crt.c', + 'lib/crypto/pkcs12/p12_decr.c', + 'lib/crypto/pkcs12/p12_init.c', + 'lib/crypto/pkcs12/p12_key.c', + 'lib/crypto/pkcs12/p12_kiss.c', + 'lib/crypto/pkcs12/p12_mutl.c', + 'lib/crypto/pkcs12/p12_npas.c', + 'lib/crypto/pkcs12/p12_p8d.c', + 'lib/crypto/pkcs12/p12_p8e.c', + 'lib/crypto/pkcs12/p12_sbag.c', + 'lib/crypto/pkcs12/p12_utl.c', + 'lib/crypto/pkcs12/pk12err.c', + 'lib/crypto/pkcs7/bio_pk7.c', + 'lib/crypto/pkcs7/pk7_asn1.c', + 'lib/crypto/pkcs7/pk7_attr.c', + 'lib/crypto/pkcs7/pk7_doit.c', + 'lib/crypto/pkcs7/pk7_lib.c', + 'lib/crypto/pkcs7/pk7_mime.c', + 'lib/crypto/pkcs7/pk7_smime.c', + 'lib/crypto/pkcs7/pkcs7err.c', + 'lib/crypto/poly1305/poly1305.c', + 'lib/crypto/poly1305/poly1305_ameth.c', + 'lib/crypto/poly1305/poly1305_pmeth.c', + 'lib/crypto/rand/drbg_ctr.c', + 'lib/crypto/rand/drbg_lib.c', + 'lib/crypto/rand/rand_egd.c', + 'lib/crypto/rand/rand_err.c', + 'lib/crypto/rand/rand_lib.c', + 'lib/crypto/rand/rand_unix.c', + 'lib/crypto/rand/rand_vms.c', + 'lib/crypto/rand/rand_win.c', + 'lib/crypto/rand/randfile.c', + 'lib/crypto/rc2/rc2_cbc.c', + 'lib/crypto/rc2/rc2_ecb.c', + 'lib/crypto/rc2/rc2_skey.c', + 'lib/crypto/rc2/rc2cfb64.c', + 'lib/crypto/rc2/rc2ofb64.c', + 'lib/crypto/rc4/rc4_enc.c', + 'lib/crypto/rc4/rc4_skey.c', + 'lib/crypto/ripemd/rmd_dgst.c', + 'lib/crypto/ripemd/rmd_one.c', + 'lib/crypto/rsa/rsa_ameth.c', + 'lib/crypto/rsa/rsa_asn1.c', + 'lib/crypto/rsa/rsa_chk.c', + 'lib/crypto/rsa/rsa_crpt.c', + 'lib/crypto/rsa/rsa_depr.c', + 'lib/crypto/rsa/rsa_err.c', + 'lib/crypto/rsa/rsa_gen.c', + 'lib/crypto/rsa/rsa_lib.c', + 'lib/crypto/rsa/rsa_meth.c', + 'lib/crypto/rsa/rsa_mp.c', + 'lib/crypto/rsa/rsa_none.c', + 'lib/crypto/rsa/rsa_oaep.c', + 'lib/crypto/rsa/rsa_ossl.c', + 'lib/crypto/rsa/rsa_pk1.c', + 'lib/crypto/rsa/rsa_pmeth.c', + 'lib/crypto/rsa/rsa_prn.c', + 'lib/crypto/rsa/rsa_pss.c', + 'lib/crypto/rsa/rsa_saos.c', + 'lib/crypto/rsa/rsa_sign.c', + 'lib/crypto/rsa/rsa_ssl.c', + 'lib/crypto/rsa/rsa_x931.c', + 'lib/crypto/rsa/rsa_x931g.c', + 'lib/crypto/seed/seed.c', + 'lib/crypto/seed/seed_cbc.c', + 'lib/crypto/seed/seed_cfb.c', + 'lib/crypto/seed/seed_ecb.c', + 'lib/crypto/seed/seed_ofb.c', + 'lib/crypto/sha/keccak1600.c', + 'lib/crypto/sha/sha1_one.c', + 'lib/crypto/sha/sha1dgst.c', + 'lib/crypto/sha/sha256.c', + 'lib/crypto/sha/sha512.c', + 'lib/crypto/siphash/siphash.c', + 'lib/crypto/siphash/siphash_ameth.c', + 'lib/crypto/siphash/siphash_pmeth.c', + 'lib/crypto/sm2/sm2_crypt.c', + 'lib/crypto/sm2/sm2_err.c', + 'lib/crypto/sm2/sm2_pmeth.c', + 'lib/crypto/sm2/sm2_sign.c', + 'lib/crypto/sm3/m_sm3.c', + 'lib/crypto/sm3/sm3.c', + 'lib/crypto/sm4/sm4.c', + 'lib/crypto/stack/stack.c', + 'lib/crypto/store/loader_file.c', + 'lib/crypto/store/store_err.c', + 'lib/crypto/store/store_init.c', + 'lib/crypto/store/store_lib.c', + 'lib/crypto/store/store_register.c', + 'lib/crypto/store/store_strings.c', + 'lib/crypto/threads_none.c', + 'lib/crypto/threads_pthread.c', + 'lib/crypto/threads_win.c', + 'lib/crypto/ts/ts_asn1.c', + 'lib/crypto/ts/ts_conf.c', + 'lib/crypto/ts/ts_err.c', + 'lib/crypto/ts/ts_lib.c', + 'lib/crypto/ts/ts_req_print.c', + 'lib/crypto/ts/ts_req_utils.c', + 'lib/crypto/ts/ts_rsp_print.c', + 'lib/crypto/ts/ts_rsp_sign.c', + 'lib/crypto/ts/ts_rsp_utils.c', + 'lib/crypto/ts/ts_rsp_verify.c', + 'lib/crypto/ts/ts_verify_ctx.c', + 'lib/crypto/txt_db/txt_db.c', + 'lib/crypto/ui/ui_err.c', + 'lib/crypto/ui/ui_lib.c', + 'lib/crypto/ui/ui_null.c', + 'lib/crypto/ui/ui_openssl.c', + 'lib/crypto/ui/ui_util.c', + 'lib/crypto/uid.c', + 'lib/crypto/whrlpool/wp_block.c', + 'lib/crypto/whrlpool/wp_dgst.c', + 'lib/crypto/x509/by_dir.c', + 'lib/crypto/x509/by_file.c', + 'lib/crypto/x509/t_crl.c', + 'lib/crypto/x509/t_req.c', + 'lib/crypto/x509/t_x509.c', + 'lib/crypto/x509/x509_att.c', + 'lib/crypto/x509/x509_cmp.c', + 'lib/crypto/x509/x509_d2.c', + 'lib/crypto/x509/x509_def.c', + 'lib/crypto/x509/x509_err.c', + 'lib/crypto/x509/x509_ext.c', + 'lib/crypto/x509/x509_lu.c', + 'lib/crypto/x509/x509_meth.c', + 'lib/crypto/x509/x509_obj.c', + 'lib/crypto/x509/x509_r2x.c', + 'lib/crypto/x509/x509_req.c', + 'lib/crypto/x509/x509_set.c', + 'lib/crypto/x509/x509_trs.c', + 'lib/crypto/x509/x509_txt.c', + 'lib/crypto/x509/x509_v3.c', + 'lib/crypto/x509/x509_vfy.c', + 'lib/crypto/x509/x509_vpm.c', + 'lib/crypto/x509/x509cset.c', + 'lib/crypto/x509/x509name.c', + 'lib/crypto/x509/x509rset.c', + 'lib/crypto/x509/x509spki.c', + 'lib/crypto/x509/x509type.c', + 'lib/crypto/x509/x_all.c', + 'lib/crypto/x509/x_attrib.c', + 'lib/crypto/x509/x_crl.c', + 'lib/crypto/x509/x_exten.c', + 'lib/crypto/x509/x_name.c', + 'lib/crypto/x509/x_pubkey.c', + 'lib/crypto/x509/x_req.c', + 'lib/crypto/x509/x_x509.c', + 'lib/crypto/x509/x_x509a.c', + 'lib/crypto/x509v3/pcy_cache.c', + 'lib/crypto/x509v3/pcy_data.c', + 'lib/crypto/x509v3/pcy_lib.c', + 'lib/crypto/x509v3/pcy_map.c', + 'lib/crypto/x509v3/pcy_node.c', + 'lib/crypto/x509v3/pcy_tree.c', + 'lib/crypto/x509v3/v3_addr.c', + 'lib/crypto/x509v3/v3_admis.c', + 'lib/crypto/x509v3/v3_akey.c', + 'lib/crypto/x509v3/v3_akeya.c', + 'lib/crypto/x509v3/v3_alt.c', + 'lib/crypto/x509v3/v3_asid.c', + 'lib/crypto/x509v3/v3_bcons.c', + 'lib/crypto/x509v3/v3_bitst.c', + 'lib/crypto/x509v3/v3_conf.c', + 'lib/crypto/x509v3/v3_cpols.c', + 'lib/crypto/x509v3/v3_crld.c', + 'lib/crypto/x509v3/v3_enum.c', + 'lib/crypto/x509v3/v3_extku.c', + 'lib/crypto/x509v3/v3_genn.c', + 'lib/crypto/x509v3/v3_ia5.c', + 'lib/crypto/x509v3/v3_info.c', + 'lib/crypto/x509v3/v3_int.c', + 'lib/crypto/x509v3/v3_lib.c', + 'lib/crypto/x509v3/v3_ncons.c', + 'lib/crypto/x509v3/v3_pci.c', + 'lib/crypto/x509v3/v3_pcia.c', + 'lib/crypto/x509v3/v3_pcons.c', + 'lib/crypto/x509v3/v3_pku.c', + 'lib/crypto/x509v3/v3_pmaps.c', + 'lib/crypto/x509v3/v3_prn.c', + 'lib/crypto/x509v3/v3_purp.c', + 'lib/crypto/x509v3/v3_skey.c', + 'lib/crypto/x509v3/v3_sxnet.c', + 'lib/crypto/x509v3/v3_tlsf.c', + 'lib/crypto/x509v3/v3_utl.c', + 'lib/crypto/x509v3/v3err.c', + ] + + rvalue['crypto-' + crypto.compiler.target.arch] = builder.Add(crypto) + + ssl = SM.StaticLibrary(builder, cxx, 'ssl') + ssl.compiler.includes += [ + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'include'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib'), + os.path.join(builder.sourcePath, 'extensions', 'mysql', 'openssl', 'lib', 'include'), + ] + + ssl.compiler.defines += [ + 'OPENSSL_USE_NODELETE', + ] + + ssl.sources += [ + 'lib/ssl/bio_ssl.c', + 'lib/ssl/d1_lib.c', + 'lib/ssl/d1_msg.c', + 'lib/ssl/d1_srtp.c', + 'lib/ssl/methods.c', + 'lib/ssl/packet.c', + 'lib/ssl/pqueue.c', + 'lib/ssl/record/dtls1_bitmap.c', + 'lib/ssl/record/rec_layer_d1.c', + 'lib/ssl/record/rec_layer_s3.c', + 'lib/ssl/record/ssl3_buffer.c', + 'lib/ssl/record/ssl3_record.c', + 'lib/ssl/record/ssl3_record_tls13.c', + 'lib/ssl/s3_cbc.c', + 'lib/ssl/s3_enc.c', + 'lib/ssl/s3_lib.c', + 'lib/ssl/s3_msg.c', + 'lib/ssl/ssl_asn1.c', + 'lib/ssl/ssl_cert.c', + 'lib/ssl/ssl_ciph.c', + 'lib/ssl/ssl_conf.c', + 'lib/ssl/ssl_err.c', + 'lib/ssl/ssl_init.c', + 'lib/ssl/ssl_lib.c', + 'lib/ssl/ssl_mcnf.c', + 'lib/ssl/ssl_rsa.c', + 'lib/ssl/ssl_sess.c', + 'lib/ssl/ssl_stat.c', + 'lib/ssl/ssl_txt.c', + 'lib/ssl/ssl_utst.c', + 'lib/ssl/statem/extensions.c', + 'lib/ssl/statem/extensions_clnt.c', + 'lib/ssl/statem/extensions_cust.c', + 'lib/ssl/statem/extensions_srvr.c', + 'lib/ssl/statem/statem.c', + 'lib/ssl/statem/statem_clnt.c', + 'lib/ssl/statem/statem_dtls.c', + 'lib/ssl/statem/statem_lib.c', + 'lib/ssl/statem/statem_srvr.c', + 'lib/ssl/t1_enc.c', + 'lib/ssl/t1_lib.c', + 'lib/ssl/t1_trce.c', + 'lib/ssl/tls13_enc.c', + 'lib/ssl/tls_srp.c', + ] + + rvalue['ssl-' + ssl.compiler.target.arch] = builder.Add(ssl) \ No newline at end of file diff --git a/extensions/mysql/openssl/include/buildinf.h b/extensions/mysql/openssl/include/buildinf.h new file mode 100644 index 0000000000..155556865c --- /dev/null +++ b/extensions/mysql/openssl/include/buildinf.h @@ -0,0 +1,26 @@ +/* + * WARNING: do not edit! + * Generated by util/mkbuildinf.pl + * + * Copyright 2014-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#define PLATFORM "platform: generic" +#define DATE "built on: sometime" + +/* + * Generate compiler_flags as an array of individual characters. This is a + * workaround for the situation where CFLAGS gets too long for a C90 string + * literal + */ +static const char compiler_flags[] = { + 'c','o','m','p','i','l','e','r',':',' ','g','c','c',' ','-','p', + 't','h','r','e','a','d',' ','-','W','a','l','l',' ','-','O','3', + ' ','-','D','O','P','E','N','S','S','L','_','U','S','E','_','N', + 'O','D','E','L','E','T','E',' ','-','D','N','D','E','B','U','G','\0' +}; diff --git a/extensions/mysql/openssl/include/internal/bn_conf.h b/extensions/mysql/openssl/include/internal/bn_conf.h new file mode 100644 index 0000000000..369bd35910 --- /dev/null +++ b/extensions/mysql/openssl/include/internal/bn_conf.h @@ -0,0 +1,34 @@ +/* WARNING: do not edit! */ +/* Generated by Makefile from crypto/include/internal/bn_conf.h.in */ +/* + * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BN_CONF_H +# define HEADER_BN_CONF_H + +/* + * The contents of this file are not used in the UEFI build, as + * both 32-bit and 64-bit builds are supported from a single run + * of the Configure script. + */ + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +#if defined(__x86_64__) || defined(_M_X64) +#define SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#undef THIRTY_TWO_BIT +#elif defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86) +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#endif + +#endif \ No newline at end of file diff --git a/extensions/mysql/openssl/include/internal/dso_conf.h b/extensions/mysql/openssl/include/internal/dso_conf.h new file mode 100644 index 0000000000..19a8d23ace --- /dev/null +++ b/extensions/mysql/openssl/include/internal/dso_conf.h @@ -0,0 +1,15 @@ +/* WARNING: do not edit! */ +/* Generated by Makefile from crypto/include/internal/dso_conf.h.in */ +/* + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DSO_CONF_H +# define HEADER_DSO_CONF_H + +#endif \ No newline at end of file diff --git a/extensions/mysql/openssl/include/openssl/opensslconf.h b/extensions/mysql/openssl/include/openssl/opensslconf.h new file mode 100644 index 0000000000..75297cb067 --- /dev/null +++ b/extensions/mysql/openssl/include/openssl/opensslconf.h @@ -0,0 +1,224 @@ +/* + * WARNING: do not edit! + * Generated by Makefile from include/openssl/opensslconf.h.in + * + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_ALGORITHM_DEFINES +# error OPENSSL_ALGORITHM_DEFINES no longer supported +#endif + +/* + * OpenSSL was configured with the following options: + */ + +#ifndef OPENSSL_NO_COMP +# define OPENSSL_NO_COMP +#endif +#ifndef OPENSSL_NO_CT +# define OPENSSL_NO_CT +#endif +#ifndef OPENSSL_NO_MD2 +# define OPENSSL_NO_MD2 +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_SRP +# define OPENSSL_NO_SRP +#endif +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_RAND_SEED_OS +# define OPENSSL_RAND_SEED_OS +#endif +#ifndef OPENSSL_NO_AFALGENG +# define OPENSSL_NO_AFALGENG +#endif +#ifndef OPENSSL_NO_ASAN +# define OPENSSL_NO_ASAN +#endif +#ifndef OPENSSL_NO_ASM +# define OPENSSL_NO_ASM +#endif +#ifndef OPENSSL_NO_CRYPTO_MDEBUG +# define OPENSSL_NO_CRYPTO_MDEBUG +#endif +#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +#endif +#ifndef OPENSSL_NO_DEVCRYPTOENG +# define OPENSSL_NO_DEVCRYPTOENG +#endif +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_EGD +# define OPENSSL_NO_EGD +#endif +#ifndef OPENSSL_NO_ENGINE +# define OPENSSL_NO_ENGINE +#endif +#ifndef OPENSSL_NO_EXTERNAL_TESTS +# define OPENSSL_NO_EXTERNAL_TESTS +#endif +#ifndef OPENSSL_NO_FUZZ_AFL +# define OPENSSL_NO_FUZZ_AFL +#endif +#ifndef OPENSSL_NO_FUZZ_LIBFUZZER +# define OPENSSL_NO_FUZZ_LIBFUZZER +#endif +#ifndef OPENSSL_NO_HEARTBEATS +# define OPENSSL_NO_HEARTBEATS +#endif +#ifndef OPENSSL_NO_MSAN +# define OPENSSL_NO_MSAN +#endif +#ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +#endif +#ifndef OPENSSL_NO_SSL_TRACE +# define OPENSSL_NO_SSL_TRACE +#endif +#ifndef OPENSSL_NO_SSL3 +# define OPENSSL_NO_SSL3 +#endif +#ifndef OPENSSL_NO_SSL3_METHOD +# define OPENSSL_NO_SSL3_METHOD +#endif +#ifndef OPENSSL_NO_TESTS +# define OPENSSL_NO_TESTS +#endif +#ifndef OPENSSL_NO_UBSAN +# define OPENSSL_NO_UBSAN +#endif +#ifndef OPENSSL_NO_UNIT_TEST +# define OPENSSL_NO_UNIT_TEST +#endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif +#ifndef OPENSSL_NO_DYNAMIC_ENGINE +# define OPENSSL_NO_DYNAMIC_ENGINE +#endif +#ifndef OPENSSL_NO_AFALGENG +# define OPENSSL_NO_AFALGENG +#endif + + +/* + * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers + * don't like that. This will hopefully silence them. + */ +#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; + +/* + * Applications should use -DOPENSSL_API_COMPAT= to suppress the + * declarations of functions deprecated in or before . Otherwise, they + * still won't see them if the library has been built to disable deprecated + * functions. + */ +#ifndef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f; +# ifdef __GNUC__ +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) +# undef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); +# endif +# endif +#endif + +#ifndef OPENSSL_FILE +# ifdef OPENSSL_NO_FILENAMES +# define OPENSSL_FILE "" +# define OPENSSL_LINE 0 +# else +# define OPENSSL_FILE __FILE__ +# define OPENSSL_LINE __LINE__ +# endif +#endif + +#ifndef OPENSSL_MIN_API +# define OPENSSL_MIN_API 0 +#endif + +#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API +# undef OPENSSL_API_COMPAT +# define OPENSSL_API_COMPAT OPENSSL_MIN_API +#endif + +/* + * Do not deprecate things to be deprecated in version 1.2.0 before the + * OpenSSL version number matches. + */ +#if OPENSSL_VERSION_NUMBER < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) f; +#elif OPENSSL_API_COMPAT < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_2_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10100000L +# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_1_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10000000L +# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_0_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x00908000L +# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_0_9_8(f) +#endif + +/* Generate 80386 code? */ +#undef I386_ONLY + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* + * The following are cipher-specific, but are part of the public API. + */ +#if !defined(OPENSSL_SYS_UEFI) +/* Only one for the following should be defined */ +#if defined(__x86_64__) || defined(_M_X64) +# undef BN_LLONG +# define SIXTY_FOUR_BIT_LONG +# undef SIXTY_FOUR_BIT +# undef THIRTY_TWO_BIT +#elif defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86) +# define BN_LLONG +# undef SIXTY_FOUR_BIT_LONG +# undef SIXTY_FOUR_BIT +# define THIRTY_TWO_BIT +#endif + +#endif + +#define RC4_INT unsigned int + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/extensions/mysql/openssl/lib b/extensions/mysql/openssl/lib new file mode 160000 index 0000000000..1708e3e85b --- /dev/null +++ b/extensions/mysql/openssl/lib @@ -0,0 +1 @@ +Subproject commit 1708e3e85b4a86bae26860aa5d2913fc8eff6086 diff --git a/tools/checkout-deps.sh b/tools/checkout-deps.sh index 42c30996dc..062e65174e 100755 --- a/tools/checkout-deps.sh +++ b/tools/checkout-deps.sh @@ -3,18 +3,12 @@ trap "exit" INT -download_mysql=1 - # List of HL2SDK branch names to download. # ./checkout-deps.sh -s tf2,css -# Disable downloading of mysql libraries. -# ./checkout-deps.sh -m -while getopts ":s:m" opt; do +while getopts ":s:" opt; do case $opt in s) IFS=', ' read -r -a sdks <<< "$OPTARG" ;; - m) download_mysql=0 - ;; \?) echo "Invalid option -$OPTARG" >&2 ;; esac @@ -41,57 +35,6 @@ if [ ! -d "sourcemod" ]; then fi fi -getmysql () -{ - if [ ! -d $mysqlfolder ]; then - if [ `command -v wget` ]; then - wget $mysqlurl -O $mysqlfolder.$archive_ext - elif [ `command -v curl` ]; then - curl -o $mysqlfolder.$archive_ext $mysqlurl - else - echo "Failed to locate wget or curl. Install one of these programs to download MySQL." - exit 1 - fi - $decomp $mysqlfolder.$archive_ext - mv $mysqlver $mysqlfolder - rm $mysqlfolder.$archive_ext - fi -} - -# 32-bit MySQL -mysqlfolder=mysql-5.5 -if [ $ismac -eq 1 ]; then - mysqlver=mysql-5.5.28-osx10.5-x86 - mysqlurl=https://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext -elif [ $iswin -eq 1 ]; then - mysqlver=mysql-5.5.54-win32 - mysqlurl=https://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext - # The folder in the zip archive does not contain the substring "-noinstall", so strip it - mysqlver=${mysqlver/-noinstall} -else - mysqlver=mysql-5.6.15-linux-glibc2.5-i686 - mysqlurl=https://cdn.mysql.com/archives/mysql-5.6/$mysqlver.$archive_ext -fi -if [ $download_mysql -eq 1 ]; then - getmysql -fi - -# 64-bit MySQL -mysqlfolder=mysql-5.5-x86_64 -if [ $ismac -eq 1 ]; then - mysqlver=mysql-5.5.28-osx10.5-x86_64 - mysqlurl=https://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext -elif [ $iswin -eq 1 ]; then - mysqlver=mysql-5.5.54-winx64 - mysqlurl=https://cdn.mysql.com/archives/mysql-5.5/$mysqlver.$archive_ext -else - mysqlver=mysql-5.6.15-linux-glibc2.5-x86_64 - mysqlurl=https://cdn.mysql.com/archives/mysql-5.6/$mysqlver.$archive_ext -fi -if [ $download_mysql -eq 1 ]; then - getmysql -fi - checkout () { if [ ! -d "$name" ]; then