Comments (3)
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.
- 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.
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)
- How to install and use luacrypto in Lua-Corona application on Windows platform? Is this a valid combination? Please advise. HOT 2
- missing tags
- doesn't build and install on ubuntu 12.10, probably not on any debian-derived distro HOT 2
- reset IV method
- I cannot compile it in fedora 20 HOT 2
- sorry, how to use crypto.verify to verify rsa
- when I use sha1WithRSAEncryption to verify java SHA1WithRSA ,result is false
- key length issue in crypto.encrypt API HOT 1
- I got an error for luacrypto.c HOT 18
- Deprecate? HOT 11
- Can't build with cmake
- Update rockspec for luacrypto to support 5.3
- BIO memory leak with pkey_from_pem and x509__x509_from_string? HOT 4
- Error: Build error: Failed compiling object src/lcrypto.o HOT 5
- /usr/bin/ld final link failed bad value
- Unable to decrypt cipher encrypted by Crypto-JS (AES default)
- fail to install luacrypto HOT 2
- installed, not sure where to find it
- why not support openssl 1.1.0 or higher? HOT 1
- how to set up on windows? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luacrypto.