Hi David, that is really nice.. although.. after I gave it a try... it does not really work :(
Actually, it seems that the dynamic functions are never called... :( Investigating... Later, Max David Schwartz wrote:
Hi all, it seems that I am missing the usage of the set of obscure functions: CRYPTO_set_dynlock_create_callback() CRYPTO_set_dynlock_lock_callback() CRYPTO_set_dynlock_destroy_callback()but I have no idea how to initialize those functions - is there any exampleon how to do that by using pthreads ? Ciao, MaxOff the top of my head, and untested, but it should give you the idea: struct CRYPTO_dynlock_value {pthread_rwlock_t lock; };#ifndef CRYPTO_LOCK #define CRYPTO_LOCK 0x01 #define CRYPTO_UNLOCK 0x02 #define CRYPTO_READ 0x04 #define CRYPTO_WRITE 0x08 #endif void locking_callback(int mode, struct CRYPTO_dynlock_value *l, const char *, int) { if(mode==(CRYPTO_LOCK|CRYPTO_READ)) pthread_rwlock_rdlock(&l->lock);else if(mode==(CRYPTO_LOCK|CRYPTO_WRITE)) pthread_rwlock_wrlock(&l->lock);else if(mode==(CRYPTO_UNLOCK|CRYPTO_READ)) pthread_rwlock_unlock(&l->lock); else if(mode==(CRYPTO_UNLOCK|CRYPTO_WRITE)) pthread_rwlock_unlock(&l->lock); }struct CRYPTO_dynlock_value *create_callback(const char *, int){ CRYPTO_dynlock_value *l=(CRYPTO_dynlock_value *) malloc(sizeof(CRYPTO_dynlock_value)); pthread_rwlock_init(&l->lock, NULL); return l; } void destroy_callback(struct CRYPTO_dynlock_value *l, const char *, int) { pthread_rwlock_destroy(&l->lock); free(l); }void InitDynLocks(void){CRYPTO_set_dynlock_create_callback(create_callback); CRYPTO_set_dynlock_lock_callback(locking_callback); CRYPTO_set_dynlock_destroy_callback(destroy_callback);} DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
-- Best Regards, Massimiliano Pala --o------------------------------------------------------------------------ Massimiliano Pala [OpenCA Project Manager] [EMAIL PROTECTED] [EMAIL PROTECTED] Dartmouth Computer Science Dept Home Phone: +1 (603) 369-9332 PKI/Trust Laboratory Work Phone: +1 (603) 646-9179 --o------------------------------------------------------------------------ People who think they know everything are a great annoyance to those of us who do. -- Isaac Asimov
smime.p7s
Description: S/MIME Cryptographic Signature