Skip to content

Commit 4b0ac5a

Browse files
committed
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] https://github.com/freebsd/freebsd-ports/blob/a34cf9c2dbf503c8248371ba3bab24f34d2d045d/databases/mariadb106-server/files/patch-mysys__ssl_openssl.c [2] libressl/openbsd@5ebad8a#diff-7f393e5489e6c5780773408f11ca27d9b3bb8f55b174631a1e9467a1dd3010b9R22
1 parent d8c841d commit 4b0ac5a

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

mysys_ssl/openssl.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ int check_openssl_compatibility()
3636
static uint testing;
3737
static size_t alloc_size, alloc_count;
3838

39-
static void *coc_malloc(size_t size, const char *f __attribute__((unused)),
40-
int l __attribute__((unused)))
39+
static void *coc_malloc(size_t size
40+
#ifndef LIBRESSL_VERSION_NUMBER
41+
, const char *f __attribute__((unused)),
42+
int l __attribute__((unused))
43+
#endif
44+
)
4145
{
4246
if (unlikely(testing))
4347
{
@@ -47,15 +51,22 @@ static void *coc_malloc(size_t size, const char *f __attribute__((unused)),
4751
return malloc(size);
4852
}
4953

50-
static void *coc_realloc(void *addr, size_t num,
51-
const char *file __attribute__((unused)),
52-
int line __attribute__((unused)))
54+
static void *coc_realloc(void *addr, size_t num
55+
#ifndef LIBRESSL_VERSION_NUMBER
56+
, const char *file __attribute__((unused)),
57+
int line __attribute__((unused))
58+
#endif
59+
)
5360
{
5461
return realloc(addr, num);
5562
}
5663

57-
static void coc_free(void *addr, const char *file __attribute__((unused)),
58-
int line __attribute__((unused)))
64+
static void coc_free(void *addr
65+
#ifndef LIBRESSL_VERSION_NUMBER
66+
, const char *file __attribute__((unused)),
67+
int line __attribute__((unused))
68+
#endif
69+
)
5970
{
6071
free(addr);
6172
}

0 commit comments

Comments
 (0)