Giter Site home page Giter Site logo

Comments (3)

mkottman avatar mkottman commented on August 16, 2024

Hi, that's a good idea, however I am thinking on how to implement this in such a way that existing code using this library is not affected. There are several possibilities:

  • Add a function called init() which calls OpenSSL_add_all_digests() and OpenSSL_add_all_ciphers(). However, existing code would need to be changed and simple one-liners would need to be extended, something I want to avoid.
  • Use an environment variable such as OPENSSL_INITIALIZED, which if set to anything, the module would not call the initialization functions.
  • Detect if any digests/ciphers are available (something like: if #crypto.list('digests') + #crypto.list('ciphers') == 0 then ... end), and call the functions if no ciphers/digests are available.

Which do you think would be best?

from luacrypto.

IlyaM avatar IlyaM commented on August 16, 2024
- Add a function called init() which calls OpenSSL_add_all_digests() and OpenSSL_add_all_ciphers(). However, existing code would need to be changed and simple one-liners would need to be extended, something I want to avoid.

I don't like this option as well. For simple use cases luacrypto library should just work out of box.

- Use an environment variable such as OPENSSL_INITIALIZED, which if set to anything, the module would not call the initialization functions.

Not sure if I like this option. Normally environment variables are used to configure behavior of application by users and not configure behavior of library by application. Details of openssl initialization is application logic which shouldn't be configurable by user.

- Detect if any digests/ciphers are available (something like: `if #crypto.list('digests') + #crypto.list('ciphers') == 0 then ... end`), and call the functions if no ciphers/digests are available.

On the first glance it should work assuming that OpenSSL's internal table of digest algorithms and ciphers is expected to be completely empty without explicit initialization.

Which do you think would be best?

Another simple option is to make this behavior configurable at compile time. At least for me having simple #ifdef around OpenSSL_add_all_digests() and OpenSSL_add_all_ciphers() calls would work.

from luacrypto.

mkottman avatar mkottman commented on August 16, 2024

Another simple option is to make this behavior configurable at compile time. At least for me having simple #ifdef around OpenSSL_add_all_digests() and OpenSSL_add_all_ciphers() calls would work.

Okay, honestly I was only thinking of runtime options. Because this is so simple, I will add a compile flag that will add external initialization of OpenSSL.

from luacrypto.

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.