While executing the below code its coring randomly in two cases, 1) While executing the method SSL_library_init() in the constructor. 2) Coring while executing the call back method locking_function().
We are not sure, now the call back method is calling after it is set to NULL Ex : CRYPTO_set_locking_callback(NULL) Here, after we set to NULL its calling the call back method. We want to make sure it should not be called after setting to NULL. It will be great if someone explain me in detail, how the call back mechanism works internally. Code: ----- pthread_mutex_t *SslBIO::_lnSslBioMutex=NULL; void SslBIO::locking_function(int mode, int type, const char * file, int line) { int rstat; if (mode & CRYPTO_LOCK) { fprintf(stderr, "\nDEBUG: Locking the Mutex _lnSslBioMutex[%d] Mode = %d File :%s Line No : %d\n",type,mode,file,line); rstat = pthread_mutex_lock(&(SslBIO::_lnSslBioMutex[type])); lnChkMutex(rstat, FL); } else { fprintf(stderr, "\nDEBUG: UnLocking the Mutex _lnSslBioMutex[%d] Mode = %d File :%s Line No : %d\n",type,mode,file,line); rstat = pthread_mutex_unlock(&(SslBIO::_lnSslBioMutex[type])); lnChkMutex(rstat, FL); } } unsigned long SslBIO::id_function() { unsigned long ulThreadId = (unsigned long)pthread_self(); fprintf(stderr, "\nDEBUG: Thread ID = %d\n",ulThreadId); return (ulThreadId); } int SslBIO::init(const char * initarg) { int i; _lnSslBioMutex = (pthread_mutex_t *) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); if (!_lnSslBioMutex) return 0; fprintf(stderr, "\nDEBUG: Number of Locks(CRYPTO_NUM_LOCKS) = %d \n",CRYPTO_num_locks()); for(i=0;i= 0) { buf[currRead] = 0; if (_debug) { ostrstream strm; strm << "Out of SslBIO::read currRead = " << currRead << endl; strm << ends; delete strm.str(); } } else buf[0] = 0; return(OK); } int SslBIO::write(const char *buf, const int len) { int written; int totLen; if (len < 0) { return(FAIL); } totLen = len; printf("DEBUG: Before Write\n"); if ((written = BIO_write(_bio, buf, len)) != totLen) { return(FAIL); } printf("DEBUG: After Write written = %d Buf = %s Length = %d\n",written,buf,len); _totSent += totLen; return(OK); } -- View this message in context: http://old.nabble.com/Core-occurred-while-executing-SSL_library_init%28%29-and-call-back-method-locking_function%28%29-tp31596258p31596258.html Sent from the OpenSSL - User mailing list archive at Nabble.com.