cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SSL and threads [locking not by curl]

From: Dirk Manske <dm_at_nettraffic.de>
Date: Mon, 26 Jan 2004 15:58:08 +0100

On Monday 19 January 2004 14:37, Daniel Stenberg wrote:
> On Mon, 19 Jan 2004, Dirk Manske wrote:
>
>
> > is anybody working on the OpenSSL thread issue? ( Todo no. 4 for 7.11.1,
> > see also http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION )
> > If not I will (try to) do it tomorrow.
>
>
> I'm not aware of anyone working on this.

The current curl share/locking implementation cannot be used for SSL
thread locking.

From above URL:
"locking_function(int mode, int n, const char *file, int line) is needed to
perform locking on shared data structures. (Note that OpenSSL uses a
number of global data structures that will be implicitly shared whenever
multiple threads use OpenSSL.) Multi-threaded applications will crash at
random if it is not set.

locking_function() must be able to handle up to CRYPTO_num_locks()
different mutex locks. It sets the n-th lock if mode & CRYPTO_LOCK, and
releases it otherwise."

The problem is that OpenSSL needs more than one lock. To support that
the curl share API need to be rewritten (CURL_SHARE_LOCK, ..UNLOCK,
..CREATE_MUTEX ..FREE_MUTEX). [as discussed Jan 2002]

But I think this ugly lock wrapping is not really needed. Because OpenSSL
locking can be easily done in the client code.

Only a hint in the libcurl documentation should be written.

Greetings,
Dirk

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-01-28