155714Skris/* crypto/mem.c */ 255714Skris/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 355714Skris * All rights reserved. 455714Skris * 555714Skris * This package is an SSL implementation written 655714Skris * by Eric Young (eay@cryptsoft.com). 755714Skris * The implementation was written so as to conform with Netscapes SSL. 8296465Sdelphij * 955714Skris * This library is free for commercial and non-commercial use as long as 1055714Skris * the following conditions are aheared to. The following conditions 1155714Skris * apply to all code found in this distribution, be it the RC4, RSA, 1255714Skris * lhash, DES, etc., code; not just the SSL code. The SSL documentation 1355714Skris * included with this distribution is covered by the same copyright terms 1455714Skris * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15296465Sdelphij * 1655714Skris * Copyright remains Eric Young's, and as such any Copyright notices in 1755714Skris * the code are not to be removed. 1855714Skris * If this package is used in a product, Eric Young should be given attribution 1955714Skris * as the author of the parts of the library used. 2055714Skris * This can be in the form of a textual message at program startup or 2155714Skris * in documentation (online or textual) provided with the package. 22296465Sdelphij * 2355714Skris * Redistribution and use in source and binary forms, with or without 2455714Skris * modification, are permitted provided that the following conditions 2555714Skris * are met: 2655714Skris * 1. Redistributions of source code must retain the copyright 2755714Skris * notice, this list of conditions and the following disclaimer. 2855714Skris * 2. Redistributions in binary form must reproduce the above copyright 2955714Skris * notice, this list of conditions and the following disclaimer in the 3055714Skris * documentation and/or other materials provided with the distribution. 3155714Skris * 3. All advertising materials mentioning features or use of this software 3255714Skris * must display the following acknowledgement: 3355714Skris * "This product includes cryptographic software written by 3455714Skris * Eric Young (eay@cryptsoft.com)" 3555714Skris * The word 'cryptographic' can be left out if the rouines from the library 3655714Skris * being used are not cryptographic related :-). 37296465Sdelphij * 4. If you include any Windows specific code (or a derivative thereof) from 3855714Skris * the apps directory (application code) you must include an acknowledgement: 3955714Skris * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40296465Sdelphij * 4155714Skris * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 4255714Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4355714Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4455714Skris * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 4555714Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4655714Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4755714Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4855714Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4955714Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5055714Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5155714Skris * SUCH DAMAGE. 52296465Sdelphij * 5355714Skris * The licence and distribution terms for any publically available version or 5455714Skris * derivative of this code cannot be changed. i.e. this code cannot simply be 5555714Skris * copied and put under another distribution licence 5655714Skris * [including the GNU Public Licence.] 5755714Skris */ 5855714Skris 5955714Skris#include <stdio.h> 6055714Skris#include <stdlib.h> 6155714Skris#include <openssl/crypto.h> 6255714Skris#include "cryptlib.h" 6355714Skris 64296465Sdelphijstatic int allow_customize = 1; /* we provide flexible functions for */ 65296465Sdelphijstatic int allow_customize_debug = 1; /* exchanging memory-related functions 66296465Sdelphij * at run-time, but this must be done 67296465Sdelphij * before any blocks are actually 68296465Sdelphij * allocated; or we'll run into huge 69296465Sdelphij * problems when malloc/free pairs 70296465Sdelphij * don't match etc. */ 7155714Skris 72296465Sdelphij/* 73296465Sdelphij * the following pointers may be changed as long as 'allow_customize' is set 74296465Sdelphij */ 7555714Skris 76296465Sdelphijstatic void *(*malloc_func) (size_t) = malloc; 77296465Sdelphijstatic void *default_malloc_ex(size_t num, const char *file, int line) 78296465Sdelphij{ 79296465Sdelphij return malloc_func(num); 80296465Sdelphij} 81109998Smarkm 82296465Sdelphijstatic void *(*malloc_ex_func) (size_t, const char *file, int line) 83296465Sdelphij = default_malloc_ex; 84109998Smarkm 85296465Sdelphijstatic void *(*realloc_func) (void *, size_t) = realloc; 86296465Sdelphijstatic void *default_realloc_ex(void *str, size_t num, 87296465Sdelphij const char *file, int line) 88296465Sdelphij{ 89296465Sdelphij return realloc_func(str, num); 90296465Sdelphij} 91109998Smarkm 92296465Sdelphijstatic void *(*realloc_ex_func) (void *, size_t, const char *file, int line) 93296465Sdelphij = default_realloc_ex; 94109998Smarkm 95296465Sdelphijstatic void (*free_func) (void *) = free; 96109998Smarkm 97296465Sdelphijstatic void *(*malloc_locked_func) (size_t) = malloc; 98109998Smarkmstatic void *default_malloc_locked_ex(size_t num, const char *file, int line) 99296465Sdelphij{ 100296465Sdelphij return malloc_locked_func(num); 101296465Sdelphij} 102109998Smarkm 103296465Sdelphijstatic void *(*malloc_locked_ex_func) (size_t, const char *file, int line) 104296465Sdelphij = default_malloc_locked_ex; 105109998Smarkm 106296465Sdelphijstatic void (*free_locked_func) (void *) = free; 107109998Smarkm 108109998Smarkm/* may be changed as long as 'allow_customize_debug' is set */ 10959191Skris/* XXX use correct function pointer types */ 110194206Ssimon#if defined(CRYPTO_MDEBUG) && !defined(OPENSSL_FIPS) 11168651Skris/* use default functions from mem_dbg.c */ 112296465Sdelphijstatic void (*malloc_debug_func) (void *, int, const char *, int, int) 113296465Sdelphij = CRYPTO_dbg_malloc; 114296465Sdelphijstatic void (*realloc_debug_func) (void *, void *, int, const char *, int, 115296465Sdelphij int) 116296465Sdelphij = CRYPTO_dbg_realloc; 117296465Sdelphijstatic void (*free_debug_func) (void *, int) = CRYPTO_dbg_free; 118296465Sdelphijstatic void (*set_debug_options_func) (long) = CRYPTO_dbg_set_options; 119296465Sdelphijstatic long (*get_debug_options_func) (void) = CRYPTO_dbg_get_options; 120194206Ssimon 121296465Sdelphijstatic int (*push_info_func) (const char *info, const char *file, int line) 122296465Sdelphij = CRYPTO_dbg_push_info; 123296465Sdelphijstatic int (*pop_info_func) (void) 124296465Sdelphij = CRYPTO_dbg_pop_info; 125296465Sdelphijstatic int (*remove_all_info_func) (void) 126296465Sdelphij = CRYPTO_dbg_remove_all_info; 127194206Ssimon 12859191Skris#else 129296465Sdelphij/* 130296465Sdelphij * applications can use CRYPTO_malloc_debug_init() to select above case at 131296465Sdelphij * run-time 132296465Sdelphij */ 133296465Sdelphijstatic void (*malloc_debug_func) (void *, int, const char *, int, int) = NULL; 134296465Sdelphijstatic void (*realloc_debug_func) (void *, void *, int, const char *, int, 135296465Sdelphij int) 136296465Sdelphij = NULL; 137296465Sdelphijstatic void (*free_debug_func) (void *, int) = NULL; 138296465Sdelphijstatic void (*set_debug_options_func) (long) = NULL; 139296465Sdelphijstatic long (*get_debug_options_func) (void) = NULL; 140194206Ssimon 141296465Sdelphijstatic int (*push_info_func) (const char *info, const char *file, int line) 142296465Sdelphij = NULL; 143296465Sdelphijstatic int (*pop_info_func) (void) = NULL; 144296465Sdelphijstatic int (*remove_all_info_func) (void) = NULL; 145194206Ssimon 14655714Skris#endif 14755714Skris 148296465Sdelphijint CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t), 149296465Sdelphij void (*f) (void *)) 150296465Sdelphij{ 151296465Sdelphij if (!allow_customize) 152296465Sdelphij return 0; 153296465Sdelphij if ((m == 0) || (r == 0) || (f == 0)) 154296465Sdelphij return 0; 155296465Sdelphij malloc_func = m; 156296465Sdelphij malloc_ex_func = default_malloc_ex; 157296465Sdelphij realloc_func = r; 158296465Sdelphij realloc_ex_func = default_realloc_ex; 159296465Sdelphij free_func = f; 160296465Sdelphij malloc_locked_func = m; 161296465Sdelphij malloc_locked_ex_func = default_malloc_locked_ex; 162296465Sdelphij free_locked_func = f; 163296465Sdelphij return 1; 164296465Sdelphij} 16555714Skris 166296465Sdelphijint CRYPTO_set_mem_ex_functions(void *(*m) (size_t, const char *, int), 167296465Sdelphij void *(*r) (void *, size_t, const char *, 168296465Sdelphij int), void (*f) (void *)) 169296465Sdelphij{ 170296465Sdelphij if (!allow_customize) 171296465Sdelphij return 0; 172296465Sdelphij if ((m == 0) || (r == 0) || (f == 0)) 173296465Sdelphij return 0; 174296465Sdelphij malloc_func = 0; 175296465Sdelphij malloc_ex_func = m; 176296465Sdelphij realloc_func = 0; 177296465Sdelphij realloc_ex_func = r; 178296465Sdelphij free_func = f; 179296465Sdelphij malloc_locked_func = 0; 180296465Sdelphij malloc_locked_ex_func = m; 181296465Sdelphij free_locked_func = f; 182296465Sdelphij return 1; 183296465Sdelphij} 18455714Skris 185296465Sdelphijint CRYPTO_set_locked_mem_functions(void *(*m) (size_t), void (*f) (void *)) 186296465Sdelphij{ 187296465Sdelphij if (!allow_customize) 188296465Sdelphij return 0; 189296465Sdelphij if ((m == NULL) || (f == NULL)) 190296465Sdelphij return 0; 191296465Sdelphij malloc_locked_func = m; 192296465Sdelphij malloc_locked_ex_func = default_malloc_locked_ex; 193296465Sdelphij free_locked_func = f; 194296465Sdelphij return 1; 195296465Sdelphij} 196109998Smarkm 197296465Sdelphijint CRYPTO_set_locked_mem_ex_functions(void *(*m) (size_t, const char *, int), 198296465Sdelphij void (*f) (void *)) 199296465Sdelphij{ 200296465Sdelphij if (!allow_customize) 201296465Sdelphij return 0; 202296465Sdelphij if ((m == NULL) || (f == NULL)) 203296465Sdelphij return 0; 204296465Sdelphij malloc_locked_func = 0; 205296465Sdelphij malloc_locked_ex_func = m; 206296465Sdelphij free_func = f; 207296465Sdelphij return 1; 208296465Sdelphij} 20955714Skris 210296465Sdelphijint CRYPTO_set_mem_debug_functions(void (*m) 211296465Sdelphij (void *, int, const char *, int, int), 212296465Sdelphij void (*r) (void *, void *, int, 213296465Sdelphij const char *, int, int), 214296465Sdelphij void (*f) (void *, int), void (*so) (long), 215296465Sdelphij long (*go) (void)) 216296465Sdelphij{ 217296465Sdelphij if (!allow_customize_debug) 218296465Sdelphij return 0; 219296465Sdelphij malloc_debug_func = m; 220296465Sdelphij realloc_debug_func = r; 221296465Sdelphij free_debug_func = f; 222296465Sdelphij set_debug_options_func = so; 223296465Sdelphij get_debug_options_func = go; 224296465Sdelphij return 1; 225296465Sdelphij} 226109998Smarkm 227296465Sdelphijvoid CRYPTO_set_mem_info_functions(int (*push_info_fn) 228296465Sdelphij (const char *info, const char *file, 229296465Sdelphij int line), int (*pop_info_fn) (void), 230296465Sdelphij int (*remove_all_info_fn) (void)) 231296465Sdelphij{ 232296465Sdelphij push_info_func = push_info_fn; 233296465Sdelphij pop_info_func = pop_info_fn; 234296465Sdelphij remove_all_info_func = remove_all_info_fn; 235296465Sdelphij} 23659191Skris 237296465Sdelphijvoid CRYPTO_get_mem_functions(void *(**m) (size_t), 238296465Sdelphij void *(**r) (void *, size_t), 239296465Sdelphij void (**f) (void *)) 240296465Sdelphij{ 241296465Sdelphij if (m != NULL) 242296465Sdelphij *m = (malloc_ex_func == default_malloc_ex) ? malloc_func : 0; 243296465Sdelphij if (r != NULL) 244296465Sdelphij *r = (realloc_ex_func == default_realloc_ex) ? realloc_func : 0; 245296465Sdelphij if (f != NULL) 246296465Sdelphij *f = free_func; 247296465Sdelphij} 248109998Smarkm 249296465Sdelphijvoid CRYPTO_get_mem_ex_functions(void *(**m) (size_t, const char *, int), 250296465Sdelphij void *(**r) (void *, size_t, const char *, 251296465Sdelphij int), void (**f) (void *)) 252296465Sdelphij{ 253296465Sdelphij if (m != NULL) 254296465Sdelphij *m = (malloc_ex_func != default_malloc_ex) ? malloc_ex_func : 0; 255296465Sdelphij if (r != NULL) 256296465Sdelphij *r = (realloc_ex_func != default_realloc_ex) ? realloc_ex_func : 0; 257296465Sdelphij if (f != NULL) 258296465Sdelphij *f = free_func; 259296465Sdelphij} 26055714Skris 261296465Sdelphijvoid CRYPTO_get_locked_mem_functions(void *(**m) (size_t), 262296465Sdelphij void (**f) (void *)) 263296465Sdelphij{ 264296465Sdelphij if (m != NULL) 265296465Sdelphij *m = (malloc_locked_ex_func == default_malloc_locked_ex) ? 266296465Sdelphij malloc_locked_func : 0; 267296465Sdelphij if (f != NULL) 268296465Sdelphij *f = free_locked_func; 269296465Sdelphij} 270109998Smarkm 271296465Sdelphijvoid CRYPTO_get_locked_mem_ex_functions(void 272296465Sdelphij *(**m) (size_t, const char *, int), 273296465Sdelphij void (**f) (void *)) 274296465Sdelphij{ 275296465Sdelphij if (m != NULL) 276296465Sdelphij *m = (malloc_locked_ex_func != default_malloc_locked_ex) ? 277296465Sdelphij malloc_locked_ex_func : 0; 278296465Sdelphij if (f != NULL) 279296465Sdelphij *f = free_locked_func; 280296465Sdelphij} 28155714Skris 282296465Sdelphijvoid CRYPTO_get_mem_debug_functions(void (**m) 283296465Sdelphij (void *, int, const char *, int, int), 284296465Sdelphij void (**r) (void *, void *, int, 285296465Sdelphij const char *, int, int), 286296465Sdelphij void (**f) (void *, int), 287296465Sdelphij void (**so) (long), long (**go) (void)) 288296465Sdelphij{ 289296465Sdelphij if (m != NULL) 290296465Sdelphij *m = malloc_debug_func; 291296465Sdelphij if (r != NULL) 292296465Sdelphij *r = realloc_debug_func; 293296465Sdelphij if (f != NULL) 294296465Sdelphij *f = free_debug_func; 295296465Sdelphij if (so != NULL) 296296465Sdelphij *so = set_debug_options_func; 297296465Sdelphij if (go != NULL) 298296465Sdelphij *go = get_debug_options_func; 299296465Sdelphij} 300109998Smarkm 30159191Skrisvoid *CRYPTO_malloc_locked(int num, const char *file, int line) 302296465Sdelphij{ 303296465Sdelphij void *ret = NULL; 304296465Sdelphij extern unsigned char cleanse_ctr; 30555714Skris 306296465Sdelphij if (num <= 0) 307296465Sdelphij return NULL; 308111147Snectar 309296465Sdelphij allow_customize = 0; 310296465Sdelphij if (malloc_debug_func != NULL) { 311296465Sdelphij allow_customize_debug = 0; 312296465Sdelphij malloc_debug_func(NULL, num, file, line, 0); 313296465Sdelphij } 314296465Sdelphij ret = malloc_locked_ex_func(num, file, line); 315109998Smarkm#ifdef LEVITTE_DEBUG_MEM 316296465Sdelphij fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 31759191Skris#endif 318296465Sdelphij if (malloc_debug_func != NULL) 319296465Sdelphij malloc_debug_func(ret, num, file, line, 1); 32055714Skris 321296465Sdelphij /* 322296465Sdelphij * Create a dependency on the value of 'cleanse_ctr' so our memory 323296465Sdelphij * sanitisation function can't be optimised out. NB: We only do this for 324296465Sdelphij * >2Kb so the overhead doesn't bother us. 325296465Sdelphij */ 326296465Sdelphij if (ret && (num > 2048)) 327296465Sdelphij ((unsigned char *)ret)[0] = cleanse_ctr; 328109998Smarkm 329296465Sdelphij return ret; 330296465Sdelphij} 33155714Skris 33259191Skrisvoid CRYPTO_free_locked(void *str) 333296465Sdelphij{ 334296465Sdelphij if (free_debug_func != NULL) 335296465Sdelphij free_debug_func(str, 0); 336109998Smarkm#ifdef LEVITTE_DEBUG_MEM 337296465Sdelphij fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); 33855714Skris#endif 339296465Sdelphij free_locked_func(str); 340296465Sdelphij if (free_debug_func != NULL) 341296465Sdelphij free_debug_func(NULL, 1); 342296465Sdelphij} 34355714Skris 34459191Skrisvoid *CRYPTO_malloc(int num, const char *file, int line) 345296465Sdelphij{ 346296465Sdelphij void *ret = NULL; 347296465Sdelphij extern unsigned char cleanse_ctr; 34855714Skris 349296465Sdelphij if (num <= 0) 350296465Sdelphij return NULL; 351111147Snectar 352296465Sdelphij allow_customize = 0; 353296465Sdelphij if (malloc_debug_func != NULL) { 354296465Sdelphij allow_customize_debug = 0; 355296465Sdelphij malloc_debug_func(NULL, num, file, line, 0); 356296465Sdelphij } 357296465Sdelphij ret = malloc_ex_func(num, file, line); 358109998Smarkm#ifdef LEVITTE_DEBUG_MEM 359296465Sdelphij fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 36059191Skris#endif 361296465Sdelphij if (malloc_debug_func != NULL) 362296465Sdelphij malloc_debug_func(ret, num, file, line, 1); 36355714Skris 364296465Sdelphij /* 365296465Sdelphij * Create a dependency on the value of 'cleanse_ctr' so our memory 366296465Sdelphij * sanitisation function can't be optimised out. NB: We only do this for 367296465Sdelphij * >2Kb so the overhead doesn't bother us. 368296465Sdelphij */ 369296465Sdelphij if (ret && (num > 2048)) 370296465Sdelphij ((unsigned char *)ret)[0] = cleanse_ctr; 371109998Smarkm 372296465Sdelphij return ret; 373296465Sdelphij} 37455714Skris 37559191Skrisvoid *CRYPTO_realloc(void *str, int num, const char *file, int line) 376296465Sdelphij{ 377296465Sdelphij void *ret = NULL; 37855714Skris 379296465Sdelphij if (str == NULL) 380296465Sdelphij return CRYPTO_malloc(num, file, line); 381111147Snectar 382296465Sdelphij if (num <= 0) 383296465Sdelphij return NULL; 384160814Ssimon 385296465Sdelphij if (realloc_debug_func != NULL) 386296465Sdelphij realloc_debug_func(str, NULL, num, file, line, 0); 387296465Sdelphij ret = realloc_ex_func(str, num, file, line); 388109998Smarkm#ifdef LEVITTE_DEBUG_MEM 389296465Sdelphij fprintf(stderr, "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", str, 390296465Sdelphij ret, num); 391109998Smarkm#endif 392296465Sdelphij if (realloc_debug_func != NULL) 393296465Sdelphij realloc_debug_func(str, ret, num, file, line, 1); 394101613Snectar 395296465Sdelphij return ret; 396296465Sdelphij} 397109998Smarkm 398109998Smarkmvoid *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file, 399296465Sdelphij int line) 400296465Sdelphij{ 401296465Sdelphij void *ret = NULL; 402109998Smarkm 403296465Sdelphij if (str == NULL) 404296465Sdelphij return CRYPTO_malloc(num, file, line); 405160814Ssimon 406296465Sdelphij if (num <= 0) 407296465Sdelphij return NULL; 408160814Ssimon 409296465Sdelphij /* 410296465Sdelphij * We don't support shrinking the buffer. Note the memcpy that copies 411296465Sdelphij * |old_len| bytes to the new buffer, below. 412296465Sdelphij */ 413296465Sdelphij if (num < old_len) 414296465Sdelphij return NULL; 415234954Sbz 416296465Sdelphij if (realloc_debug_func != NULL) 417296465Sdelphij realloc_debug_func(str, NULL, num, file, line, 0); 418296465Sdelphij ret = malloc_ex_func(num, file, line); 419296465Sdelphij if (ret) { 420296465Sdelphij memcpy(ret, str, old_len); 421296465Sdelphij OPENSSL_cleanse(str, old_len); 422296465Sdelphij free_func(str); 423296465Sdelphij } 424109998Smarkm#ifdef LEVITTE_DEBUG_MEM 425296465Sdelphij fprintf(stderr, 426296465Sdelphij "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", 427296465Sdelphij str, ret, num); 42855714Skris#endif 429296465Sdelphij if (realloc_debug_func != NULL) 430296465Sdelphij realloc_debug_func(str, ret, num, file, line, 1); 43155714Skris 432296465Sdelphij return ret; 433296465Sdelphij} 43455714Skris 43559191Skrisvoid CRYPTO_free(void *str) 436296465Sdelphij{ 437296465Sdelphij if (free_debug_func != NULL) 438296465Sdelphij free_debug_func(str, 0); 439109998Smarkm#ifdef LEVITTE_DEBUG_MEM 440296465Sdelphij fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); 44155714Skris#endif 442296465Sdelphij free_func(str); 443296465Sdelphij if (free_debug_func != NULL) 444296465Sdelphij free_debug_func(NULL, 1); 445296465Sdelphij} 44655714Skris 44759191Skrisvoid *CRYPTO_remalloc(void *a, int num, const char *file, int line) 448296465Sdelphij{ 449296465Sdelphij if (a != NULL) 450296465Sdelphij OPENSSL_free(a); 451296465Sdelphij a = (char *)OPENSSL_malloc(num); 452296465Sdelphij return (a); 453296465Sdelphij} 45455714Skris 45559191Skrisvoid CRYPTO_set_mem_debug_options(long bits) 456296465Sdelphij{ 457296465Sdelphij if (set_debug_options_func != NULL) 458296465Sdelphij set_debug_options_func(bits); 459296465Sdelphij} 46055714Skris 46159191Skrislong CRYPTO_get_mem_debug_options(void) 462296465Sdelphij{ 463296465Sdelphij if (get_debug_options_func != NULL) 464296465Sdelphij return get_debug_options_func(); 465296465Sdelphij return 0; 466296465Sdelphij} 467194206Ssimon 468194206Ssimonint CRYPTO_push_info_(const char *info, const char *file, int line) 469296465Sdelphij{ 470296465Sdelphij if (push_info_func) 471296465Sdelphij return push_info_func(info, file, line); 472296465Sdelphij return 1; 473296465Sdelphij} 474194206Ssimon 475194206Ssimonint CRYPTO_pop_info(void) 476296465Sdelphij{ 477296465Sdelphij if (pop_info_func) 478296465Sdelphij return pop_info_func(); 479296465Sdelphij return 1; 480296465Sdelphij} 481194206Ssimon 482194206Ssimonint CRYPTO_remove_all_info(void) 483296465Sdelphij{ 484296465Sdelphij if (remove_all_info_func) 485296465Sdelphij return remove_all_info_func(); 486296465Sdelphij return 1; 487296465Sdelphij} 488