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
Fix & update documentation about RAND_priv_bytes() #6514
Closed
Closed
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ed10e19
Fix & update documentation about RAND_priv_bytes()
romen 7bd4945
[will-squash] Address feedback
romen 4fdeba6
[will-squash] Update Copyright year in `doc/man3/BN-rand.pod`
romen 509cdce
[fixup] rephrase, restyle, edit RAND.7
romen e5cde2e
[fixup] make comments about error checking more explicit
romen d246d50
[fixup] fix links to external manpages
romen f443e19
[fixup] add missing commas
romen f26704c
[fixup] address minor grammar nits spotted by @kaduk
romen File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mirrored the note contained in RAND_bytes.3 for
Reading RAND.7, to me it seems that this, and the original note, are in conflict to the following statement:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, silly me, rereading it they are not in conflict. It's just remarking about the fact that whenever randomness is requested through one of those functions, the developer should always check for errors in case there wasn't enough randomness.
I would rephrase this note and the one in RAND_bytes.3 just to make the message about checking the return value more explicit for this reason!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to become something bigger? Then you might want to consider one of the following two options:
Add "WIP:" to the beginning of the pull request title so we see it is work-in-progress and will make useful comments but not attempt a formal review. (As long as it is WIP, you are free to squash and reorganize as you like)
Keep this pull request limited to RAND_priv_bytes() only and create a new WIP pull request (which can even be based on this branch initially) for all the new ideas you came up with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's pretty much done now, when I opened it it was limited only to
BN_priv_rand()
andRAND_priv_bytes()
, it was only after the feedback onRAND(7)
andRAND_DRBG(7)
that I noticed that alsoRAND(7)
needed updating, because it had the same notice note on "long-term secrets" rather than "any private value".Commit d246d50 too is just an improvement on some feedback I received in this PR, about including a note about errors when the CSPRNG does not have enough entropy: upon reading
RAND(7)
I initially misinterpreted the intention of the note when compared with the note inRAND(7)
about automatic initialization and reseeding: when I (5 minutes later) realized that the note onRAND_bytes(3)
was to remind API users to always check for the error return value, I made that more explicit so that other silly users like me don't fall in the same trap!