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.h188
1 files changed, 102 insertions, 86 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 0a38b5b87c..8ad8c25e5a 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -63,16 +63,26 @@
63extern "C" { 63extern "C" {
64#endif 64#endif
65 65
66#include "stack.h" 66#ifndef NO_FP_API
67#include <stdio.h>
68#endif
67 69
70#include <openssl/stack.h>
71#include <openssl/opensslv.h>
72
73#ifdef CHARSET_EBCDIC
74#include <openssl/ebcdic.h>
75#endif
76
77/* Backward compatibility to SSLeay */
68/* This is more to be used to check the correct DLL is being used 78/* This is more to be used to check the correct DLL is being used
69 * in the MS world. */ 79 * in the MS world. */
70#define SSLEAY_VERSION_NUMBER 0x0902 /* Version 0.5.1c would be 0513 */ 80#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
71
72#define SSLEAY_VERSION 0 81#define SSLEAY_VERSION 0
73/* #define SSLEAY_OPTIONS 1 no longer supported */ 82/* #define SSLEAY_OPTIONS 1 no longer supported */
74#define SSLEAY_CFLAGS 2 83#define SSLEAY_CFLAGS 2
75#define SSLEAY_BUILT_ON 3 84#define SSLEAY_BUILT_ON 3
85#define SSLEAY_PLATFORM 4
76 86
77/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock 87/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
78 * names in cryptlib.c 88 * names in cryptlib.c
@@ -92,19 +102,23 @@ extern "C" {
92#define CRYPTO_LOCK_SSL_CTX 12 102#define CRYPTO_LOCK_SSL_CTX 12
93#define CRYPTO_LOCK_SSL_CERT 13 103#define CRYPTO_LOCK_SSL_CERT 13
94#define CRYPTO_LOCK_SSL_SESSION 14 104#define CRYPTO_LOCK_SSL_SESSION 14
95#define CRYPTO_LOCK_SSL 15 105#define CRYPTO_LOCK_SSL_SESS_CERT 15
96#define CRYPTO_LOCK_RAND 16 106#define CRYPTO_LOCK_SSL 16
97#define CRYPTO_LOCK_MALLOC 17 107#define CRYPTO_LOCK_RAND 17
98#define CRYPTO_LOCK_BIO 18 108#define CRYPTO_LOCK_MALLOC 18
99#define CRYPTO_LOCK_BIO_GETHOSTBYNAME 19 109#define CRYPTO_LOCK_BIO 19
100#define CRYPTO_LOCK_RSA_BLINDING 20 110#define CRYPTO_LOCK_GETHOSTBYNAME 20
101#define CRYPTO_NUM_LOCKS 21 111#define CRYPTO_LOCK_GETSERVBYNAME 21
112#define CRYPTO_LOCK_READDIR 22
113#define CRYPTO_LOCK_RSA_BLINDING 23
114#define CRYPTO_NUM_LOCKS 24
102 115
103#define CRYPTO_LOCK 1 116#define CRYPTO_LOCK 1
104#define CRYPTO_UNLOCK 2 117#define CRYPTO_UNLOCK 2
105#define CRYPTO_READ 4 118#define CRYPTO_READ 4
106#define CRYPTO_WRITE 8 119#define CRYPTO_WRITE 8
107 120
121#ifndef NO_LOCKING
108#ifndef CRYPTO_w_lock 122#ifndef CRYPTO_w_lock
109#define CRYPTO_w_lock(type) \ 123#define CRYPTO_w_lock(type) \
110 CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) 124 CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
@@ -116,14 +130,22 @@ extern "C" {
116 CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) 130 CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
117#define CRYPTO_add(addr,amount,type) \ 131#define CRYPTO_add(addr,amount,type) \
118 CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) 132 CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
119 133#endif
134#else
135#define CRYPTO_w_lock(a)
136#define CRYPTO_w_unlock(a)
137#define CRYPTO_r_lock(a)
138#define CRYPTO_r_unlock(a)
139#define CRYPTO_add(a,b,c) ((*(a))+=(b))
120#endif 140#endif
121 141
122/* The following can be used to detect memory leaks in the SSLeay library. 142/* The following can be used to detect memory leaks in the SSLeay library.
123 * It used, it turns on malloc checking */ 143 * It used, it turns on malloc checking */
124 144
125#define CRYPTO_MEM_CHECK_OFF 0x0 145#define CRYPTO_MEM_CHECK_OFF 0x0 /* an enume */
126#define CRYPTO_MEM_CHECK_ON 0x1 146#define CRYPTO_MEM_CHECK_ON 0x1 /* a bit */
147#define CRYPTO_MEM_CHECK_ENABLE 0x2 /* a bit */
148#define CRYPTO_MEM_CHECK_DISABLE 0x3 /* an enume */
127 149
128/* 150/*
129typedef struct crypto_mem_st 151typedef struct crypto_mem_st
@@ -178,37 +200,65 @@ typedef struct crypto_ex_data_func_st
178 (char *(*)())realloc,\ 200 (char *(*)())realloc,\
179 (void (*)())free) 201 (void (*)())free)
180 202
203#ifdef CRYPTO_MDEBUG_ALL
204# ifndef CRYPTO_MDEBUG_TIME
205# define CRYPTO_MDEBUG_TIME
206# endif
207# ifndef CRYPTO_MDEBUG_THREAD
208# define CRYPTO_MDEBUG_THREAD
209# endif
210#endif
211
212#if defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
213# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */
214# define CRYPTO_MDEBUG
215# endif
216#endif
217
181#ifdef CRYPTO_MDEBUG 218#ifdef CRYPTO_MDEBUG
219#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
220#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
221#define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
222#define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
182#define Malloc(num) CRYPTO_dbg_malloc((int)num,__FILE__,__LINE__) 223#define Malloc(num) CRYPTO_dbg_malloc((int)num,__FILE__,__LINE__)
183#define Realloc(addr,num) \ 224#define Realloc(addr,num) \
184 CRYPTO_dbg_realloc((char *)addr,(int)num,__FILE__,__LINE__) 225 CRYPTO_dbg_realloc((char *)addr,(int)num,__FILE__,__LINE__)
185#define Remalloc(addr,num) \ 226#define Remalloc(addr,num) \
186 CRYPTO_dbg_remalloc((char **)addr,(int)num,__FILE__,__LINE__) 227 CRYPTO_dbg_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
187#define FreeFunc CRYPTO_dbg_free 228#define FreeFunc CRYPTO_dbg_free
188#define Free(addr) CRYPTO_dbg_free((char *)(addr)) 229#define Free(addr) CRYPTO_dbg_free(addr)
230#define Malloc_locked(num) CRYPTO_malloc_locked((int)num)
231#define Free_locked(addr) CRYPTO_free_locked(addr)
189#else 232#else
233#define MemCheck_start()
234#define MemCheck_stop()
235#define MemCheck_on()
236#define MemCheck_off()
190#define Remalloc CRYPTO_remalloc 237#define Remalloc CRYPTO_remalloc
191#if defined(WIN32) || defined(MFUNC) 238#if defined(WIN32) || defined(MFUNC)
192#define Malloc CRYPTO_malloc 239#define Malloc CRYPTO_malloc
193#define Realloc(a,n) CRYPTO_realloc((char *)(a),(n)) 240#define Realloc(a,n) CRYPTO_realloc(a,(n))
194#define FreeFunc CRYPTO_free 241#define FreeFunc CRYPTO_free
195#define Free(addr) CRYPTO_free((char *)(addr)) 242#define Free(addr) CRYPTO_free(addr)
243#define Malloc_locked CRYPTO_malloc_locked
244#define Free_locked(addr) CRYPTO_free_locked(addr)
196#else 245#else
197#define Malloc malloc 246#define Malloc malloc
198#define Realloc realloc 247#define Realloc realloc
199#define FreeFunc free 248#define FreeFunc free
200#define Free(addr) free((char *)(addr)) 249#define Free(addr) free(addr)
250#define Malloc_locked malloc
251#define Free_locked(addr) free(addr)
201#endif /* WIN32 || MFUNC */ 252#endif /* WIN32 || MFUNC */
202#endif /* MDEBUG */ 253#endif /* MDEBUG */
203 254
204/* Case insensiteve linking causes problems.... */ 255/* Case insensiteve linking causes problems.... */
205#ifdef WIN16 256#if defined(WIN16) || defined(VMS)
206#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings 257#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings
207#endif 258#endif
208 259
209#ifndef NOPROTO
210 260
211char *SSLeay_version(int type); 261const char *SSLeay_version(int type);
212unsigned long SSLeay(void); 262unsigned long SSLeay(void);
213 263
214int CRYPTO_get_ex_new_index(int idx,STACK **sk,long argl,char *argp, 264int CRYPTO_get_ex_new_index(int idx,STACK **sk,long argl,char *argp,
@@ -221,33 +271,40 @@ void CRYPTO_new_ex_data(STACK *meth, char *obj, CRYPTO_EX_DATA *ad);
221 271
222int CRYPTO_mem_ctrl(int mode); 272int CRYPTO_mem_ctrl(int mode);
223int CRYPTO_get_new_lockid(char *name); 273int CRYPTO_get_new_lockid(char *name);
224void CRYPTO_lock(int mode, int type,char *file,int line); 274
225void CRYPTO_set_locking_callback(void (*func)(int mode,int type,char *file, 275int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */
226 int line)); 276void CRYPTO_lock(int mode, int type,const char *file,int line);
227void (*CRYPTO_get_locking_callback(void))(int mode,int type,char *file, 277void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
278 const char *file,int line));
279void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,
228 int line); 280 int line);
229void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount, 281void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
230 int type,char *file, int line)); 282 const char *file, int line));
231int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount, 283int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
232 int type,char *file,int line); 284 const char *file,int line);
233void CRYPTO_set_id_callback(unsigned long (*func)(void)); 285void CRYPTO_set_id_callback(unsigned long (*func)(void));
234unsigned long (*CRYPTO_get_id_callback(void))(void); 286unsigned long (*CRYPTO_get_id_callback(void))(void);
235unsigned long CRYPTO_thread_id(void); 287unsigned long CRYPTO_thread_id(void);
236char *CRYPTO_get_lock_name(int type); 288const char *CRYPTO_get_lock_name(int type);
237int CRYPTO_add_lock(int *pointer,int amount,int type, char *file,int line); 289int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
290 int line);
238 291
239void CRYPTO_set_mem_functions(char *(*m)(),char *(*r)(), void (*free_func)()); 292void CRYPTO_set_mem_functions(char *(*m)(),char *(*r)(), void (*free_func)());
240void CRYPTO_get_mem_functions(char *(**m)(),char *(**r)(), void (**f)()); 293void CRYPTO_get_mem_functions(char *(**m)(),char *(**r)(), void (**f)());
241 294void CRYPTO_set_locked_mem_functions(char *(*m)(), void (*free_func)());
242char *CRYPTO_malloc(int num); 295void CRYPTO_get_locked_mem_functions(char *(**m)(), void (**f)());
243char *CRYPTO_realloc(char *addr,int num); 296
244void CRYPTO_free(char *); 297void *CRYPTO_malloc_locked(int num);
245char *CRYPTO_remalloc(char *addr,int num); 298void CRYPTO_free_locked(void *);
246 299void *CRYPTO_malloc(int num);
247char *CRYPTO_dbg_malloc(int num,char *file,int line); 300void CRYPTO_free(void *);
248char *CRYPTO_dbg_realloc(char *addr,int num,char *file,int line); 301void *CRYPTO_realloc(void *addr,int num);
249void CRYPTO_dbg_free(char *); 302void *CRYPTO_remalloc(void *addr,int num);
250char *CRYPTO_dbg_remalloc(char *addr,int num,char *file,int line); 303
304void *CRYPTO_dbg_malloc(int num,const char *file,int line);
305void *CRYPTO_dbg_realloc(void *addr,int num,const char *file,int line);
306void CRYPTO_dbg_free(void *);
307void *CRYPTO_dbg_remalloc(void *addr,int num,const char *file,int line);
251#ifndef NO_FP_API 308#ifndef NO_FP_API
252void CRYPTO_mem_leaks_fp(FILE *); 309void CRYPTO_mem_leaks_fp(FILE *);
253#endif 310#endif
@@ -257,52 +314,11 @@ void CRYPTO_mem_leaks_cb(void (*cb)());
257 314
258void ERR_load_CRYPTO_strings(void ); 315void ERR_load_CRYPTO_strings(void );
259 316
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
301void ERR_load_CRYPTO_strings();
302
303#endif
304
305/* BEGIN ERROR CODES */ 317/* BEGIN ERROR CODES */
318/* The following lines are auto generated by the script mkerr.pl. Any changes
319 * made after this point may be overwritten when the script is next run.
320 */
321
306/* Error codes for the CRYPTO functions. */ 322/* Error codes for the CRYPTO functions. */
307 323
308/* Function codes. */ 324/* Function codes. */
@@ -311,7 +327,7 @@ void ERR_load_CRYPTO_strings();
311#define CRYPTO_F_CRYPTO_SET_EX_DATA 102 327#define CRYPTO_F_CRYPTO_SET_EX_DATA 102
312 328
313/* Reason codes. */ 329/* Reason codes. */
314 330
315#ifdef __cplusplus 331#ifdef __cplusplus
316} 332}
317#endif 333#endif