[gnutls-devel] Automatic library initialization
Nikos Mavrogiannopoulos
nmav at gnutls.org
Tue Nov 24 13:45:10 CET 2015
On Tue, Nov 24, 2015 at 10:38 AM, Tim Ruehsen <tim.ruehsen at gmx.de> wrote:
>> It was included in the 3.4.x and 3.3.x releases, but this option must
>> be used with extreme care. Even though you may know where in your
>> application gnutls usage starts, you may not know whether some library
>> that you use will use it. You may not know for example that getpwnam()
>> will end up requiring to call gnutls in some setups. For that it
>> should not be used lightly as you'll rediscover the bugs that the
>> initialization to constructor was solving.
> Thanks for pointing out (I wasn't aware of getpwnam pulling in gnutls).
> As far as I can see, on (most ?) multi-threaded environments
> gnutls_global_init is thread-safe via GNUTLS_STATIC_MUTEX* !?
> If a system offers multi-threading, it will also offer mutexes/locks that
> could/will be used by gnutls. What am I missing ?
[replying again on list]
It would be safe only if the library that uses gnutls calls
gnutls_global_init() explicitly. If it relies on it being called on a
constructor you'll run into issues.
regards,
Nikos
More information about the Gnutls-devel
mailing list