Subject: Re: RE : libssh2 in a multi threaded application

Re: RE : libssh2 in a multi threaded application

From: Daniel Stenberg <>
Date: Fri, 17 Apr 2009 12:23:47 +0200 (CEST)

On Tue, 31 Mar 2009, Jean-Louis CHARTON wrote:

> For OpenSSL part, maybe the _init() function should only load the necessary
> ciphers and not all as it is done currently; except of course if all ciphers
> are actually required by libssh2.

> EVP_add_cipher(cipher1);
> EVP_add_cipher(cipher2);
> ...
> EVP_add_cipher(cipherN);
> Instead of
> OpenSSL_add_all_ciphers();

That would probably be really hard to do properly since we won't know at
init-time what ciphers to use later on. Would we?

> Also, the _init() function should call RAND_seed() if necessary ...

I disagree. I think we should limit it to stuff that MUST be done in a single
thread. Everything that CAN be done later should.

> For the crypto callbacks, maybe the _init() function could have one boolean
> parameter so that the caller can specified whether or not the application is
> multi threaded.

Hm, if we would make it set the underlying crypto mutex callbacks I think the
option would say "use mutexes" or similar, yes.

I figure we should make the init() function take a bitmask option to have it
open for features like this. We also have it similar to that in libcurl.

Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32.
libssh2-devel mailing list
Received on 2009-04-17