OpenSSL compilation errors in Windows

Nagalakshmi V J nagalakshmi.j at altran.com
Fri Oct 18 10:49:58 UTC 2019


Hi Matt,

Sorry I missed your reply as all the conversations are jumbled in that mail.

Please find the sample code snippet. This is a small part.  Like the below sample, we are using SSL and SSL_SESSION structures in many places.

struct PRF_GENERATOR
{
    unsigned char master_secret[48];
    unsigned char server_random[32];
    unsigned char client_random[32];
};


int functionA(SSL* s, PRF_GENERATOR* pGenerator)
{

    if( s->session->master_key_length != sizeof(pGenerator->master_secret) )
        return -1;
    memcpy(pGenerator->master_secret, s->session->master_key, sizeof(pGenerator->master_secret));
    memcpy(pGenerator->server_random, s->s3->server_random, sizeof(pGenerator->server_random));
    memcpy(pGenerator->client_random, s->s3->client_random, sizeof(pGenerator->client_random));
    return 0;
}

In the above function, they are accessing the session from SSL structure as s->session (using openssl 1.0.2j). We cannot access like this 1.1.1c. So we need to use the accessor API which is SSL_get_session(s).
Referred this link (https://www.openssl.org/docs/man1.1.0/man7/ssl.html)

Now the issue is SSL_session structure is also having accessor APIs which I am not aware of. So I need to get the APIs for accessing the master_key_length,etc.. given in the above code. Those are not listed in the openssl link referred.

It would be helpful if I can get to know about the accessor APIs. If you know any documentation link which talks about accessor APIs or any files where all these details are there, you can refer me that.

Kindly let me know if you have any queries with respect to this sample code.

Thanks and regards,
Nagalakshmi

-----Original Message-----
From: openssl-users <openssl-users-bounces at openssl.org> On Behalf Of Matt Caswell
Sent: Thursday, October 3, 2019 6:51 PM
To: openssl-users at openssl.org
Subject: Re: OpenSSL compilation errors in Windows

** This mail has been sent from an external source **


On 03/10/2019 11:10, Nagalakshmi V J wrote:
> Hi Matthias,
>
>
>
> Please find my response for your queries below.
>
>
>
> It would be more helpful if you would tell us *why* you are including
> ssl_locl.h and what you are trying to achieve. Then we might be able
> to tell you how you could achieve your goal using the officially supported API.
>
> [Nagalakshmi]:
>
> In our product code, we are using the structures 'ssl_st'  and 'ssl_session_st'
> which were defined in ssl.h file in Openssl 1.0.2.j version.
>
> Since the structure definitions are made opaque in openssl 1.1.1c, we
> used ssl_locl.h where the structure definitions are available.
>
>
>
> Please note that many of the OpenSSL structures were made opaque in
> version 1.1.0. This means that there are only forward declarations of
> the structures in the public headers and the compiler does not get to  see the structure members.
> Instead of directly accessing the members, it is now necessary to use
> accessor functions (a.k.a. getters and setters).
>
> [Nagalakshmi]:
>
> Regarding usage of accessor functions, I got the following APIs.
>
> SSL_get_session(s)
>
> SSL_SESSION_get_master_key().
>
>
>
> If we use those APIs, I am again getting errors like the below.
>
> /.\odlibPrf_OSSL.h(164) : error C2027: use of undefined type
> 'ssl_session_st'/
>
> /        ..\..\OpenSSL\openssl-1.1.1c\include\openssl/ssl.h(213) : see
> declaration of 'ssl_session_st'/
>
> /.\odlibPrf_OSSL.h(164) : error C2227: left of '->SSL_SESSION_get_master_key'
> must point to class/struct/union/

This at least looks like a syntax error.


>
> /.\odlibPrf_OSSL.h(167) : error C2027: use of undefined type 'ssl_st'/
>
> /        ..\..\OpenSSL\openssl-1.1.1c\include\openssl/ossl_typ.h(147) : see
> declaration of 'ssl_st'/
>
> /.\odlibPrf_OSSL.h(167) : error C2227: left of '->session' must point
> to class/struct/union/
>
> /.\odlibPrf_OSSL.h(167) : error C2227: left of '->master_key' must
> point to class/struct/union/

These suggest you're still trying to direct access structure members.


>
> /.\odlibPrf_OSSL.h(168) : error C2027: use of undefined type 'ssl_st'/


Please show us the source code for the lines these error message correspond to.

Matt

>
>
>
> Can you help me to get the corresponding accessor functions for these 2 structures.
>
>
>
> Thanks and regards,
>
> Nagalakshmi
>
>
>
> -----Original Message-----
> From: Nagalakshmi V J <nagalakshmi.j at altran.com>
> Sent: Tuesday, October 1, 2019 6:33 PM
> To: Dr. Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>;
> Nagalakshmi V J <nagalakshmi.j at altran.com>
> Cc: openssl-users at openssl.org; Umamaheswari Nagarajan
> <umamaheswari.nagarajan at altran.com>
> Subject: RE: OpenSSL compilation errors in Windows
>
>
>
> Thank you Matthias for the explanation. I am going through my code to
> understand why ssl_locl.h is included. I will check and get back on
> this ASAP. Also if there is other way to achieve that I will use the same.
>
>
>
> Thanks and regards,
>
> Nagalakshmi
>
>
>
> -----Original Message-----
>
> From: Dr. Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com
> <mailto:Matthias.St.Pierre at ncp-e.com>>
>
> Sent: Tuesday, October 1, 2019 4:43 PM
>
> To: Nagalakshmi V J <nagalakshmi.j at altran.com
> <mailto:nagalakshmi.j at altran.com>>
>
> Cc: openssl-users at openssl.org <mailto:openssl-users at openssl.org>;
> Umamaheswari Nagarajan <umamaheswari.nagarajan at altran.com
> <mailto:umamaheswari.nagarajan at altran.com>>
>
> Subject: AW: OpenSSL compilation errors in Windows
>
>
>
> ** This mail has been sent from an external source **
>
>
>
>
>
>> We are using OpenSSL APIs in our product code. We are not making any
>> changes
> in OpenSSL.
>
>> Our product code is a C++ code and it makes use of openSSL APIs for
>> some
> functionality.
>
>
>
> Local headers (like "ssl_locl.h" and "packet_locl.h") are *NOT* part
> of the official OpenSSL API.
>
> Please don't expect any support w.r.t. compilation or compatibility
> problems if you do include them in your application, even more if it's
> compiled using a C++ compiler.
>
>
>
> It would be more helpful if you would tell us *why* you are including
> ssl_locl.h and what you are trying to achieve. Then we might be able
> to tell you how you could achieve your goal using the officially supported API.
>
>
>
> Please note that many of the OpenSSL structures were made opaque in
> version 1.1.0. This means that there are only forward declarations of
> the structures in the public headers and the compiler does not get to  see the structure members.
> Instead of directly accessing the members, it is now necessary to use
> accessor functions (a.k.a. getters and setters). If this is the reason
> why you are including private OpenSSL headers then you should adopt
> you application to use the new accessors instead, instead of forcing
> the impossible to circumvent the new policy.
>
>
>
> For more information, see
>
>
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__wiki.openssl.org_
> index.php_OpenSSL-5F1.1.0-5FChanges&d=DwIGaQ&c=cxWN2QSDopt5SklNfbjIjg&
> r=zbjUR56YPF3jaTRTjX4KZlHM9-LmYAuR5atSqEGOnpA&m=wpEV8Q2RDZjERhtJGZl9Ha
> jV9jd2dJFF10J30_YrPQo&s=sX1YilJaXloAQDzrjD3Lz-I6DOej3QduhsAanXOYxVM&e=
>
>
>
> Matthias
>
>
>
>
>
>
>
>
>
>
>
> Dr. Matthias St. Pierre
>
> Senior Software Engineer
>
> matthias.st.pierre at ncp-e.com <mailto:matthias.st.pierre at ncp-e.com>
>
> Phone: +49 911 9968-0
>
> www.ncp-e.com
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ncp-2De.com&d
> =DwIDaQ&c=cxWN2QSDopt5SklNfbjIjg&r=zbjUR56YPF3jaTRTjX4KZlHM9-LmYAuR5at
> SqEGOnpA&m=cDw8_L60-mZAOD-FHwthgUKK4jglLexW6Wpi6EEaKM4&s=XlNG1utFTM1jM
> -izig9lVO9BsRhW9nRWv3oqbsVCOmw&e= >
>
>
>
> Headquarters Germany: NCP engineering GmbH • Dombuehler Str. 2 • 90449
> • Nuremberg North American HQ: NCP engineering Inc. • 678 Georgia Ave.
> • Sunnyvale, CA 94085 East Coast Office: NCP engineering Inc. • 601
> Cleveland Str., Suite 501-25 • Clearwater, FL 33755
>
>
>
> Authorized representatives: Peter Soell, Patrick Oliver Graf, Beate
> Dietrich Registry Court: Lower District Court of Nuremberg Commercial
> register No.: HRB
> 7786 Nuremberg, VAT identification No.: DE 133557619
>
>
>
> This e-mail message including any attachments is for the sole use of
> the intended recipient(s) and may contain privileged or confidential information.
> Any unauthorized review, use, disclosure or distribution is
> prohibited. If you are not the intended recipient, please immediately
> contact the sender by reply e-mail and delete the original message and destroy all copies thereof.
>
> =====================================================
>
> Please refer to https://northamerica.altran.com/email-disclaimer
>
> for important disclosures regarding this electronic communication.
>
> =====================================================
>
> =====================================================
> Please refer to https://northamerica.altran.com/email-disclaimer
> for important disclosures regarding this electronic communication.
> =====================================================
=====================================================
Please refer to https://northamerica.altran.com/email-disclaimer
for important disclosures regarding this electronic communication.
=====================================================


More information about the openssl-users mailing list