[openssl-dev] [openssl.org #4156] Wrong expectation of value of _IOB_ENTRIES with Visual Studio 2015

Hannes Mezger via RT rt at openssl.org
Wed Nov 25 19:33:01 UTC 2015


Hi,

when using OpenSSL (1.0.1p) in our applications, we get the error 'No
OPENSSL_Applink' when calling PEM_read_X509_CRL. We build both OpenSSL
and the application using the same C runtime configuration (/MDd), using
Visual Studio 2015 on Windows 10.

After some hours of debugging and comparing with the same scenario using
Visual Studio 2010, I discovered that _IOB_ENTRIES is defined
differently in the two versions of Visual Studio:

VS2015: c:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\stdio.h: #define _IOB_ENTRIES 3
VS2010: c:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\include\stdio.h: #define _IOB_ENTRIES 20

Now there's code in openssl-1.0.1p\crypto\bio\bss_file.c that seems to
expect _IOB_ENTRIES to have the value 20:

#   if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES)
#    define _IOB_ENTRIES 20
#   endif
#   if defined(_IOB_ENTRIES)
        /* Safety net to catch purely internal BIO_set_fp calls */
        if ((size_t)ptr >= (size_t)stdin &&
            (size_t)ptr < (size_t)(stdin + _IOB_ENTRIES))
            BIO_clear_flags(b, BIO_FLAGS_UPLINK);
#   endif
#  endif
#  ifdef UP_fsetmod
        if (b->flags & BIO_FLAGS_UPLINK)
            UP_fsetmod(b->ptr, (char)((num & BIO_FP_TEXT) ? 't' : 'b'));
        else
#  endif

The 'safety net' does not work here, as _IOB_ENTRIES is too small in
VS2015 and the flags don't get cleared (as for VS2010), so UP_fsetmod is
being called which leads to the 'No OPENSSL_Applink' error.

We kindly ask you to provide a solution for our problem, as we currently
are not able to use OpenSSL in combination with VS2015. Linking the
applink.c into our applications is no option for us, as we would have to
deploy multiple C runtimes (one for OpenSSL and one for the application).

Best regards,

Hannes Mezger

-- 
*Hannes Mezger*
ascolab GmbH
Tel.: +49 9131 691 124
Fax: +49 9131 691 128
Web: http://www.ascolab.com
GPG-KeyId: 46EC1280
GPG-Fingerprint: D28A DE55 05FA 2FF3 8628 323A 1D6E 9EC8 46EC 1280

--
ascolab GmbH - Am Weichselgarten 7 - 91058 Erlangen - Germany
Handelsregister/Commercial Register: Amtsgericht Fürth HRB 9360
Geschäftsführer/Managing Directors: Gerhard Gappmeier, Matthias Damm,
Uwe Steinkrauß
This email contains confidential information and is for the exclusive
use of the addressee. If you are not the addressee, then any
distribution, copying or use of this email is prohibited. If received in
error, please advise the sender and delete immediately. We accept no
liability for any loss or damage suffered by any person arising from use
of this email.


-------------- next part --------------
_______________________________________________
openssl-bugs-mod mailing list
openssl-bugs-mod at openssl.org
https://mta.openssl.org/mailman/listinfo/openssl-bugs-mod


More information about the openssl-dev mailing list