MDEV-35838 libressl support differences in CRYPTO_set_mem_functions

Based on FreeBSD patch.

The FreeBSD inclusion of check_openssl_compatibility prevented
any use of the crypto callbacks and as such the later differences
where ignored.

The later differences in coc_malloc didn't propegate to the other
callback functions of CRYPTO_set_mem_functions where a reduced
argument list also applied.

Looking where[2] libressl added the functions it was of the
same prototype 10 years ago so omitting any version check.

[1] a34cf9c2db/databases/mariadb106-server/files/patch-mysys__ssl_openssl.c
[2] 5ebad8acea (diff-7f393e5489e6c5780773408f11ca27d9b3bb8f55b174631a1e9467a1dd3010b9R22)
This commit is contained in:
Daniel Black 2025-01-14 10:48:59 +11:00
parent d8c841d0d4
commit 4b0ac5a12b

View File

@ -36,8 +36,12 @@ int check_openssl_compatibility()
static uint testing; static uint testing;
static size_t alloc_size, alloc_count; static size_t alloc_size, alloc_count;
static void *coc_malloc(size_t size, const char *f __attribute__((unused)), static void *coc_malloc(size_t size
int l __attribute__((unused))) #ifndef LIBRESSL_VERSION_NUMBER
, const char *f __attribute__((unused)),
int l __attribute__((unused))
#endif
)
{ {
if (unlikely(testing)) if (unlikely(testing))
{ {
@ -47,15 +51,22 @@ static void *coc_malloc(size_t size, const char *f __attribute__((unused)),
return malloc(size); return malloc(size);
} }
static void *coc_realloc(void *addr, size_t num, static void *coc_realloc(void *addr, size_t num
const char *file __attribute__((unused)), #ifndef LIBRESSL_VERSION_NUMBER
int line __attribute__((unused))) , const char *file __attribute__((unused)),
int line __attribute__((unused))
#endif
)
{ {
return realloc(addr, num); return realloc(addr, num);
} }
static void coc_free(void *addr, const char *file __attribute__((unused)), static void coc_free(void *addr
int line __attribute__((unused))) #ifndef LIBRESSL_VERSION_NUMBER
, const char *file __attribute__((unused)),
int line __attribute__((unused))
#endif
)
{ {
free(addr); free(addr);
} }