Using (not building) openssl with mingw on Windows 10

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Using (not building) openssl with mingw on Windows 10

Ken Goldman-2
I've been happily using the Shining Light 32-bit binaries with both
openssl 1.0 and 1.1 and mingw.

On a new machine, I tried the 64-bit binaries.  However, they're missing
the openssl/lib/mingw directory where the .a files resided.

It looks like the link procedure changed.  Any hints before I start
experimenting?

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: Using (not building) openssl with mingw on Windows 10

OpenSSL - User mailing list
On 26/10/2018 23:08, Ken Goldman wrote:
> I've been happily using the Shining Light 32-bit binaries with both
> openssl 1.0 and 1.1 and mingw.
>
> On a new machine, I tried the 64-bit binaries.  However, they're
> missing the openssl/lib/mingw directory where the .a files resided.
>
> It looks like the link procedure changed.  Any hints before I start
> experimenting?
>
Note that Win32 (Microsoft) .LIB files are actually standard unix-style
.a files with the file names changed to match the the historic
MS-DOS/Win16 practice (which had a different file format).

So it is highly likely the .LIB files can be used with mingw by just
copying/symlinking them, or even just using a Mingw option to load
.LIB files.

Beware however of the crazy GNU interpretation that listing a library
file explicitly means include *all* the code from the library, not
just the referenced object files.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: Using (not building) openssl with mingw on Windows 10

Ken Goldman-2
On 10/29/2018 7:18 AM, Jakob Bohm via openssl-users wrote:

> On 26/10/2018 23:08, Ken Goldman wrote:
>> I've been happily using the Shining Light 32-bit binaries with both
>> openssl 1.0 and 1.1 and mingw.
>>
>> On a new machine, I tried the 64-bit binaries.  However, they're
>> missing the openssl/lib/mingw directory where the .a files resided.
>>
>> It looks like the link procedure changed.  Any hints before I start
>> experimenting?
>>
> Note that Win32 (Microsoft) .LIB files are actually standard unix-style
> .a files with the file names changed to match the the historic
> MS-DOS/Win16 practice (which had a different file format).
>
> So it is highly likely the .LIB files can be used with mingw by just
> copying/symlinking them, or even just using a Mingw option to load
> .LIB files.
>
> Beware however of the crazy GNU interpretation that listing a library
> file explicitly means include *all* the code from the library, not
> just the referenced object files.

Getting back to this:

I tried mingw linking against these

"c:/program files/openssl64/lib/libcrypto.lib"
"c:/program files/openssl64/lib/libssl.lib"

but the gcc linker failed to find the openssl functions.

Anyone have any ideas?

~~

I observe that the .a file is 3 mb while the .lib is 900k.

~~

The 32-bit build still has the mingw .a files, which I suppose
is a work around.


Reply | Threaded
Open this post in threaded view
|

RE: Using (not building) openssl with mingw on Windows 10

Michael Wojcik
> From: openssl-users [mailto:[hidden email]] On Behalf Of
> Ken Goldman
> Sent: Wednesday, March 20, 2019 08:46
> To: [hidden email]
> Subject: Re: Using (not building) openssl with mingw on Windows 10
>
> On 10/29/2018 7:18 AM, Jakob Bohm via openssl-users wrote:
> > Note that Win32 (Microsoft) .LIB files are actually standard unix-style
> > .a files with the file names changed to match the the historic
> > MS-DOS/Win16 practice (which had a different file format).
> >
> > So it is highly likely the .LIB files can be used with mingw by just
> > copying/symlinking them, or even just using a Mingw option to load
> > .LIB files.
> >
> > Beware however of the crazy GNU interpretation that listing a library
> > file explicitly means include *all* the code from the library, not
> > just the referenced object files.
>
> Getting back to this:
>
> I tried mingw linking against these
>
> "c:/program files/openssl64/lib/libcrypto.lib"
> "c:/program files/openssl64/lib/libssl.lib"
>
> but the gcc linker failed to find the openssl functions.
>
> Anyone have any ideas?
>
> ~~
>
> I observe that the .a file is 3 mb while the .lib is 900k.

Sounds like you might have import libraries there. Does "ar t libcrypto.lib" show a bunch of .obj members, or a bunch of .dll members? If it's the latter, then it's just an import library that tells the linker what DLL needs to be loaded at runtime.

