[freetds] OpenSSL support

Peter Deacon peterd at iea-software.com
Thu May 26 11:31:04 EDT 2005


On Thu, 26 May 2005, ZIGLIO, Frediano, VF-IT wrote:

>> I think the problem might be with the global data loaded when openssl
>> starts up.  You can use ERR_free_strings and EVP_cleanup to
>> axe the global
>> structures at shutdown.

> Nice shoot!
> However this solution is good for an application but not for a
> library... calling ERR_free_strings and/or EVP_cleanup while another
> library can use openssl is not that good. strings and evp are global so
> every library that use openssl in your application will not see
> error/digest/cipher registered... I'm trying to patch openssl to free
> its data while unloading library using gcc (not very portable but there
> seems no way to handle this portably)...

>From what I understand of unix dynamic libraries _init() is called at 
library load time and _fini() is called when the library is unloaded.  So 
you'd just need to include the global free code in _fini?  I have no idea 
who all supports such things but I do know it works on linux, freebsd and 
solaris.  The system keeps a reference count so that if the same library 
is loaded multiple times _fini is called only when the reference count 
reaches zero.

> A note about GnuTLS and OpenSSL. Beside license I found that OpenSSL is
> more mature, thread safe but huge and complex... every part (error, hash
> and others) can be overridden and follow the flow is very difficult.
> GnuTLS is cleaner however it do not support some cipher suite (it do not
> support any cipher I need for FreeTDS...). Using OpenSSL as a system
> library (linked to many application/libraries) seems not that fine (it
> contains leaks and global states which every application/library should
> pay attention).

I like OpenSSL :)  Aside from the global data... The library maintains a 
session cache for quick reconnect of prioir ssl sessions which might be 
mistaken for a leak if your doing some sort of runtime checking?  I don't 
have any experience with valgrind so I'll shutup now.

Have Fun!
Peter


More information about the FreeTDS mailing list