summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/crypto.h')
-rw-r--r--src/lib/libcrypto/crypto.h430
1 files changed, 281 insertions, 149 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 0a38b5b87c..fc6ff860af 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -59,27 +59,45 @@
59#ifndef HEADER_CRYPTO_H 59#ifndef HEADER_CRYPTO_H
60#define HEADER_CRYPTO_H 60#define HEADER_CRYPTO_H
61 61
62#include <stdlib.h>
63
64#ifndef OPENSSL_NO_FP_API
65#include <stdio.h>
66#endif
67
68#include <openssl/stack.h>
69#include <openssl/safestack.h>
70#include <openssl/opensslv.h>
71
72#ifdef CHARSET_EBCDIC
73#include <openssl/ebcdic.h>
74#endif
75
76/* Resolve problems on some operating systems with symbol names that clash
77 one way or another */
78#include <openssl/symhacks.h>
79
62#ifdef __cplusplus 80#ifdef __cplusplus
63extern "C" { 81extern "C" {
64#endif 82#endif
65 83
66#include "stack.h" 84/* Backward compatibility to SSLeay */
67
68/* This is more to be used to check the correct DLL is being used 85/* This is more to be used to check the correct DLL is being used
69 * in the MS world. */ 86 * in the MS world. */
70#define SSLEAY_VERSION_NUMBER 0x0902 /* Version 0.5.1c would be 0513 */ 87#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
71
72#define SSLEAY_VERSION 0 88#define SSLEAY_VERSION 0
73/* #define SSLEAY_OPTIONS 1 no longer supported */ 89/* #define SSLEAY_OPTIONS 1 no longer supported */
74#define SSLEAY_CFLAGS 2 90#define SSLEAY_CFLAGS 2
75#define SSLEAY_BUILT_ON 3 91#define SSLEAY_BUILT_ON 3
92#define SSLEAY_PLATFORM 4
93#define SSLEAY_DIR 5
76 94
77/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock 95/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
78 * names in cryptlib.c 96 * names in cryptlib.c
79 */ 97 */
80 98
81#define CRYPTO_LOCK_ERR 1 99#define CRYPTO_LOCK_ERR 1
82#define CRYPTO_LOCK_ERR_HASH 2 100#define CRYPTO_LOCK_EX_DATA 2
83#define CRYPTO_LOCK_X509 3 101#define CRYPTO_LOCK_X509 3
84#define CRYPTO_LOCK_X509_INFO 4 102#define CRYPTO_LOCK_X509_INFO 4
85#define CRYPTO_LOCK_X509_PKEY 5 103#define CRYPTO_LOCK_X509_PKEY 5
@@ -92,19 +110,30 @@ extern "C" {
92#define CRYPTO_LOCK_SSL_CTX 12 110#define CRYPTO_LOCK_SSL_CTX 12
93#define CRYPTO_LOCK_SSL_CERT 13 111#define CRYPTO_LOCK_SSL_CERT 13
94#define CRYPTO_LOCK_SSL_SESSION 14 112#define CRYPTO_LOCK_SSL_SESSION 14
95#define CRYPTO_LOCK_SSL 15 113#define CRYPTO_LOCK_SSL_SESS_CERT 15
96#define CRYPTO_LOCK_RAND 16 114#define CRYPTO_LOCK_SSL 16
97#define CRYPTO_LOCK_MALLOC 17 115#define CRYPTO_LOCK_RAND 17
98#define CRYPTO_LOCK_BIO 18 116#define CRYPTO_LOCK_RAND2 18
99#define CRYPTO_LOCK_BIO_GETHOSTBYNAME 19 117#define CRYPTO_LOCK_MALLOC 19
100#define CRYPTO_LOCK_RSA_BLINDING 20 118#define CRYPTO_LOCK_BIO 20
101#define CRYPTO_NUM_LOCKS 21 119#define CRYPTO_LOCK_GETHOSTBYNAME 21
120#define CRYPTO_LOCK_GETSERVBYNAME 22
121#define CRYPTO_LOCK_READDIR 23
122#define CRYPTO_LOCK_RSA_BLINDING 24
123#define CRYPTO_LOCK_DH 25
124#define CRYPTO_LOCK_MALLOC2 26
125#define CRYPTO_LOCK_DSO 27
126#define CRYPTO_LOCK_DYNLOCK 28
127#define CRYPTO_LOCK_ENGINE 29
128#define CRYPTO_LOCK_UI 30
129#define CRYPTO_NUM_LOCKS 31
102 130
103#define CRYPTO_LOCK 1 131#define CRYPTO_LOCK 1
104#define CRYPTO_UNLOCK 2 132#define CRYPTO_UNLOCK 2
105#define CRYPTO_READ 4 133#define CRYPTO_READ 4
106#define CRYPTO_WRITE 8 134#define CRYPTO_WRITE 8
107 135
136#ifndef OPENSSL_NO_LOCKING
108#ifndef CRYPTO_w_lock 137#ifndef CRYPTO_w_lock
109#define CRYPTO_w_lock(type) \ 138#define CRYPTO_w_lock(type) \
110 CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) 139 CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
@@ -116,23 +145,44 @@ extern "C" {
116 CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) 145 CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
117#define CRYPTO_add(addr,amount,type) \ 146#define CRYPTO_add(addr,amount,type) \
118 CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) 147 CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
119 148#endif
149#else
150#define CRYPTO_w_lock(a)
151#define CRYPTO_w_unlock(a)
152#define CRYPTO_r_lock(a)
153#define CRYPTO_r_unlock(a)
154#define CRYPTO_add(a,b,c) ((*(a))+=(b))
120#endif 155#endif
121 156
157/* Some applications as well as some parts of OpenSSL need to allocate
158 and deallocate locks in a dynamic fashion. The following typedef
159 makes this possible in a type-safe manner. */
160/* struct CRYPTO_dynlock_value has to be defined by the application. */
161typedef struct
162 {
163 int references;
164 struct CRYPTO_dynlock_value *data;
165 } CRYPTO_dynlock;
166
167
122/* The following can be used to detect memory leaks in the SSLeay library. 168/* The following can be used to detect memory leaks in the SSLeay library.
123 * It used, it turns on malloc checking */ 169 * It used, it turns on malloc checking */
124 170
125#define CRYPTO_MEM_CHECK_OFF 0x0 171#define CRYPTO_MEM_CHECK_OFF 0x0 /* an enume */
126#define CRYPTO_MEM_CHECK_ON 0x1 172#define CRYPTO_MEM_CHECK_ON 0x1 /* a bit */
173#define CRYPTO_MEM_CHECK_ENABLE 0x2 /* a bit */
174#define CRYPTO_MEM_CHECK_DISABLE 0x3 /* an enume */
175
176/* The following are bit values to turn on or off options connected to the
177 * malloc checking functionality */
178
179/* Adds time to the memory checking information */
180#define V_CRYPTO_MDEBUG_TIME 0x1 /* a bit */
181/* Adds thread number to the memory checking information */
182#define V_CRYPTO_MDEBUG_THREAD 0x2 /* a bit */
183
184#define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
127 185
128/*
129typedef struct crypto_mem_st
130 {
131 char *(*malloc_func)();
132 char *(*realloc_func)();
133 void (*free_func)();
134 } CRYPTO_MEM_FUNC;
135*/
136 186
137/* predec of the BIO type */ 187/* predec of the BIO type */
138typedef struct bio_st BIO_dummy; 188typedef struct bio_st BIO_dummy;
@@ -143,24 +193,30 @@ typedef struct crypto_ex_data_st
143 int dummy; /* gcc is screwing up this data structure :-( */ 193 int dummy; /* gcc is screwing up this data structure :-( */
144 } CRYPTO_EX_DATA; 194 } CRYPTO_EX_DATA;
145 195
196/* Called when a new object is created */
197typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
198 int idx, long argl, void *argp);
199/* Called when an object is free()ed */
200typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
201 int idx, long argl, void *argp);
202/* Called when we need to dup an object */
203typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
204 int idx, long argl, void *argp);
205
146/* This stuff is basically class callback functions 206/* This stuff is basically class callback functions
147 * The current classes are SSL_CTX, SSL, SSL_SESION, and a few more */ 207 * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
208
148typedef struct crypto_ex_data_func_st 209typedef struct crypto_ex_data_func_st
149 { 210 {
150 long argl; /* Arbitary long */ 211 long argl; /* Arbitary long */
151 char *argp; /* Arbitary char * */ 212 void *argp; /* Arbitary void * */
152 /* Called when a new object is created */ 213 CRYPTO_EX_new *new_func;
153 int (*new_func)(/*char *obj, 214 CRYPTO_EX_free *free_func;
154 char *item,int index,long argl,char *argp*/); 215 CRYPTO_EX_dup *dup_func;
155 /* Called when this object is free()ed */
156 void (*free_func)(/*char *obj,
157 char *item,int index,long argl,char *argp*/);
158
159 /* Called when we need to dup this one */
160 int (*dup_func)(/*char *obj_to,char *obj_from,
161 char **new,int index,long argl,char *argp*/);
162 } CRYPTO_EX_DATA_FUNCS; 216 } CRYPTO_EX_DATA_FUNCS;
163 217
218DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
219
164/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA 220/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA
165 * entry. 221 * entry.
166 */ 222 */
@@ -171,149 +227,225 @@ typedef struct crypto_ex_data_func_st
171#define CRYPTO_EX_INDEX_SSL_SESSION 3 227#define CRYPTO_EX_INDEX_SSL_SESSION 3
172#define CRYPTO_EX_INDEX_X509_STORE 4 228#define CRYPTO_EX_INDEX_X509_STORE 4
173#define CRYPTO_EX_INDEX_X509_STORE_CTX 5 229#define CRYPTO_EX_INDEX_X509_STORE_CTX 5
230#define CRYPTO_EX_INDEX_RSA 6
231#define CRYPTO_EX_INDEX_DSA 7
232#define CRYPTO_EX_INDEX_DH 8
233#define CRYPTO_EX_INDEX_ENGINE 9
234#define CRYPTO_EX_INDEX_X509 10
235#define CRYPTO_EX_INDEX_UI 11
174 236
175/* Use this for win32 DLL's */ 237/* Dynamically assigned indexes start from this value (don't use directly, use
238 * via CRYPTO_ex_data_new_class). */
239#define CRYPTO_EX_INDEX_USER 100
240
241
242/* This is the default callbacks, but we can have others as well:
243 * this is needed in Win32 where the application malloc and the
244 * library malloc may not be the same.
245 */
176#define CRYPTO_malloc_init() CRYPTO_set_mem_functions(\ 246#define CRYPTO_malloc_init() CRYPTO_set_mem_functions(\
177 (char *(*)())malloc,\ 247 malloc, realloc, free)
178 (char *(*)())realloc,\ 248
179 (void (*)())free) 249#if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
180 250# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */
181#ifdef CRYPTO_MDEBUG 251# define CRYPTO_MDEBUG
182#define Malloc(num) CRYPTO_dbg_malloc((int)num,__FILE__,__LINE__) 252# endif
183#define Realloc(addr,num) \
184 CRYPTO_dbg_realloc((char *)addr,(int)num,__FILE__,__LINE__)
185#define Remalloc(addr,num) \
186 CRYPTO_dbg_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
187#define FreeFunc CRYPTO_dbg_free
188#define Free(addr) CRYPTO_dbg_free((char *)(addr))
189#else
190#define Remalloc CRYPTO_remalloc
191#if defined(WIN32) || defined(MFUNC)
192#define Malloc CRYPTO_malloc
193#define Realloc(a,n) CRYPTO_realloc((char *)(a),(n))
194#define FreeFunc CRYPTO_free
195#define Free(addr) CRYPTO_free((char *)(addr))
196#else
197#define Malloc malloc
198#define Realloc realloc
199#define FreeFunc free
200#define Free(addr) free((char *)(addr))
201#endif /* WIN32 || MFUNC */
202#endif /* MDEBUG */
203
204/* Case insensiteve linking causes problems.... */
205#ifdef WIN16
206#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings
207#endif 253#endif
208 254
209#ifndef NOPROTO 255/* Set standard debugging functions (not done by default
256 * unless CRYPTO_MDEBUG is defined) */
257#define CRYPTO_malloc_debug_init() do {\
258 CRYPTO_set_mem_debug_functions(\
259 CRYPTO_dbg_malloc,\
260 CRYPTO_dbg_realloc,\
261 CRYPTO_dbg_free,\
262 CRYPTO_dbg_set_options,\
263 CRYPTO_dbg_get_options);\
264 } while(0)
265
266int CRYPTO_mem_ctrl(int mode);
267int CRYPTO_is_mem_check_on(void);
268
269/* for applications */
270#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
271#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
272
273/* for library-internal use */
274#define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
275#define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
276#define is_MemCheck_on() CRYPTO_is_mem_check_on()
210 277
211char *SSLeay_version(int type); 278#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
279#define OPENSSL_realloc(addr,num) \
280 CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
281#define OPENSSL_remalloc(addr,num) \
282 CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
283#define OPENSSL_freeFunc CRYPTO_free
284#define OPENSSL_free(addr) CRYPTO_free(addr)
285
286#define OPENSSL_malloc_locked(num) \
287 CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
288#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
289
290
291const char *SSLeay_version(int type);
212unsigned long SSLeay(void); 292unsigned long SSLeay(void);
213 293
214int CRYPTO_get_ex_new_index(int idx,STACK **sk,long argl,char *argp, 294int OPENSSL_issetugid(void);
215 int (*new_func)(),int (*dup_func)(),void (*free_func)()); 295
216int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad,int idx,char *val); 296/* An opaque type representing an implementation of "ex_data" support */
217char *CRYPTO_get_ex_data(CRYPTO_EX_DATA *ad,int idx); 297typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL;
218int CRYPTO_dup_ex_data(STACK *meth,CRYPTO_EX_DATA *from,CRYPTO_EX_DATA *to); 298/* Return an opaque pointer to the current "ex_data" implementation */
219void CRYPTO_free_ex_data(STACK *meth,char *obj,CRYPTO_EX_DATA *ad); 299const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
220void CRYPTO_new_ex_data(STACK *meth, char *obj, CRYPTO_EX_DATA *ad); 300/* Sets the "ex_data" implementation to be used (if it's not too late) */
301int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);
302/* Get a new "ex_data" class, and return the corresponding "class_index" */
303int CRYPTO_ex_data_new_class(void);
304/* Within a given class, get/register a new index */
305int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
306 CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
307 CRYPTO_EX_free *free_func);
308/* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given
309 * class (invokes whatever per-class callbacks are applicable) */
310int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
311int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
312 CRYPTO_EX_DATA *from);
313void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
314/* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index
315 * (relative to the class type involved) */
316int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
317void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx);
318/* This function cleans up all "ex_data" state. It mustn't be called under
319 * potential race-conditions. */
320void CRYPTO_cleanup_all_ex_data(void);
221 321
222int CRYPTO_mem_ctrl(int mode);
223int CRYPTO_get_new_lockid(char *name); 322int CRYPTO_get_new_lockid(char *name);
224void CRYPTO_lock(int mode, int type,char *file,int line); 323
225void CRYPTO_set_locking_callback(void (*func)(int mode,int type,char *file, 324int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */
226 int line)); 325void CRYPTO_lock(int mode, int type,const char *file,int line);
227void (*CRYPTO_get_locking_callback(void))(int mode,int type,char *file, 326void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
327 const char *file,int line));
328void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,
228 int line); 329 int line);
229void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount, 330void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
230 int type,char *file, int line)); 331 const char *file, int line));
231int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount, 332int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
232 int type,char *file,int line); 333 const char *file,int line);
233void CRYPTO_set_id_callback(unsigned long (*func)(void)); 334void CRYPTO_set_id_callback(unsigned long (*func)(void));
234unsigned long (*CRYPTO_get_id_callback(void))(void); 335unsigned long (*CRYPTO_get_id_callback(void))(void);
235unsigned long CRYPTO_thread_id(void); 336unsigned long CRYPTO_thread_id(void);
236char *CRYPTO_get_lock_name(int type); 337const char *CRYPTO_get_lock_name(int type);
237int CRYPTO_add_lock(int *pointer,int amount,int type, char *file,int line); 338int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
238 339 int line);
239void CRYPTO_set_mem_functions(char *(*m)(),char *(*r)(), void (*free_func)()); 340
240void CRYPTO_get_mem_functions(char *(**m)(),char *(**r)(), void (**f)()); 341int CRYPTO_get_new_dynlockid(void);
241 342void CRYPTO_destroy_dynlockid(int i);
242char *CRYPTO_malloc(int num); 343struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
243char *CRYPTO_realloc(char *addr,int num); 344void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line));
244void CRYPTO_free(char *); 345void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line));
245char *CRYPTO_remalloc(char *addr,int num); 346void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line));
246 347struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line);
247char *CRYPTO_dbg_malloc(int num,char *file,int line); 348void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line);
248char *CRYPTO_dbg_realloc(char *addr,int num,char *file,int line); 349void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line);
249void CRYPTO_dbg_free(char *); 350
250char *CRYPTO_dbg_remalloc(char *addr,int num,char *file,int line); 351/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --
251#ifndef NO_FP_API 352 * call the latter last if you need different functions */
353int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));
354int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));
355int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),
356 void *(*r)(void *,size_t,const char *,int),
357 void (*f)(void *));
358int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),
359 void (*free_func)(void *));
360int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
361 void (*r)(void *,void *,int,const char *,int,int),
362 void (*f)(void *,int),
363 void (*so)(long),
364 long (*go)(void));
365void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
366void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
367void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
368 void *(**r)(void *, size_t,const char *,int),
369 void (**f)(void *));
370void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),
371 void (**f)(void *));
372void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
373 void (**r)(void *,void *,int,const char *,int,int),
374 void (**f)(void *,int),
375 void (**so)(long),
376 long (**go)(void));
377
378void *CRYPTO_malloc_locked(int num, const char *file, int line);
379void CRYPTO_free_locked(void *);
380void *CRYPTO_malloc(int num, const char *file, int line);
381void CRYPTO_free(void *);
382void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
383void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
384
385void CRYPTO_set_mem_debug_options(long bits);
386long CRYPTO_get_mem_debug_options(void);
387
388#define CRYPTO_push_info(info) \
389 CRYPTO_push_info_(info, __FILE__, __LINE__);
390int CRYPTO_push_info_(const char *info, const char *file, int line);
391int CRYPTO_pop_info(void);
392int CRYPTO_remove_all_info(void);
393
394
395/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
396 * used as default in CRYPTO_MDEBUG compilations): */
397/* The last argument has the following significance:
398 *
399 * 0: called before the actual memory allocation has taken place
400 * 1: called after the actual memory allocation has taken place
401 */
402void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
403void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);
404void CRYPTO_dbg_free(void *addr,int before_p);
405/* Tell the debugging code about options. By default, the following values
406 * apply:
407 *
408 * 0: Clear all options.
409 * V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option.
410 * V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option.
411 * V_CRYPTO_MDEBUG_ALL (3): 1 + 2
412 */
413void CRYPTO_dbg_set_options(long bits);
414long CRYPTO_dbg_get_options(void);
415
416
417#ifndef OPENSSL_NO_FP_API
252void CRYPTO_mem_leaks_fp(FILE *); 418void CRYPTO_mem_leaks_fp(FILE *);
253#endif 419#endif
254void CRYPTO_mem_leaks(struct bio_st *bio); 420void CRYPTO_mem_leaks(struct bio_st *bio);
255/* unsigned long order, char *file, int line, int num_bytes, char *addr */ 421/* unsigned long order, char *file, int line, int num_bytes, char *addr */
256void CRYPTO_mem_leaks_cb(void (*cb)()); 422typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
257 423void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
258void ERR_load_CRYPTO_strings(void );
259
260#else
261
262int CRYPTO_get_ex_new_index();
263int CRYPTO_set_ex_data();
264char *CRYPTO_get_ex_data();
265int CRYPTO_dup_ex_data();
266void CRYPTO_free_ex_data();
267void CRYPTO_new_ex_data();
268
269int CRYPTO_mem_ctrl();
270char *SSLeay_version();
271unsigned long SSLeay();
272
273int CRYPTO_get_new_lockid();
274void CRYPTO_lock();
275void CRYPTO_set_locking_callback();
276void (*CRYPTO_get_locking_callback())();
277void CRYPTO_set_add_lock_callback();
278int (*CRYPTO_get_add_lock_callback())();
279void CRYPTO_set_id_callback();
280unsigned long (*CRYPTO_get_id_callback())();
281unsigned long CRYPTO_thread_id();
282char *CRYPTO_get_lock_name();
283int CRYPTO_add_lock();
284
285void CRYPTO_set_mem_functions();
286void CRYPTO_get_mem_functions();
287char *CRYPTO_malloc();
288char *CRYPTO_realloc();
289void CRYPTO_free();
290char *CRYPTO_remalloc();
291char *CRYPTO_dbg_remalloc();
292char *CRYPTO_dbg_malloc();
293char *CRYPTO_dbg_realloc();
294void CRYPTO_dbg_free();
295#ifndef NO_FP_API
296void CRYPTO_mem_leaks_fp();
297#endif
298void CRYPTO_mem_leaks();
299void CRYPTO_mem_leaks_cb();
300 424
301void ERR_load_CRYPTO_strings();
302
303#endif
304 425
305/* BEGIN ERROR CODES */ 426/* BEGIN ERROR CODES */
427/* The following lines are auto generated by the script mkerr.pl. Any changes
428 * made after this point may be overwritten when the script is next run.
429 */
430void ERR_load_CRYPTO_strings(void);
431
306/* Error codes for the CRYPTO functions. */ 432/* Error codes for the CRYPTO functions. */
307 433
308/* Function codes. */ 434/* Function codes. */
309#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 435#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100
436#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103
310#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 437#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101
311#define CRYPTO_F_CRYPTO_SET_EX_DATA 102 438#define CRYPTO_F_CRYPTO_SET_EX_DATA 102
439#define CRYPTO_F_DEF_ADD_INDEX 104
440#define CRYPTO_F_DEF_GET_CLASS 105
441#define CRYPTO_F_INT_DUP_EX_DATA 106
442#define CRYPTO_F_INT_FREE_EX_DATA 107
443#define CRYPTO_F_INT_NEW_EX_DATA 108
312 444
313/* Reason codes. */ 445/* Reason codes. */
314 446#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100
447
315#ifdef __cplusplus 448#ifdef __cplusplus
316} 449}
317#endif 450#endif
318#endif 451#endif
319