Re: [psqlODBC 08.02.0402] OpenSSL libraries

From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: Rainer Bauer <usenet(at)munnin(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: [psqlODBC 08.02.0402] OpenSSL libraries
Date: 2007-06-05 13:41:34
Message-ID: 4665680E.60007@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Rainer Bauer wrote:
> Hiroshi Inoue wrote:
>
>> Rainer Bauer wrote:
>>> I checked out the latest head version today 08.02.0402 to find a solution for
>>> the new OpenSSL DLL naming scheme.
>> Do you get OpenSSL libraries from
>> http://www.slproweb.com/products/Win32OpenSSL.html ?
>
> Yes.
>
>> Though I can find ssleay32(MT]MD)(d).lib in C:\OpenSSL\lib\vc, I can't
>> find ssleay32(MT|MD)(d).dll. What's the differnce among ssleay32xx.lib ?
>
> Sorry this was my fault.: I didn't search for the DLLs installed by OpenSSL.
> The difference between /MT and /MD is explained here:
> <http://msdn2.microsoft.com/en-us/library/2kzt1wy3(VS.80).aspx>
> The /MT option defines _MT whereas the /MD option defines _MT and _DLL
> resulting in different runtimes being linked.
>
> According to the FAQ <http://www.openssl.org/support/faq.html#PROG2>, psqlODBC
> should contain the code for OPENSSL_Applink() (see also

Shouldn't it be added to the EXE project not to the DLL one ?

> <http://www.openssl.org/docs/crypto/OPENSSL_Applink.html>), because it is
> linked with a different setting. But that is not the case!
>
> So there are a few open questions:
> Why is psqlODBC build with /MT and not /MD?

Because it has been so without problems.

I'm pretty confused. Is it realistic to expect all the relevant dlls
and the exe itself are compiled with the same option settings and
compiler ? For example, if we build it with /MD otpion using vc8.0,
the driver would link msvcr(p)80.dll. OTOH ssleay32.dll downloaded
from http://www.slproweb.com/products/Win32OpenSSL.html seems to
be linking msvcr71.dll. Is there no problem with it ?

> Why are SSL connections working at all (I assume they are, since I cannot test
> it here), if the OpenSSL DLLs and psqlODBC are linked to different runtimes?

It's not that easy to crash programs with the mixed options and
I don't know definite problems to mix the options.
OPENSSL_Applink() may be the hint.

> Regardless of these issues, my approach would make sense (the DLLs are not
> renamed), we just have to include the correct lib files in loadlib.c based on
> the installed OpenSSL version:
>
>>> I wanted to produce a patch for loadlib.c based on the following idea:
>>>
>>> 1) Include openssl/opensslv.h
>>> 2) Based on the version number OPENSSL_VERSION_NUMBER defined in that file
>>> either link with ssleay32.lib or ssleay32MT.lib (respectively libeay32.lib or
>>> libeay32MT.lib).
>
>
>>> PS: Can someone shed some light why delay loading is used in loadlib.c?
>> Because the driver can live without libpq, ssleay32 or pgenlist.
>> If you use SSL connections, libpq and ssleay32 are loaded dynamically.
>> If you enlist in MSDTC, pgenlist(a) is loaeded dynamically.
>
> I see.
>
> Another question: How many active developers are there for Win32? And what
> compilers are they using? Dopping support for VC6 would clean up the code (at
> least in loadlib.c and the makefile).

Please look at
http://pgfoundry.org/project/memberlist.php?group_id=1000125.

The code is mainly maintained by me.
I'm using VC7.1 mainly.
AFAIK Hiroshi Saito can use both VC6 and VC8.

regards,
Hiroshi Inoue

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Shwe Yee Than 2007-06-05 14:12:07 Re: psqlodbc-07.03.0100
Previous Message Raymond O'Donnell 2007-06-05 13:31:33 Re: psqlodbc-07.03.0100