aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto.h
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-06-18 15:59:04 +0000
committerRichard Levitte <levitte@openssl.org>2000-06-18 15:59:04 +0000
commitc79223040d23678e79914e1e6afddea0487b3a6e (patch)
treed5ce4b5178157de6478a6c3929e48f12428904aa /crypto/crypto.h
parenta8b07aa4e99428a4161415e76a7d0020606e2bfa (diff)
downloadopenssl-c79223040d23678e79914e1e6afddea0487b3a6e.tar.gz
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.h19
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
+