mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
OpenSSL - set all heap functions in CRYPTO_set_mem_functions.
The reason is that on Windows, OpenSSL can be built with different C runtime than the server (e.g Debug runtime in debug vcpkg build). Overwriting only malloc(), with CRT that server is using can cause mixup of incompatible malloc() and free() inside openssl. To fix, overwrite all memory functions.
This commit is contained in:
parent
b619be3569
commit
62fd7b4cd2
1 changed files with 14 additions and 1 deletions
|
@ -47,12 +47,25 @@ static void *coc_malloc(size_t size, const char *f __attribute__((unused)),
|
|||
return malloc(size);
|
||||
}
|
||||
|
||||
static void *coc_realloc(void *addr, size_t num,
|
||||
const char *file __attribute__((unused)),
|
||||
int line __attribute__((unused)))
|
||||
{
|
||||
return realloc(addr, num);
|
||||
}
|
||||
|
||||
static void coc_free(void *addr, const char *file __attribute__((unused)),
|
||||
int line __attribute__((unused)))
|
||||
{
|
||||
free(addr);
|
||||
}
|
||||
|
||||
int check_openssl_compatibility()
|
||||
{
|
||||
EVP_CIPHER_CTX *evp_ctx;
|
||||
EVP_MD_CTX *md5_ctx;
|
||||
|
||||
if (!CRYPTO_set_mem_functions(coc_malloc, NULL, NULL))
|
||||
if (!CRYPTO_set_mem_functions(coc_malloc, coc_realloc, coc_free))
|
||||
return 0;
|
||||
|
||||
testing= 1;
|
||||
|
|
Loading…
Reference in a new issue