Git Product home page Git Product logo

Comments (6)

alfredh avatar alfredh commented on May 17, 2024

we should support openssl 0.9.8 to 1.1.0, and libressl

from re.

lgrahl avatar lgrahl commented on May 17, 2024

Thanks for the quick reply. I think it would make sense adding this information to https://github.com/creytiv/re/blob/master/docs/README

from re.

lgrahl avatar lgrahl commented on May 17, 2024

As a follow-up question: Would you guys prefer OpenSSL version checks or is checking that a functions is defined fine for you as well? For example:

#if defined(SSL_CTX_set_ecdh_auto)
    ...
#else
    ...
#endif

or

#if OPENSSL_VERSION_NUMBER >= 0x1000200fL
    ...
#else
    ...
#endif

The reason why I'm asking is that I'm not sure if libressl mimics the OPENSSL_VERSION_NUMBER. And furthermore, it seems much easier to just check if the function is defined.

Move along, nothing to see here! 😰

from re.

czarkoff avatar czarkoff commented on May 17, 2024

I am not a project member, so take my word with some grain of salt, but:

  1. Macro tests should be preferred over version checks, whenever available. Who knows what modifications people/distributions may apply to their OpenSSL packages? Some may even specifically mock OpenSSL versions for some arcane reasons.
  2. Preprocessor does not see function definitions, so test #if defined(function) should always evaluate to false. Try the following to see for yourself:
cat > t.c << EOF
#include <stdio.h>

int
main(void)
{
    printf("#ifdef printf: ");
#ifdef printf
    printf("true\n");
#else
    printf("false\n");
#endif

    printf("#if defined(printf): ");
#if defined(printf)
    printf("true\n");
#else
    printf("false\n");
#endif

    return 0;
}
EOF
cc -o t t.c
./t

from re.

lgrahl avatar lgrahl commented on May 17, 2024

Oh, you're right... I'm a bit embarrassed about that. The check above only works because SSL_CTX_set_ecdh_auto is indeed a macro, at least in OpenSSL. If I understand you correctly, checking for existence would normally be done during configuration which re doesn't have... so, although I agree with you on your first point... back to version checking for now?

from re.

alfredh avatar alfredh commented on May 17, 2024

can we close this now?

if a macro is available to show if a feature is present or not, it is good to use it.
otherwise using a version check is fine too.

from re.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.