ssl_applink.c (302408) | ssl_applink.c (316068) |
---|---|
1/* 2 * include/ssl_applink.c -- common NTP code for openssl/applink.c 3 * 4 * Each program which uses OpenSSL should include this file in _one_ 5 * of its source files and call ssl_applink() before any OpenSSL 6 * functions. 7 */ 8 9#if defined(OPENSSL) && defined(SYS_WINNT) 10# ifdef _MSC_VER 11# pragma warning(push) 12# pragma warning(disable: 4152) | 1/* 2 * include/ssl_applink.c -- common NTP code for openssl/applink.c 3 * 4 * Each program which uses OpenSSL should include this file in _one_ 5 * of its source files and call ssl_applink() before any OpenSSL 6 * functions. 7 */ 8 9#if defined(OPENSSL) && defined(SYS_WINNT) 10# ifdef _MSC_VER 11# pragma warning(push) 12# pragma warning(disable: 4152) |
13# ifndef OPENSSL_NO_AUTOLINK 14# include "msvc_ssl_autolib.h" 15# endif |
|
13# endif | 16# endif |
14# include <openssl/applink.c> | 17# if OPENSSL_VERSION_NUMBER < 0x10100000L 18# include <openssl/applink.c> 19# endif |
15# ifdef _MSC_VER 16# pragma warning(pop) 17# endif 18#endif 19 20#if defined(OPENSSL) && defined(_MSC_VER) && defined(_DEBUG) 21#define WRAP_DBG_MALLOC 22#endif 23 24#ifdef WRAP_DBG_MALLOC 25void *wrap_dbg_malloc(size_t s, const char *f, int l); 26void *wrap_dbg_realloc(void *p, size_t s, const char *f, int l); 27void wrap_dbg_free(void *p); | 20# ifdef _MSC_VER 21# pragma warning(pop) 22# endif 23#endif 24 25#if defined(OPENSSL) && defined(_MSC_VER) && defined(_DEBUG) 26#define WRAP_DBG_MALLOC 27#endif 28 29#ifdef WRAP_DBG_MALLOC 30void *wrap_dbg_malloc(size_t s, const char *f, int l); 31void *wrap_dbg_realloc(void *p, size_t s, const char *f, int l); 32void wrap_dbg_free(void *p); |
33void wrap_dbg_free_ex(void *p, const char *f, int l); |
|
28#endif 29 30 31#if defined(OPENSSL) && defined(SYS_WINNT) | 34#endif 35 36 37#if defined(OPENSSL) && defined(SYS_WINNT) |
38 |
|
32void ssl_applink(void); 33 34void 35ssl_applink(void) 36{ | 39void ssl_applink(void); 40 41void 42ssl_applink(void) 43{ |
37#ifdef WRAP_DBG_MALLOC 38 CRYPTO_set_mem_ex_functions(wrap_dbg_malloc, wrap_dbg_realloc, wrap_dbg_free); | 44#if OPENSSL_VERSION_NUMBER >= 0x10100000L 45# ifdef WRAP_DBG_MALLOC 46 CRYPTO_set_mem_functions(wrap_dbg_malloc, wrap_dbg_realloc, wrap_dbg_free_ex); 47# else 48 OPENSSL_malloc_init(); 49# endif |
39#else | 50#else |
51# ifdef WRAP_DBG_MALLOC 52 CRYPTO_set_mem_ex_functions(wrap_dbg_malloc, wrap_dbg_realloc, wrap_dbg_free); 53# else |
|
40 CRYPTO_malloc_init(); | 54 CRYPTO_malloc_init(); |
41#endif | 55# endif 56#endif /* OpenSSL version cascade */ |
42} 43#else /* !OPENSSL || !SYS_WINNT */ 44#define ssl_applink() do {} while (0) 45#endif 46 47 48#ifdef WRAP_DBG_MALLOC 49/* --- 16 unchanged lines hidden (view full) --- 66 ret = _realloc_dbg(p, s, _NORMAL_BLOCK, f, l); 67 return ret; 68} 69 70void wrap_dbg_free(void *p) 71{ 72 _free_dbg(p, _NORMAL_BLOCK); 73} | 57} 58#else /* !OPENSSL || !SYS_WINNT */ 59#define ssl_applink() do {} while (0) 60#endif 61 62 63#ifdef WRAP_DBG_MALLOC 64/* --- 16 unchanged lines hidden (view full) --- 81 ret = _realloc_dbg(p, s, _NORMAL_BLOCK, f, l); 82 return ret; 83} 84 85void wrap_dbg_free(void *p) 86{ 87 _free_dbg(p, _NORMAL_BLOCK); 88} |
89 90void wrap_dbg_free_ex(void *p, const char *f, int l) 91{ 92 (void)f; 93 (void)l; 94 _free_dbg(p, _NORMAL_BLOCK); 95} |
|
74#endif /* WRAP_DBG_MALLOC */ | 96#endif /* WRAP_DBG_MALLOC */ |