Subject: Re: detect linkage against openssl or gcrypt

Re: detect linkage against openssl or gcrypt

From: Jan David Mol <>
Date: Mon, 29 Jul 2013 12:15:48 +0200

On 29-07-13 11:20, Bill Segall wrote:
> On Mon, Jul 29, 2013 at 6:52 PM, Daniel Stenberg <> wrote:
>> On Mon, 29 Jul 2013, Bill Segall wrote:
>> Don't be surprised if the CFLAGS are an empty string if you're installing
>>> packages on Ubuntu (or anywhere that installs the headers intro
>>> /usr/include),

CFLAGS is empty on my Ubuntu 13 desktop. What does seem to work is
running 'pkg-config libssh2 --libs' and scan for '-lgcrypt' / '-lcrypto'.

> It sounds like in practice you have extra initialization required for
> re-entrant use - can you explain what that is? My feeling is that libssh2
> should do this for you.

It's needed to set up the crypto library for multithreaded use. One
needs to set the proper call-back routines in libcrypto and libgcrypt,
or crashes will occur.

Is it libssh2's job to set up libcrypto/libgcrypt? libssh2 -could- do
so, but doing so could clash with other uses of the same crypto lib by
the program, so it'd have to be optional. Also, multithreading init code
requires a dependency on libpthread (and/or other threading libraries)
to be able to create the required mutexes etc.

Jan David

Received on 2013-07-29