Using (not building) openssl with mingw on Windows 10

Sergio NNX sfhacker at hotmail.com
Sat Mar 23 12:01:24 UTC 2019


> "c:/program files/mingw/bin/gcc.exe" -D_MT -DTPM_WINDOWS -I.  -shared -o
> libibmtss.dll tssfile.o tsscryptoh.o tsscrypto.o tssprintcmd.o tss.o
> tssproperties.o tssmarshal.o tssauth.o tssutils.o tsssocket.o tssdev.o
> tsstransmit.o tssresponsecode.o tssccattributes.o tssprint.o Unmarshal.o
> CommandAttributeData.o tss20.o tssauth20.o Commands.o ntc2lib.o tssntc.o
> -Wl,--out-implib,libibmtss.a "c:/program
> files/openssl64/lib/libcrypto.lib" "c:/program files/MinGW/lib/libws2_32.a"

> tsscrypto.o: In function `TSS_Crypto_Init':
> c:\Users\KennethGoldman\tpm2\utils/tsscrypto.c:109: undefined reference
> to `OPENSSL_init_crypto'
> tsscrypto.o: In function `TSS_Hash_GetMd':
> c:\Users\KennethGoldman\tpm2\utils/tsscrypto.c:133: undefined reference
> to `EVP_get_digestbyname'
> ...
> continues for all OpenSSL function names


It seems to work fine here:

/mingw/bin/gcc.exe -DTPM_WINDOWS -D_MT -L. -shared -Wl,--no-undefined -Wl,--out-implib,libibmtss.dll.a -o libibmtss-1.1.dll \
                        tssfile.o tsscryptoh.o tsscrypto.o tssprintcmd.o tss.o tssproperties.o tssmarshal.o tssauth.o tssutils.o tsssocket.o tssdev.o tsstransmit.o tssresponsecode.o tssccattributes.o tssprint.o Unmarshal.o CommandAttributeData.o tss12.o tssauth12.o tssmarshal12.o Unmarshal12.o Commands12.o tssccattributes12.o CommandAttributeData12.o tss20.o tssauth20.o Commands.o ntc2lib.o tssntc.o -lcrypto -lz -lcrypt32 -lws2_32


Sorry to pollute this list! You will soon find out why!

Out of curiosity, we downloaded ibmtss1331.tar.gz and tried to build it from source (first time ever).

We have been using MSYS/MinGW for quite some time and we build (from source) and deploy large projects (with many dependencies) on a regular basis.
We tried to do the same with this project (ibmtss).
Then, on a MSYS console window we typed: make -f makefile.mak under 'ibmtss1331\utils' folder.

Find some snippets of 'makefile.mak' file:

    * CC = "c:/program files/mingw/bin/gcc.exe"

   * -I"c:/program files/MinGW/include" \
   * -I"c:/program files/openssl/include" \

    * LNLIBS =  "c:/program files/openssl/lib/mingw/libeay32.a" \
         "c:/program files/openssl/lib/mingw/ssleay32.a" \
         "c:/program files/MinGW/lib/libws2_32.a"

  * imaextend.exe: imaextend.o imalib.o $(LIBTSS)
     $(CC) $(LNFLAGS) -L. -libmtss $< -o $@ applink.o imalib.o $(LNLIBS) $(LIBTSS)


As you can imagine, there are dozens of compilation errors, such as:

    $ make -f makefile.mak all
    "c:/program files/mingw/bin/gcc.exe" -DTPM_WINDOWS -I. -I"c:/program files/MinGW/include" -I"c:/program files/openssl/include"  -Wall -W -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wformat=2 -Wold-style-definition -ggdb -O0 -c -DTPM_TPM20 tssfile.c
    /bin/sh: c:/program files/mingw/bin/gcc.exe: No such file or directory
    make: *** [tssfile.o] Error 127

    cc1.exe: warning: unrecognized command line option '-Wno-self-assign'

Some runtime errors or 'mistakes', such as:

    $ powerup.exe -v
    TSS_Socket_Open: Opening localhost:2322-mssim
    TSS_Socket_Open: Error on connect to localhost:2322
    TSS_Socket_Open: client connect: error 0 No error
    powerup: failed, rc 000b0008
    TSS_RC_NO_CONNECTION - Failure connecting to lower layer

None of the executables provide some sort of version info and/or dependencies info (e.g. OpenSSL version)

It is impossible to figure out how tests can be run! We tried: make -f makefile.mak check and make -f makefile.mak test and we got:

    make: *** No rule to make target `check'.  Stop.

    make: *** No rule to make target `test'.  Stop.

Trying to build from source a 'cousin' project (ibmtpm1332), taken from the same repository,  we came across things like this (we use MinGW x64):

    #elif TPM_POSIX && !defined _LP64
    #define  RADIX_BITS                     32

    #elif TPM_POSIX &&  defined _LP64
    #define  RADIX_BITS                    64

    #elif TPM_WINDOWS
    #define  RADIX_BITS                     32

    #else
    #error "RADIX_BITS is not set"

    #endif

But then you get:

    In file included from BnValues.h:271:0,
                 from Global.h:83,
                 from Tpm.h:71,
                 from AlgorithmCap.c:67:
    TpmToOsslMath.h:83:4: error: #error "Ossl library is using different radix"
    #  error "Ossl library is using different radix"
       ^~~~~
    make: *** [AlgorithmCap.o] Error 1

On the one hand, we are preparing a comprehensive patch as a contribution to the ibmtss/tpm project(s).
On the other hand, we refuse to believe that IBM is 'fostering' these practices and quality in 2019! We have decided to contact IBM to report and discuss this matter.

To my mind, we can conclude that OpenSSL project has nothing to do with the issue reported here. Sorry again!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20190323/2c64f7e6/attachment.html>


More information about the openssl-users mailing list