We build static (non-import) OpenSSL libraries for Windows, but at least for 1.0.2 we had to tweak the configuration process. The stock Configure wanted to link OpenSSL with the static Microsoft C runtime if you were building static libraries, whereas we wanted static libraries linked with the dynamic runtime. (I don't remember offhand if we had to do the same for 1.1.1.)

--
Michael Wojcik
Distinguished Engineer, Micro Focus


Reply | Threaded
Open this post in threaded view
|

Re: Using (not building) openssl with mingw on Windows 10

Sergio NNX
In reply to this post by Ken Goldman-2
>> I've been happily using the Shining Light 32-bit binaries with both
>> openssl 1.0 and 1.1 and mingw.

a) Where can we download OpenSSL binaries (x64) for Windows built with MinGW?
    [ https://slproweb.com/products/Win32OpenSSL.html ]

b) D:\Temp-Apps\OpenSSL-Win64\bin>openssl version -a

    OpenSSL 1.1.1b  26 Feb 2019
    built on: Wed Feb 27 02:30:51 2019 UTC
    platform: VC-WIN64A
    options:  bn(64,64) rc4(16x,int) des(long) idea(int) blowfish(ptr)
    compiler: cl /Z7 /Fdossl_static.pdb /Gs0 /GF /Gy /MD /W3 /wd4090 /nologo /O2 -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPADLOCK_ASM -DPOLY1305_ASM -D_USING_V110_SDK71_ -D_WINSOCK_DEPRECATED_NO_WARNINGS
    OPENSSLDIR: "C:\Program Files\Common Files\SSL"
    ENGINESDIR: "C:\Program Files\OpenSSL\lib\engines-1_1"
    Seeding source: os-specific

     + Paths seem to be hardcoded

c) D:\Temp-Apps\OpenSSL-Win64\bin>openssl engine capi -v -t -post list_containers
    6840:error:25078067:DSO support routines:win32_load:could not load the shared library:crypto\dso\dso_win32.c:107:filename(C:\Program Files\OpenSSL\lib\engines-1_1\capi.dll)
    6840:error:25070067:DSO support routines:DSO_load:could not load the shared library:crypto\dso\dso_lib.c:162:
    6840:error:260B6084:engine routines:dynamic_load:dso not found:crypto\engine\eng_dyn.c:414:
    6840:error:2606A074:engine routines:ENGINE_by_id:no such engine:crypto\engine\eng_list.c:334:id=capi

d) Unable to find any .a file within the installation folder (D:\Temp-Apps\OpenSSL-Win64)
    
>> On a new machine, I tried the 64-bit binaries.  However, they're
>> missing the openssl/lib/mingw directory where the .a files resided.

> Getting back to this:

> I tried mingw linking against these

> "c:/program files/openssl64/lib/libcrypto.lib"
> "c:/program files/openssl64/lib/libssl.lib"

> but the gcc linker failed to find the openssl functions.

> Anyone have any ideas?

We have been using OpenSSL for Windows (x64) built with MinGW for a long time.

> openssl.exe version -a

    OpenSSL 1.1.1a  20 Nov 2018
    built on: Sat Feb 23 14:32:38 2019 UTC
    platform: mingw64
    options:  bn(64,64) rc4(16x,int) des(long) idea(int) blowfish(ptr)
    compiler: gcc.exe -m64 -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -DPTW32_STATIC_LIB -D__CLEANUP_C -m64 -O2 -pipe -mms-bitfields -fno-builtin -march=core2 -mtune=core2 -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPADLOCK_ASM -DPOLY1305_ASM -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -DPTW32_STATIC_LIB -D__CLEANUP_C -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -DOPENSSL_SSL_CLIENT_ENGINE_AUTO=capi -DOPENSSL_CAPIENG_DIALOG -m64 -pipe -mms-bitfields -fno-builtin -march=core2 -mtune=core2 -D_MT -DZLIB -DNDEBUG -I/mingw/include
    OPENSSLDIR: "\OpenSSL"
    ENGINESDIR: "\OpenSSL\lib\engines-1_1"
    Seeding source: os-specific

> openssl engine
    (rdrand) Intel RDRAND engine
    (dynamic) Dynamic engine loading support
    (padlock) VIA PadLock (no-RNG, no-ACE)
    (capi) CryptoAPI ENGINE

@Ken: this seems to be a quite old thread, but if you need either the include files or the .a files
      or both, we could email them to you.

Regards.