Skip to content

Commit

Permalink
Merge branch '3.2' into 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed Nov 3, 2021
2 parents 9c64567 + e730df7 commit 159219f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 47 deletions.
4 changes: 2 additions & 2 deletions cmake/ConnectorName.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ IF(SIZEOF_VOIDP EQUAL 8)
SET(IS64 1)
ENDIF()

SET (PLAFORM_NAME CMAKE_SYSTEM_NAME)
SET (MACHINE_NAME CMAKE_SYSTEM_PROCESSOR)
SET (PLATFORM_NAME ${CMAKE_SYSTEM_NAME})
SET (MACHINE_NAME ${CMAKE_SYSTEM_PROCESSOR})
SET (CONCAT_SIGN "-")

IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
Expand Down
15 changes: 4 additions & 11 deletions libmariadb/secure/ma_schannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ SECURITY_STATUS ma_schannel_client_handshake(MARIADB_TLS *ctls)
MARIADB_PVIO *pvio;
SECURITY_STATUS sRet;
DWORD OutFlags;
DWORD r;
SC_CTX *sctx;
SecBuffer ExtraData;
DWORD SFlags= ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT |
Expand Down Expand Up @@ -318,7 +317,7 @@ SECURITY_STATUS ma_schannel_client_handshake(MARIADB_TLS *ctls)
return sRet;
}

/* send client hello packaet */
/* send client hello */
if(BuffersOut.cbBuffer != 0 && BuffersOut.pvBuffer != NULL)
{
ssize_t nbytes = (DWORD)pvio->methods->write(pvio, (uchar *)BuffersOut.pvBuffer, (size_t)BuffersOut.cbBuffer);
Expand All @@ -328,7 +327,6 @@ SECURITY_STATUS ma_schannel_client_handshake(MARIADB_TLS *ctls)
sRet= SEC_E_INTERNAL_ERROR;
goto end;
}
r = (DWORD)nbytes;
}
sRet= ma_schannel_handshake_loop(pvio, TRUE, &ExtraData);

Expand Down Expand Up @@ -564,8 +562,6 @@ ssize_t ma_schannel_write_encrypt(MARIADB_PVIO *pvio,
SECURITY_STATUS scRet;
SecBufferDesc Message;
SecBuffer Buffers[4];
DWORD cbMessage;
PBYTE pbMessage;
SC_CTX *sctx= (SC_CTX *)pvio->ctls->ssl;
size_t payload;
ssize_t nbytes;
Expand All @@ -574,8 +570,6 @@ ssize_t ma_schannel_write_encrypt(MARIADB_PVIO *pvio,
payload= MIN(WriteBufferSize, sctx->Sizes.cbMaximumMessage);

memcpy(&sctx->IoBuffer[sctx->Sizes.cbHeader], WriteBuffer, payload);
pbMessage = sctx->IoBuffer + sctx->Sizes.cbHeader;
cbMessage = (DWORD)payload;

Buffers[0].pvBuffer = sctx->IoBuffer;
Buffers[0].cbBuffer = sctx->Sizes.cbHeader;
Expand All @@ -589,10 +583,9 @@ ssize_t ma_schannel_write_encrypt(MARIADB_PVIO *pvio,
Buffers[2].cbBuffer = sctx->Sizes.cbTrailer;
Buffers[2].BufferType = SECBUFFER_STREAM_TRAILER;

Buffers[3].pvBuffer = SECBUFFER_EMPTY; // Pointer to buffer 4
Buffers[3].cbBuffer = SECBUFFER_EMPTY; // length of buffer 4
Buffers[3].BufferType = SECBUFFER_EMPTY; // Type of the buffer 4

Buffers[3].pvBuffer = SECBUFFER_EMPTY;
Buffers[3].cbBuffer = SECBUFFER_EMPTY;
Buffers[3].BufferType = SECBUFFER_EMPTY;

Message.ulVersion = SECBUFFER_VERSION;
Message.cBuffers = 4;
Expand Down
41 changes: 7 additions & 34 deletions libmariadb/secure/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,6 @@ static void ma_tls_set_error(MYSQL *mysql)
return;
}

#ifndef HAVE_OPENSSL_1_1_API
/*
thread safe callbacks for OpenSSL
Crypto call back functions will be
set during ssl_initialization
*/
#if OPENSSL_VERSION_NUMBER < 0x10000000L
static unsigned long my_cb_threadid(void)
{
/* cast pthread_t to unsigned long */
return (unsigned long) pthread_self();
}
#else
static void my_cb_threadid(CRYPTO_THREADID *id)
{
CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self());
}
#endif
#endif

#ifndef HAVE_OPENSSL_1_1_API
static void my_cb_locking(int mode, int n,
const char *file __attribute__((unused)),
Expand All @@ -175,25 +155,18 @@ static void my_cb_locking(int mode, int n,

static int ssl_thread_init()
{
if (!CRYPTO_THREADID_get_callback()
#ifndef OPENSSL_NO_DEPRECATED
&& !CRYPTO_get_id_callback()
#endif
)
if (LOCK_crypto == NULL)
{
int i, max= CRYPTO_num_locks();

if (LOCK_crypto == NULL)
{
if (!(LOCK_crypto=
(pthread_mutex_t *)ma_malloc(sizeof(pthread_mutex_t) * max, MYF(0))))
return 1;
if (!(LOCK_crypto=
(pthread_mutex_t *)ma_malloc(sizeof(pthread_mutex_t) * max, MYF(0))))
return 1;

for (i=0; i < max; i++)
pthread_mutex_init(&LOCK_crypto[i], NULL);

for (i=0; i < max; i++)
pthread_mutex_init(&LOCK_crypto[i], NULL);
}
CRYPTO_set_locking_callback(my_cb_locking);
CRYPTO_THREADID_set_callback(my_cb_threadid);
}
return 0;
}
Expand Down

0 comments on commit 159219f

Please sign in to comment.