Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Fix compilation without deprecated OpenSSL 1.1 APIs #122

Merged
merged 2 commits into from
Jan 24, 2019

Conversation

neheb
Copy link
Contributor

@neheb neheb commented Jan 18, 2019

All threading APIs are gone with 1.1.

dh.h header does not get included with ssl.h automatically when deprecated
APIs are disabled.

X509_getBefore/After were replaced with get0 and getm variants. Switched
to the former as it can be const.

@NathanFrench NathanFrench self-assigned this Jan 22, 2019
@NathanFrench
Copy link
Collaborator

There seems to be an unterminated ifdef in here. Trying to work this one out.

All threading APIs are gone with 1.1.

dh.h header does not get included with ssl.h automatically when deprecated
APIs are disabled.

X509_getBefore/After were replaced with get0 and getm variants. Switched
to the former as it can be const.
@neheb
Copy link
Contributor Author

neheb commented Jan 23, 2019

I added a space. Seems to work now?

@neheb
Copy link
Contributor Author

neheb commented Jan 23, 2019

Reorganized the ifdef maze. Should be more readable and consistent (only < #if statements)

@NathanFrench
Copy link
Collaborator

With this, it seems that the only time either htp__ssl_get_thread_id_ or htp__ssl_get_thread_id_ is only available if OPENSSL_VERSION_NUMBER < 0x10100000L.

It's easier to read with indents:

#if OPENSSL_VERSION_NUMBER < 0x10100000L
    #ifndef WIN32
        #define _HTP_tid (unsigned long)pthread_self()
    #else
        #define _HTP_tid pthread_self().p
    #endif

    #if OPENSSL_VERSION_NUMBER < 0x10000000L
        static unsigned long
        htp__ssl_get_thread_id_(void)
        {
            return _HTP_tid;
        }
    #else
        static void
        htp__ssl_get_thread_id_(CRYPTO_THREADID *id)
        {
            CRYPTO_THREADID_set_numeric(id, _HTP_tid);
        }
    #endif
#endif

It doesn't seem like this is the expected result, I could be wrong, can you verify?

@NathanFrench
Copy link
Collaborator

I think this is what we needed. Can you verify?

#ifndef WIN32
#define _HTP_tid (unsigned long)pthread_self()
#else
#define _HTP_tid pthread_self().p
#endif

#if OPENSSL_VERSION_NUMBER < 0x10000000L
static unsigned long
htp__ssl_get_thread_id_(void)
{
    return _HTP_tid;
}

#else
static void
htp__ssl_get_thread_id_(CRYPTO_THREADID * id)
{
    CRYPTO_THREADID_set_numeric(id, _HTP_tid);
}

#endif

@neheb
Copy link
Contributor Author

neheb commented Jan 23, 2019

Seems correct.

I changed tid from unsigned long to a define as it was warning about some const issue.

edit: regarding indents.

#if works
# if works
#  if does not.

I don't know that " #if" does either.

@NathanFrench
Copy link
Collaborator

I tested on an older box with 0.8 and it compiles fine. I'm going to make those mods and merge all the changes in.

Thanks again.

NathanFrench added a commit that referenced this pull request Jan 24, 2019
@NathanFrench NathanFrench merged commit 8e543fe into Yellow-Camper:develop Jan 24, 2019
NathanFrench added a commit that referenced this pull request Jan 24, 2019
@neheb neheb deleted the l branch January 24, 2019 19:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants