diff options
Diffstat (limited to 'src/lib/libcrypto/crypto.h')
| -rw-r--r-- | src/lib/libcrypto/crypto.h | 126 |
1 files changed, 59 insertions, 67 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 76bc5958c0..baeba25b99 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
| @@ -154,23 +154,22 @@ extern "C" { | |||
| 154 | typedef struct crypto_ex_data_st CRYPTO_EX_DATA; | 154 | typedef struct crypto_ex_data_st CRYPTO_EX_DATA; |
| 155 | /* Called when a new object is created */ | 155 | /* Called when a new object is created */ |
| 156 | typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 156 | typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, |
| 157 | int idx, long argl, void *argp); | 157 | int idx, long argl, void *argp); |
| 158 | /* Called when an object is free()ed */ | 158 | /* Called when an object is free()ed */ |
| 159 | typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 159 | typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, |
| 160 | int idx, long argl, void *argp); | 160 | int idx, long argl, void *argp); |
| 161 | /* Called when we need to dup an object */ | 161 | /* Called when we need to dup an object */ |
| 162 | typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | 162 | typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, |
| 163 | int idx, long argl, void *argp); | 163 | void *from_d, int idx, long argl, void *argp); |
| 164 | #endif | 164 | #endif |
| 165 | 165 | ||
| 166 | /* A generic structure to pass assorted data in a expandable way */ | 166 | /* A generic structure to pass assorted data in a expandable way */ |
| 167 | typedef struct openssl_item_st | 167 | typedef struct openssl_item_st { |
| 168 | { | ||
| 169 | int code; | 168 | int code; |
| 170 | void *value; /* Not used for flag attributes */ | 169 | void *value; /* Not used for flag attributes */ |
| 171 | size_t value_size; /* Max size of value for output, length for input */ | 170 | size_t value_size; /* Max size of value for output, length for input */ |
| 172 | size_t *value_length; /* Returned length of value for output */ | 171 | size_t *value_length; /* Returned length of value for output */ |
| 173 | } OPENSSL_ITEM; | 172 | } OPENSSL_ITEM; |
| 174 | 173 | ||
| 175 | 174 | ||
| 176 | /* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock | 175 | /* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock |
| @@ -249,11 +248,10 @@ typedef struct openssl_item_st | |||
| 249 | and deallocate locks in a dynamic fashion. The following typedef | 248 | and deallocate locks in a dynamic fashion. The following typedef |
| 250 | makes this possible in a type-safe manner. */ | 249 | makes this possible in a type-safe manner. */ |
| 251 | /* struct CRYPTO_dynlock_value has to be defined by the application. */ | 250 | /* struct CRYPTO_dynlock_value has to be defined by the application. */ |
| 252 | typedef struct | 251 | typedef struct { |
| 253 | { | ||
| 254 | int references; | 252 | int references; |
| 255 | struct CRYPTO_dynlock_value *data; | 253 | struct CRYPTO_dynlock_value *data; |
| 256 | } CRYPTO_dynlock; | 254 | } CRYPTO_dynlock; |
| 257 | 255 | ||
| 258 | 256 | ||
| 259 | /* The following can be used to detect memory leaks in the SSLeay library. | 257 | /* The following can be used to detect memory leaks in the SSLeay library. |
| @@ -278,24 +276,22 @@ typedef struct | |||
| 278 | /* predec of the BIO type */ | 276 | /* predec of the BIO type */ |
| 279 | typedef struct bio_st BIO_dummy; | 277 | typedef struct bio_st BIO_dummy; |
| 280 | 278 | ||
| 281 | struct crypto_ex_data_st | 279 | struct crypto_ex_data_st { |
| 282 | { | ||
| 283 | STACK_OF(void) *sk; | 280 | STACK_OF(void) *sk; |
| 284 | int dummy; /* gcc is screwing up this data structure :-( */ | 281 | int dummy; /* gcc is screwing up this data structure :-( */ |
| 285 | }; | 282 | }; |
| 286 | DECLARE_STACK_OF(void) | 283 | DECLARE_STACK_OF(void) |
| 287 | 284 | ||
| 288 | /* This stuff is basically class callback functions | 285 | /* This stuff is basically class callback functions |
| 289 | * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ | 286 | * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ |
| 290 | 287 | ||
| 291 | typedef struct crypto_ex_data_func_st | 288 | typedef struct crypto_ex_data_func_st { |
| 292 | { | ||
| 293 | long argl; /* Arbitary long */ | 289 | long argl; /* Arbitary long */ |
| 294 | void *argp; /* Arbitary void * */ | 290 | void *argp; /* Arbitary void * */ |
| 295 | CRYPTO_EX_new *new_func; | 291 | CRYPTO_EX_new *new_func; |
| 296 | CRYPTO_EX_free *free_func; | 292 | CRYPTO_EX_free *free_func; |
| 297 | CRYPTO_EX_dup *dup_func; | 293 | CRYPTO_EX_dup *dup_func; |
| 298 | } CRYPTO_EX_DATA_FUNCS; | 294 | } CRYPTO_EX_DATA_FUNCS; |
| 299 | 295 | ||
| 300 | DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) | 296 | DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) |
| 301 | 297 | ||
| @@ -392,18 +388,18 @@ int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i); | |||
| 392 | int CRYPTO_ex_data_new_class(void); | 388 | int CRYPTO_ex_data_new_class(void); |
| 393 | /* Within a given class, get/register a new index */ | 389 | /* Within a given class, get/register a new index */ |
| 394 | int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, | 390 | int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, |
| 395 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, | 391 | CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, |
| 396 | CRYPTO_EX_free *free_func); | 392 | CRYPTO_EX_free *free_func); |
| 397 | /* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given | 393 | /* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given |
| 398 | * class (invokes whatever per-class callbacks are applicable) */ | 394 | * class (invokes whatever per-class callbacks are applicable) */ |
| 399 | int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); | 395 | int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); |
| 400 | int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, | 396 | int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, |
| 401 | CRYPTO_EX_DATA *from); | 397 | CRYPTO_EX_DATA *from); |
| 402 | void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); | 398 | void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); |
| 403 | /* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index | 399 | /* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index |
| 404 | * (relative to the class type involved) */ | 400 | * (relative to the class type involved) */ |
| 405 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); | 401 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); |
| 406 | void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx); | 402 | void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); |
| 407 | /* This function cleans up all "ex_data" state. It mustn't be called under | 403 | /* This function cleans up all "ex_data" state. It mustn't be called under |
| 408 | * potential race-conditions. */ | 404 | * potential race-conditions. */ |
| 409 | void CRYPTO_cleanup_all_ex_data(void); | 405 | void CRYPTO_cleanup_all_ex_data(void); |
| @@ -411,22 +407,21 @@ void CRYPTO_cleanup_all_ex_data(void); | |||
| 411 | int CRYPTO_get_new_lockid(char *name); | 407 | int CRYPTO_get_new_lockid(char *name); |
| 412 | 408 | ||
| 413 | int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */ | 409 | int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */ |
| 414 | void CRYPTO_lock(int mode, int type,const char *file,int line); | 410 | void CRYPTO_lock(int mode, int type, const char *file, int line); |
| 415 | void CRYPTO_set_locking_callback(void (*func)(int mode,int type, | 411 | void CRYPTO_set_locking_callback(void (*func)(int mode, int type, |
| 416 | const char *file,int line)); | 412 | const char *file, int line)); |
| 417 | void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file, | 413 | void (*CRYPTO_get_locking_callback(void))(int mode, int type, |
| 418 | int line); | 414 | const char *file, int line); |
| 419 | void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type, | 415 | void CRYPTO_set_add_lock_callback(int (*func)(int *num, int mount, int type, |
| 420 | const char *file, int line)); | 416 | const char *file, int line)); |
| 421 | int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, | 417 | int (*CRYPTO_get_add_lock_callback(void))(int *num, int mount, int type, |
| 422 | const char *file,int line); | 418 | const char *file, int line); |
| 423 | 419 | ||
| 424 | /* Don't use this structure directly. */ | 420 | /* Don't use this structure directly. */ |
| 425 | typedef struct crypto_threadid_st | 421 | typedef struct crypto_threadid_st { |
| 426 | { | ||
| 427 | void *ptr; | 422 | void *ptr; |
| 428 | unsigned long val; | 423 | unsigned long val; |
| 429 | } CRYPTO_THREADID; | 424 | } CRYPTO_THREADID; |
| 430 | /* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ | 425 | /* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ |
| 431 | void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val); | 426 | void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val); |
| 432 | void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr); | 427 | void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr); |
| @@ -443,8 +438,8 @@ unsigned long CRYPTO_thread_id(void); | |||
| 443 | #endif | 438 | #endif |
| 444 | 439 | ||
| 445 | const char *CRYPTO_get_lock_name(int type); | 440 | const char *CRYPTO_get_lock_name(int type); |
| 446 | int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, | 441 | int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, |
| 447 | int line); | 442 | int line); |
| 448 | 443 | ||
| 449 | int CRYPTO_get_new_dynlockid(void); | 444 | int CRYPTO_get_new_dynlockid(void); |
| 450 | void CRYPTO_destroy_dynlockid(int i); | 445 | void CRYPTO_destroy_dynlockid(int i); |
| @@ -452,46 +447,43 @@ struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); | |||
| 452 | void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line)); | 447 | void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line)); |
| 453 | void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); | 448 | void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); |
| 454 | void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line)); | 449 | void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line)); |
| 455 | struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line); | 450 | struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file, int line); |
| 456 | void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line); | 451 | void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line); |
| 457 | void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line); | 452 | void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file, int line); |
| 458 | 453 | ||
| 459 | /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- | 454 | /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- |
| 460 | * call the latter last if you need different functions */ | 455 | * call the latter last if you need different functions */ |
| 461 | int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *)); | 456 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *)); |
| 462 | int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *)); | 457 | int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *)); |
| 463 | int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int), | 458 | int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), |
| 464 | void *(*r)(void *,size_t,const char *,int), | 459 | void *(*r)(void *, size_t, const char *, int), void (*f)(void *)); |
| 465 | void (*f)(void *)); | 460 | int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int), |
| 466 | int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int), | 461 | void (*free_func)(void *)); |
| 467 | void (*free_func)(void *)); | 462 | int CRYPTO_set_mem_debug_functions( |
| 468 | int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), | 463 | void (*m)(void *, int, const char *, int, int), |
| 469 | void (*r)(void *,void *,int,const char *,int,int), | 464 | void (*r)(void *, void *, int, const char *, int, int), |
| 470 | void (*f)(void *,int), | 465 | void (*f)(void *, int), void (*so)(long), long (*go)(void)); |
| 471 | void (*so)(long), | 466 | void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t), |
| 472 | long (*go)(void)); | 467 | void (**f)(void *)); |
| 473 | void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); | ||
| 474 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); | 468 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); |
| 475 | void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), | 469 | void CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int), |
| 476 | void *(**r)(void *, size_t,const char *,int), | 470 | void *(**r)(void *, size_t, const char *, int), void (**f)(void *)); |
| 477 | void (**f)(void *)); | 471 | void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int), |
| 478 | void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int), | 472 | void (**f)(void *)); |
| 479 | void (**f)(void *)); | 473 | void CRYPTO_get_mem_debug_functions( |
| 480 | void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), | 474 | void (**m)(void *, int, const char *, int, int), |
| 481 | void (**r)(void *,void *,int,const char *,int,int), | 475 | void (**r)(void *, void *, int, const char *, int, int), |
| 482 | void (**f)(void *,int), | 476 | void (**f)(void *, int), void (**so)(long), long (**go)(void)); |
| 483 | void (**so)(long), | ||
| 484 | long (**go)(void)); | ||
| 485 | 477 | ||
| 486 | void *CRYPTO_malloc_locked(int num, const char *file, int line); | 478 | void *CRYPTO_malloc_locked(int num, const char *file, int line); |
| 487 | void CRYPTO_free_locked(void *ptr); | 479 | void CRYPTO_free_locked(void *ptr); |
| 488 | void *CRYPTO_malloc(int num, const char *file, int line); | 480 | void *CRYPTO_malloc(int num, const char *file, int line); |
| 489 | char *CRYPTO_strdup(const char *str, const char *file, int line); | 481 | char *CRYPTO_strdup(const char *str, const char *file, int line); |
| 490 | void CRYPTO_free(void *ptr); | 482 | void CRYPTO_free(void *ptr); |
| 491 | void *CRYPTO_realloc(void *addr,int num, const char *file, int line); | 483 | void *CRYPTO_realloc(void *addr, int num, const char *file, int line); |
| 492 | void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, | 484 | void *CRYPTO_realloc_clean(void *addr, int old_num, int num, |
| 493 | int line); | 485 | const char *file, int line); |
| 494 | void *CRYPTO_remalloc(void *addr,int num, const char *file, int line); | 486 | void *CRYPTO_remalloc(void *addr, int num, const char *file, int line); |
| 495 | 487 | ||
| 496 | void OPENSSL_cleanse(void *ptr, size_t len); | 488 | void OPENSSL_cleanse(void *ptr, size_t len); |
| 497 | 489 | ||
| @@ -512,9 +504,9 @@ int CRYPTO_remove_all_info(void); | |||
| 512 | * 0: called before the actual memory allocation has taken place | 504 | * 0: called before the actual memory allocation has taken place |
| 513 | * 1: called after the actual memory allocation has taken place | 505 | * 1: called after the actual memory allocation has taken place |
| 514 | */ | 506 | */ |
| 515 | void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p); | 507 | void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, int before_p); |
| 516 | void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p); | 508 | void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file, int line, int before_p); |
| 517 | void CRYPTO_dbg_free(void *addr,int before_p); | 509 | void CRYPTO_dbg_free(void *addr, int before_p); |
| 518 | /* Tell the debugging code about options. By default, the following values | 510 | /* Tell the debugging code about options. By default, the following values |
| 519 | * apply: | 511 | * apply: |
| 520 | * | 512 | * |
| @@ -536,7 +528,7 @@ typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *); | |||
| 536 | void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); | 528 | void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); |
| 537 | 529 | ||
| 538 | /* die if we have to */ | 530 | /* die if we have to */ |
| 539 | void OpenSSLDie(const char *file,int line,const char *assertion); | 531 | void OpenSSLDie(const char *file, int line, const char *assertion); |
| 540 | #define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) | 532 | #define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) |
| 541 | 533 | ||
| 542 | unsigned long *OPENSSL_ia32cap_loc(void); | 534 | unsigned long *OPENSSL_ia32cap_loc(void); |
