4 * include/ssl_applink.c -- common NTP code for openssl/applink.c
6 * Each program which uses OpenSSL should include this file in _one_
7 * of its source files and call ssl_applink() before any OpenSSL
11 #if defined(OPENSSL) && defined(SYS_WINNT)
13 # pragma warning(push)
14 # pragma warning(disable: 4152)
16 # include <openssl/applink.c>
22 #if defined(OPENSSL) && defined(_MSC_VER) && defined(_DEBUG)
23 #define WRAP_DBG_MALLOC
26 #ifdef WRAP_DBG_MALLOC
27 void *wrap_dbg_malloc(size_t s
, const char *f
, int l
);
28 void *wrap_dbg_realloc(void *p
, size_t s
, const char *f
, int l
);
29 void wrap_dbg_free(void *p
);
33 #if defined(OPENSSL) && defined(SYS_WINNT)
34 void ssl_applink(void);
39 #ifdef WRAP_DBG_MALLOC
40 CRYPTO_set_mem_ex_functions(wrap_dbg_malloc
, wrap_dbg_realloc
, wrap_dbg_free
);
45 #else /* !OPENSSL || !SYS_WINNT */
46 #define ssl_applink() do {} while (0)
50 #ifdef WRAP_DBG_MALLOC
52 * OpenSSL malloc overriding uses different parameters
53 * for DEBUG malloc/realloc/free (lacking block type).
54 * Simple wrappers convert.
56 void *wrap_dbg_malloc(size_t s
, const char *f
, int l
)
60 ret
= _malloc_dbg(s
, _NORMAL_BLOCK
, f
, l
);
64 void *wrap_dbg_realloc(void *p
, size_t s
, const char *f
, int l
)
68 ret
= _realloc_dbg(p
, s
, _NORMAL_BLOCK
, f
, l
);
72 void wrap_dbg_free(void *p
)
74 _free_dbg(p
, _NORMAL_BLOCK
);
76 #endif /* WRAP_DBG_MALLOC */