diff options
author | Richard Levitte <levitte@openssl.org> | 2000-06-18 17:59:04 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-06-18 17:59:04 +0200 |
commit | c79223040d23678e79914e1e6afddea0487b3a6e (patch) | |
tree | d5ce4b5178157de6478a6c3929e48f12428904aa /crypto/crypto.h | |
parent | First of all, with the current macros, we should never get any (diff) | |
download | openssl-c79223040d23678e79914e1e6afddea0487b3a6e.tar.xz openssl-c79223040d23678e79914e1e6afddea0487b3a6e.zip |
Add support for dynamically created and destroyed mutexes. This will
be needed in some ENGINE code, and might serve elsewhere as well.
Note that it's implemented in such a way that the locking itself is
done through the same CRYPTO_lock function as the static locks.
WARNING: This is currently experimental and untested code (it will get
tested soon, though :-)).
Diffstat (limited to 'crypto/crypto.h')
-rw-r--r-- | crypto/crypto.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto/crypto.h b/crypto/crypto.h index 9a3a6f8b00..9e5f2e2922 100644 --- a/crypto/crypto.h +++ b/crypto/crypto.h @@ -150,6 +150,12 @@ extern "C" { #define CRYPTO_add(a,b,c) ((*(a))+=(b)) #endif +/* Some applications as well as some parts of OpenSSL need to allocate + and deallocate locks in a dynamic fashion. The following typedef + makes this possible in a type-safe manner. */ +typedef struct CRYPTO_dynlock_value CRYPTO_dynlock; + + /* The following can be used to detect memory leaks in the SSLeay library. * It used, it turns on malloc checking */ @@ -299,6 +305,16 @@ unsigned long CRYPTO_thread_id(void); const char *CRYPTO_get_lock_name(int type); int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, int line); +void CRYPTO_set_dynlock_create_callback(CRYPTO_dynlock *(*dyn_create_function) + (char *file, int line)); +void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function) + (int mode, CRYPTO_dynlock *l, const char *file, int line)); +void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function) + (CRYPTO_dynlock *l, const char *file, int line)); +void CRYPTO_set_dynlock_size(int dynlock_size); +int CRYPTO_get_new_dynlockid(void); +void CRYPTO_destroy_dynlockid(int i); +CRYPTO_dynlock *CRYPTO_get_dynlock_value(int i); /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- * call the latter last if you need different functions */ @@ -371,12 +387,15 @@ void ERR_load_CRYPTO_strings(void); /* Function codes. */ #define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103 #define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 #define CRYPTO_F_CRYPTO_SET_EX_DATA 102 /* Reason codes. */ +#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100 #ifdef __cplusplus } #endif #endif + |