You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
@@ -311,8 +311,7 @@ IF(WITH_SSL STREQUAL "ON")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WITH_SSL STREQUAL "OFF")
|
||||
IF(WITH_SSL STREQUAL "OPENSSL")
|
||||
IF(WITH_SSL STREQUAL "OPENSSL")
|
||||
IF (NOT OPENSSL_FOUND)
|
||||
FIND_PACKAGE(OpenSSL)
|
||||
ENDIF()
|
||||
@@ -344,8 +343,7 @@ IF(NOT WITH_SSL STREQUAL "OFF")
|
||||
ELSE()
|
||||
MESSAGE1(TLS_LIBRARY_VERSION "OpenSSL/LibreSSL not found")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(WITH_SSL STREQUAL "GNUTLS")
|
||||
ELSEIF(WITH_SSL STREQUAL "GNUTLS")
|
||||
FIND_PACKAGE(GnuTLS "3.3.24" REQUIRED)
|
||||
IF(GNUTLS_FOUND)
|
||||
ADD_DEFINITIONS(-DHAVE_GNUTLS -DHAVE_TLS)
|
||||
@@ -357,9 +355,7 @@ IF(NOT WITH_SSL STREQUAL "OFF")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "GnuTLS not found")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(WIN32)
|
||||
IF(WITH_SSL STREQUAL "SCHANNEL")
|
||||
ELSEIF(WIN32 AND WITH_SSL STREQUAL "SCHANNEL")
|
||||
ADD_DEFINITIONS(-DHAVE_SCHANNEL -DHAVE_TLS -DHAVE_WINCRYPT)
|
||||
SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/schannel.c"
|
||||
"${CC_SOURCE_DIR}/libmariadb/secure/win_crypt.c"
|
||||
@@ -368,12 +364,11 @@ IF(NOT WITH_SSL STREQUAL "OFF")
|
||||
INCLUDE_DIRECTORIES("${CC_SOURCE_DIR}/plugins/pvio/")
|
||||
SET(SSL_LIBRARIES secur32 crypt32 bcrypt)
|
||||
SET(TLS_LIBRARY_VERSION "Schannel ${CMAKE_SYSTEM_VERSION}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
MESSAGE1(TLS_LIBRARY_VERSION "TLS library/version: ${TLS_LIBRARY_VERSION}")
|
||||
|
||||
MARK_AS_ADVANCED(SSL_SOURCES)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Invalid TLS/SSL option '${WITH_SSL}'")
|
||||
ENDIF()
|
||||
MESSAGE1(TLS_LIBRARY_VERSION "TLS library/version: ${TLS_LIBRARY_VERSION}")
|
||||
MARK_AS_ADVANCED(SSL_SOURCES)
|
||||
|
||||
IF(WITH_BOOST_CONTEXT)
|
||||
FIND_PACKAGE(Boost 1.40 COMPONENTS context REQUIRED)
|
||||
|
@@ -324,7 +324,6 @@ ma_compress.c
|
||||
ma_init.c
|
||||
ma_password.c
|
||||
ma_ll2str.c
|
||||
ma_sha1.c
|
||||
mariadb_stmt.c
|
||||
ma_loaddata.c
|
||||
ma_stmt_codec.c
|
||||
|
@@ -39,7 +39,7 @@
|
||||
#include <ma_global.h>
|
||||
#include <ma_sys.h>
|
||||
#include <ma_string.h>
|
||||
#include <ma_sha1.h>
|
||||
#include <ma_crypt.h>
|
||||
#include "mysql.h"
|
||||
|
||||
|
||||
@@ -100,29 +100,26 @@ void my_crypt(unsigned char *buffer, const unsigned char *s1, const unsigned cha
|
||||
|
||||
void ma_scramble_41(const unsigned char *buffer, const char *scramble, const char *password)
|
||||
{
|
||||
_MA_SHA1_CTX context;
|
||||
unsigned char sha1[SHA1_MAX_LENGTH];
|
||||
unsigned char sha2[SHA1_MAX_LENGTH];
|
||||
MA_HASH_CTX *ctx;
|
||||
unsigned char sha1[MA_SHA1_HASH_SIZE];
|
||||
unsigned char sha2[MA_SHA1_HASH_SIZE];
|
||||
|
||||
|
||||
/* Phase 1: hash password */
|
||||
ma_SHA1Init(&context);
|
||||
ma_SHA1Update(&context, (unsigned char *)password, strlen((char *)password));
|
||||
ma_SHA1Final(sha1, &context);
|
||||
ma_hash(MA_HASH_SHA1, (unsigned char *)password, strlen(password), sha1);
|
||||
|
||||
/* Phase 2: hash sha1 */
|
||||
ma_SHA1Init(&context);
|
||||
ma_SHA1Update(&context, (unsigned char*)sha1, SHA1_MAX_LENGTH);
|
||||
ma_SHA1Final(sha2, &context);
|
||||
ma_hash(MA_HASH_SHA1, (unsigned char *)sha1, MA_SHA1_HASH_SIZE, sha2);
|
||||
|
||||
/* Phase 3: hash scramble + sha2 */
|
||||
ma_SHA1Init(&context);
|
||||
ma_SHA1Update(&context, (unsigned char *)scramble, SCRAMBLE_LENGTH);
|
||||
ma_SHA1Update(&context, (unsigned char*)sha2, SHA1_MAX_LENGTH);
|
||||
ma_SHA1Final((unsigned char *)buffer, &context);
|
||||
ctx= ma_hash_new(MA_HASH_SHA1);
|
||||
ma_hash_input(ctx, (unsigned char *)scramble, SCRAMBLE_LENGTH);
|
||||
ma_hash_input(ctx, (unsigned char *)sha2, MA_SHA1_HASH_SIZE);
|
||||
ma_hash_result(ctx, (unsigned char *)buffer);
|
||||
ma_hash_free(ctx);
|
||||
|
||||
/* let's crypt buffer now */
|
||||
my_crypt((uchar *)buffer, (const unsigned char *)buffer, (const unsigned char *)sha1, SHA1_MAX_LENGTH);
|
||||
my_crypt((uchar *)buffer, (const unsigned char *)buffer, (const unsigned char *)sha1, MA_SHA1_HASH_SIZE);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@@ -66,7 +66,6 @@
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE -1
|
||||
#endif
|
||||
#include <ma_sha1.h>
|
||||
#ifndef _WIN32
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user