diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/crypto.h | 86 |
1 files changed, 57 insertions, 29 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 41c937966e..52ee97b71a 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
| @@ -59,10 +59,6 @@ | |||
| 59 | #ifndef HEADER_CRYPTO_H | 59 | #ifndef HEADER_CRYPTO_H |
| 60 | #define HEADER_CRYPTO_H | 60 | #define HEADER_CRYPTO_H |
| 61 | 61 | ||
| 62 | #ifdef __cplusplus | ||
| 63 | extern "C" { | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdlib.h> | 62 | #include <stdlib.h> |
| 67 | 63 | ||
| 68 | #ifndef NO_FP_API | 64 | #ifndef NO_FP_API |
| @@ -77,10 +73,13 @@ extern "C" { | |||
| 77 | #include <openssl/ebcdic.h> | 73 | #include <openssl/ebcdic.h> |
| 78 | #endif | 74 | #endif |
| 79 | 75 | ||
| 80 | #if defined(VMS) || defined(__VMS) | 76 | /* Resolve problems on some operating systems with symbol names that clash |
| 81 | #include "vms_idhacks.h" | 77 | one way or another */ |
| 82 | #endif | 78 | #include <openssl/symhacks.h> |
| 83 | 79 | ||
| 80 | #ifdef __cplusplus | ||
| 81 | extern "C" { | ||
| 82 | #endif | ||
| 84 | 83 | ||
| 85 | /* Backward compatibility to SSLeay */ | 84 | /* Backward compatibility to SSLeay */ |
| 86 | /* 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 |
| @@ -121,7 +120,10 @@ extern "C" { | |||
| 121 | #define CRYPTO_LOCK_RSA_BLINDING 23 | 120 | #define CRYPTO_LOCK_RSA_BLINDING 23 |
| 122 | #define CRYPTO_LOCK_DH 24 | 121 | #define CRYPTO_LOCK_DH 24 |
| 123 | #define CRYPTO_LOCK_MALLOC2 25 | 122 | #define CRYPTO_LOCK_MALLOC2 25 |
| 124 | #define CRYPTO_NUM_LOCKS 26 | 123 | #define CRYPTO_LOCK_DSO 26 |
| 124 | #define CRYPTO_LOCK_DYNLOCK 27 | ||
| 125 | #define CRYPTO_LOCK_ENGINE 28 | ||
| 126 | #define CRYPTO_NUM_LOCKS 29 | ||
| 125 | 127 | ||
| 126 | #define CRYPTO_LOCK 1 | 128 | #define CRYPTO_LOCK 1 |
| 127 | #define CRYPTO_UNLOCK 2 | 129 | #define CRYPTO_UNLOCK 2 |
| @@ -149,6 +151,17 @@ extern "C" { | |||
| 149 | #define CRYPTO_add(a,b,c) ((*(a))+=(b)) | 151 | #define CRYPTO_add(a,b,c) ((*(a))+=(b)) |
| 150 | #endif | 152 | #endif |
| 151 | 153 | ||
| 154 | /* Some applications as well as some parts of OpenSSL need to allocate | ||
| 155 | and deallocate locks in a dynamic fashion. The following typedef | ||
| 156 | makes this possible in a type-safe manner. */ | ||
| 157 | /* struct CRYPTO_dynlock_value has to be defined by the application. */ | ||
| 158 | typedef struct | ||
| 159 | { | ||
| 160 | int references; | ||
| 161 | struct CRYPTO_dynlock_value *data; | ||
| 162 | } CRYPTO_dynlock; | ||
| 163 | |||
| 164 | |||
| 152 | /* The following can be used to detect memory leaks in the SSLeay library. | 165 | /* The following can be used to detect memory leaks in the SSLeay library. |
| 153 | * It used, it turns on malloc checking */ | 166 | * It used, it turns on malloc checking */ |
| 154 | 167 | ||
| @@ -230,11 +243,11 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) | |||
| 230 | * unless CRYPTO_MDEBUG is defined) */ | 243 | * unless CRYPTO_MDEBUG is defined) */ |
| 231 | #define CRYPTO_malloc_debug_init() do {\ | 244 | #define CRYPTO_malloc_debug_init() do {\ |
| 232 | CRYPTO_set_mem_debug_functions(\ | 245 | CRYPTO_set_mem_debug_functions(\ |
| 233 | (void (*)())CRYPTO_dbg_malloc,\ | 246 | CRYPTO_dbg_malloc,\ |
| 234 | (void (*)())CRYPTO_dbg_realloc,\ | 247 | CRYPTO_dbg_realloc,\ |
| 235 | (void (*)())CRYPTO_dbg_free,\ | 248 | CRYPTO_dbg_free,\ |
| 236 | (void (*)())CRYPTO_dbg_set_options,\ | 249 | CRYPTO_dbg_set_options,\ |
| 237 | (long (*)())CRYPTO_dbg_get_options);\ | 250 | CRYPTO_dbg_get_options);\ |
| 238 | } while(0) | 251 | } while(0) |
| 239 | 252 | ||
| 240 | int CRYPTO_mem_ctrl(int mode); | 253 | int CRYPTO_mem_ctrl(int mode); |
| @@ -249,22 +262,17 @@ int CRYPTO_is_mem_check_on(void); | |||
| 249 | #define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) | 262 | #define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) |
| 250 | #define is_MemCheck_on() CRYPTO_is_mem_check_on() | 263 | #define is_MemCheck_on() CRYPTO_is_mem_check_on() |
| 251 | 264 | ||
| 252 | #define Malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) | 265 | #define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) |
| 253 | #define Realloc(addr,num) \ | 266 | #define OPENSSL_realloc(addr,num) \ |
| 254 | CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) | 267 | CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) |
| 255 | #define Remalloc(addr,num) \ | 268 | #define OPENSSL_remalloc(addr,num) \ |
| 256 | CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__) | 269 | CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__) |
| 257 | #define FreeFunc CRYPTO_free | 270 | #define OPENSSL_freeFunc CRYPTO_free |
| 258 | #define Free(addr) CRYPTO_free(addr) | 271 | #define OPENSSL_free(addr) CRYPTO_free(addr) |
| 259 | 272 | ||
| 260 | #define Malloc_locked(num) CRYPTO_malloc_locked((int)num,__FILE__,__LINE__) | 273 | #define OPENSSL_malloc_locked(num) \ |
| 261 | #define Free_locked(addr) CRYPTO_free_locked(addr) | 274 | CRYPTO_malloc_locked((int)num,__FILE__,__LINE__) |
| 262 | 275 | #define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr) | |
| 263 | |||
| 264 | /* Case insensiteve linking causes problems.... */ | ||
| 265 | #if defined(WIN16) || defined(VMS) | ||
| 266 | #define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings | ||
| 267 | #endif | ||
| 268 | 276 | ||
| 269 | 277 | ||
| 270 | const char *SSLeay_version(int type); | 278 | const char *SSLeay_version(int type); |
| @@ -298,14 +306,32 @@ const char *CRYPTO_get_lock_name(int type); | |||
| 298 | int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, | 306 | int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, |
| 299 | int line); | 307 | int line); |
| 300 | 308 | ||
| 309 | int CRYPTO_get_new_dynlockid(void); | ||
| 310 | void CRYPTO_destroy_dynlockid(int i); | ||
| 311 | struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); | ||
| 312 | void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line)); | ||
| 313 | void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); | ||
| 314 | void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line)); | ||
| 315 | struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line); | ||
| 316 | void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line); | ||
| 317 | void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line); | ||
| 318 | |||
| 301 | /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- | 319 | /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- |
| 302 | * call the latter last if you need different functions */ | 320 | * call the latter last if you need different functions */ |
| 303 | int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *)); | 321 | int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *)); |
| 304 | int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *)); | 322 | int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *)); |
| 305 | int CRYPTO_set_mem_debug_functions(void (*m)(),void (*r)(),void (*f)(),void (*so)(),long (*go)()); | 323 | int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), |
| 324 | void (*r)(void *,void *,int,const char *,int,int), | ||
| 325 | void (*f)(void *,int), | ||
| 326 | void (*so)(long), | ||
| 327 | long (*go)(void)); | ||
| 306 | void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); | 328 | void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); |
| 307 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); | 329 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); |
| 308 | void CRYPTO_get_mem_debug_functions(void (**m)(),void (**r)(),void (**f)(),void (**so)(),long (**go)()); | 330 | void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), |
| 331 | void (**r)(void *,void *,int,const char *,int,int), | ||
| 332 | void (**f)(void *,int), | ||
| 333 | void (**so)(long), | ||
| 334 | long (**go)(void)); | ||
| 309 | 335 | ||
| 310 | void *CRYPTO_malloc_locked(int num, const char *file, int line); | 336 | void *CRYPTO_malloc_locked(int num, const char *file, int line); |
| 311 | void CRYPTO_free_locked(void *); | 337 | void CRYPTO_free_locked(void *); |
| @@ -348,7 +374,7 @@ void CRYPTO_mem_leaks_fp(FILE *); | |||
| 348 | #endif | 374 | #endif |
| 349 | void CRYPTO_mem_leaks(struct bio_st *bio); | 375 | void CRYPTO_mem_leaks(struct bio_st *bio); |
| 350 | /* unsigned long order, char *file, int line, int num_bytes, char *addr */ | 376 | /* unsigned long order, char *file, int line, int num_bytes, char *addr */ |
| 351 | void CRYPTO_mem_leaks_cb(void (*cb)()); | 377 | void CRYPTO_mem_leaks_cb(void (*cb)(unsigned long, const char *, int, int, void *)); |
| 352 | 378 | ||
| 353 | void ERR_load_CRYPTO_strings(void); | 379 | void ERR_load_CRYPTO_strings(void); |
| 354 | 380 | ||
| @@ -361,10 +387,12 @@ void ERR_load_CRYPTO_strings(void); | |||
| 361 | 387 | ||
| 362 | /* Function codes. */ | 388 | /* Function codes. */ |
| 363 | #define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 | 389 | #define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 |
| 390 | #define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103 | ||
| 364 | #define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 | 391 | #define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 |
| 365 | #define CRYPTO_F_CRYPTO_SET_EX_DATA 102 | 392 | #define CRYPTO_F_CRYPTO_SET_EX_DATA 102 |
| 366 | 393 | ||
| 367 | /* Reason codes. */ | 394 | /* Reason codes. */ |
| 395 | #define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100 | ||
| 368 | 396 | ||
| 369 | #ifdef __cplusplus | 397 | #ifdef __cplusplus |
| 370 | } | 398 | } |
