-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add OpenSSL warning exception and config const, #51 #52
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove redundant if statement
Use extension_loaded() instead of checking that a function exists.
Use libsodium for random bytes if it's available
Relax open_basedir restriction
paragonie-scott
force-pushed
the
master
branch
2 times, most recently
from
October 15, 2015 18:20
667f430
to
99e9e83
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Issue #5 and also hte discussion in #51
This branch isn't ready to merge but I needed to ask something before going on.
After writing this I found I'm not really happy with using a config const. It introduces the hazard of authoring code without knowing the value (easy mistake). It's hard to test (consts are set in PHPunit config). It's another global. And above all, it removes the caller's choice in the matter. For example, say you were writing a lib that uses some crypto that's just stupid without real randomness. The best you can do is test the const (if you remember to) and fail if it's true. Meanwhile, somewhere else in the project I might prefer OpenSSL's RNG over this. So I'm not sure the choice should be a global policy.
The options I can imagine at present
string random_bytes ( int $length [, bool $allowOpenSsl = false ] )
string random_bytes_risky ( int $length )
openssl_random_pseudo_bytes( $length, true )
in the exception docAll horrible but I like 1. and 3. least. 4. is ok. 2. is probably best. But I don't have strong opinion and defer to others. Let me know what you like and I will proceed with this work.