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.h110
1 files changed, 79 insertions, 31 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 9257673279..fc6ff860af 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -61,7 +61,7 @@
61 61
62#include <stdlib.h> 62#include <stdlib.h>
63 63
64#ifndef NO_FP_API 64#ifndef OPENSSL_NO_FP_API
65#include <stdio.h> 65#include <stdio.h>
66#endif 66#endif
67 67
@@ -90,13 +90,14 @@ extern "C" {
90#define SSLEAY_CFLAGS 2 90#define SSLEAY_CFLAGS 2
91#define SSLEAY_BUILT_ON 3 91#define SSLEAY_BUILT_ON 3
92#define SSLEAY_PLATFORM 4 92#define SSLEAY_PLATFORM 4
93#define SSLEAY_DIR 5
93 94
94/* 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
95 * names in cryptlib.c 96 * names in cryptlib.c
96 */ 97 */
97 98
98#define CRYPTO_LOCK_ERR 1 99#define CRYPTO_LOCK_ERR 1
99#define CRYPTO_LOCK_ERR_HASH 2 100#define CRYPTO_LOCK_EX_DATA 2
100#define CRYPTO_LOCK_X509 3 101#define CRYPTO_LOCK_X509 3
101#define CRYPTO_LOCK_X509_INFO 4 102#define CRYPTO_LOCK_X509_INFO 4
102#define CRYPTO_LOCK_X509_PKEY 5 103#define CRYPTO_LOCK_X509_PKEY 5
@@ -112,25 +113,27 @@ extern "C" {
112#define CRYPTO_LOCK_SSL_SESS_CERT 15 113#define CRYPTO_LOCK_SSL_SESS_CERT 15
113#define CRYPTO_LOCK_SSL 16 114#define CRYPTO_LOCK_SSL 16
114#define CRYPTO_LOCK_RAND 17 115#define CRYPTO_LOCK_RAND 17
115#define CRYPTO_LOCK_MALLOC 18 116#define CRYPTO_LOCK_RAND2 18
116#define CRYPTO_LOCK_BIO 19 117#define CRYPTO_LOCK_MALLOC 19
117#define CRYPTO_LOCK_GETHOSTBYNAME 20 118#define CRYPTO_LOCK_BIO 20
118#define CRYPTO_LOCK_GETSERVBYNAME 21 119#define CRYPTO_LOCK_GETHOSTBYNAME 21
119#define CRYPTO_LOCK_READDIR 22 120#define CRYPTO_LOCK_GETSERVBYNAME 22
120#define CRYPTO_LOCK_RSA_BLINDING 23 121#define CRYPTO_LOCK_READDIR 23
121#define CRYPTO_LOCK_DH 24 122#define CRYPTO_LOCK_RSA_BLINDING 24
122#define CRYPTO_LOCK_MALLOC2 25 123#define CRYPTO_LOCK_DH 25
123#define CRYPTO_LOCK_DSO 26 124#define CRYPTO_LOCK_MALLOC2 26
124#define CRYPTO_LOCK_DYNLOCK 27 125#define CRYPTO_LOCK_DSO 27
125#define CRYPTO_LOCK_ENGINE 28 126#define CRYPTO_LOCK_DYNLOCK 28
126#define CRYPTO_NUM_LOCKS 29 127#define CRYPTO_LOCK_ENGINE 29
128#define CRYPTO_LOCK_UI 30
129#define CRYPTO_NUM_LOCKS 31
127 130
128#define CRYPTO_LOCK 1 131#define CRYPTO_LOCK 1
129#define CRYPTO_UNLOCK 2 132#define CRYPTO_UNLOCK 2
130#define CRYPTO_READ 4 133#define CRYPTO_READ 4
131#define CRYPTO_WRITE 8 134#define CRYPTO_WRITE 8
132 135
133#ifndef NO_LOCKING 136#ifndef OPENSSL_NO_LOCKING
134#ifndef CRYPTO_w_lock 137#ifndef CRYPTO_w_lock
135#define CRYPTO_w_lock(type) \ 138#define CRYPTO_w_lock(type) \
136 CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) 139 CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
@@ -224,6 +227,16 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
224#define CRYPTO_EX_INDEX_SSL_SESSION 3 227#define CRYPTO_EX_INDEX_SSL_SESSION 3
225#define CRYPTO_EX_INDEX_X509_STORE 4 228#define CRYPTO_EX_INDEX_X509_STORE 4
226#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
236
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
227 240
228 241
229/* This is the default callbacks, but we can have others as well: 242/* This is the default callbacks, but we can have others as well:
@@ -280,14 +293,31 @@ unsigned long SSLeay(void);
280 293
281int OPENSSL_issetugid(void); 294int OPENSSL_issetugid(void);
282 295
283int CRYPTO_get_ex_new_index(int idx, STACK_OF(CRYPTO_EX_DATA_FUNCS) **skp, long argl, void *argp, 296/* An opaque type representing an implementation of "ex_data" support */
284 CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 297typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL;
298/* Return an opaque pointer to the current "ex_data" implementation */
299const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
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) */
285int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); 316int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
286void *CRYPTO_get_ex_data(CRYPTO_EX_DATA *ad,int idx); 317void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx);
287int CRYPTO_dup_ex_data(STACK_OF(CRYPTO_EX_DATA_FUNCS) *meth, CRYPTO_EX_DATA *to, 318/* This function cleans up all "ex_data" state. It mustn't be called under
288 CRYPTO_EX_DATA *from); 319 * potential race-conditions. */
289void CRYPTO_free_ex_data(STACK_OF(CRYPTO_EX_DATA_FUNCS) *meth, void *obj, CRYPTO_EX_DATA *ad); 320void CRYPTO_cleanup_all_ex_data(void);
290void CRYPTO_new_ex_data(STACK_OF(CRYPTO_EX_DATA_FUNCS) *meth, void *obj, CRYPTO_EX_DATA *ad);
291 321
292int CRYPTO_get_new_lockid(char *name); 322int CRYPTO_get_new_lockid(char *name);
293 323
@@ -322,6 +352,11 @@ void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l
322 * call the latter last if you need different functions */ 352 * call the latter last if you need different functions */
323int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *)); 353int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));
324int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(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 *));
325int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), 360int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
326 void (*r)(void *,void *,int,const char *,int,int), 361 void (*r)(void *,void *,int,const char *,int,int),
327 void (*f)(void *,int), 362 void (*f)(void *,int),
@@ -329,6 +364,11 @@ int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
329 long (*go)(void)); 364 long (*go)(void));
330void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); 365void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
331void CRYPTO_get_locked_mem_functions(void *(**m)(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 *));
332void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), 372void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
333 void (**r)(void *,void *,int,const char *,int,int), 373 void (**r)(void *,void *,int,const char *,int,int),
334 void (**f)(void *,int), 374 void (**f)(void *,int),
@@ -351,6 +391,9 @@ int CRYPTO_push_info_(const char *info, const char *file, int line);
351int CRYPTO_pop_info(void); 391int CRYPTO_pop_info(void);
352int CRYPTO_remove_all_info(void); 392int CRYPTO_remove_all_info(void);
353 393
394
395/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
396 * used as default in CRYPTO_MDEBUG compilations): */
354/* The last argument has the following significance: 397/* The last argument has the following significance:
355 * 398 *
356 * 0: called before the actual memory allocation has taken place 399 * 0: called before the actual memory allocation has taken place
@@ -359,31 +402,32 @@ int CRYPTO_remove_all_info(void);
359void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p); 402void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
360void CRYPTO_dbg_realloc(void *addr1,void *addr2,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);
361void CRYPTO_dbg_free(void *addr,int before_p); 404void CRYPTO_dbg_free(void *addr,int before_p);
362
363/* Tell the debugging code about options. By default, the following values 405/* Tell the debugging code about options. By default, the following values
364 * apply: 406 * apply:
365 * 407 *
366 * 0: Clear all options. 408 * 0: Clear all options.
367 * 1: Set the "Show Time" option. 409 * V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option.
368 * 2: Set the "Show Thread Number" option. 410 * V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option.
369 * 3: 1 + 2 411 * V_CRYPTO_MDEBUG_ALL (3): 1 + 2
370 */ 412 */
371void CRYPTO_dbg_set_options(long bits); 413void CRYPTO_dbg_set_options(long bits);
372long CRYPTO_dbg_get_options(void); 414long CRYPTO_dbg_get_options(void);
373 415
374#ifndef NO_FP_API 416
417#ifndef OPENSSL_NO_FP_API
375void CRYPTO_mem_leaks_fp(FILE *); 418void CRYPTO_mem_leaks_fp(FILE *);
376#endif 419#endif
377void CRYPTO_mem_leaks(struct bio_st *bio); 420void CRYPTO_mem_leaks(struct bio_st *bio);
378/* 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 */
379void CRYPTO_mem_leaks_cb(void (*cb)(unsigned long, const char *, int, int, void *)); 422typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
423void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
380 424
381void ERR_load_CRYPTO_strings(void);
382 425
383/* BEGIN ERROR CODES */ 426/* BEGIN ERROR CODES */
384/* The following lines are auto generated by the script mkerr.pl. Any changes 427/* The following lines are auto generated by the script mkerr.pl. Any changes
385 * made after this point may be overwritten when the script is next run. 428 * made after this point may be overwritten when the script is next run.
386 */ 429 */
430void ERR_load_CRYPTO_strings(void);
387 431
388/* Error codes for the CRYPTO functions. */ 432/* Error codes for the CRYPTO functions. */
389 433
@@ -392,6 +436,11 @@ void ERR_load_CRYPTO_strings(void);
392#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103 436#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103
393#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 437#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101
394#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
395 444
396/* Reason codes. */ 445/* Reason codes. */
397#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100 446#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100
@@ -400,4 +449,3 @@ void ERR_load_CRYPTO_strings(void);
400} 449}
401#endif 450#endif
402#endif 451#endif
403