-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
crypto: better error message when calling digest twice on a hash #6042
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
Conversation
|
It would be nice to have same for Hmac. |
|
I'd probably want to put that into a different pull request |
src/node_crypto.cc
Outdated
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 think the spaces before and after the arrow should be removed.
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.
fixed
|
Perhaps we should also be inserting a similar check for |
d3f1fea to
735ac30
Compare
src/node_crypto.cc
Outdated
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.
Any particular reason for the capitalization here?
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.
good point fixing
|
why not use only |
3b61487 to
ba02203
Compare
|
@fanatid because there could be some way that a bug could cause the hash to be in an inconsistent state and better safe then sorry |
|
@calvinmetcalf I think that this line never will be reached because you add error throwing |
test/parallel/test-crypto-hash.js
Outdated
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.
Capitalization should be changed here too.
|
I think an additional test for |
3cda16d to
4d5a452
Compare
|
LGTM pending CI |
|
@calvinmetcalf could you answer for my first question?
|
test/parallel/test-crypto-hash.js
Outdated
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.
Linter is complaining about trailing spaces on this line
|
@fanatid woops was cut off replying via email, the initialized would only ever be false if for some reason the hash wasn't initialized, which probably not be possible as it is currently set up, but we don't really loose much testing for it and we will prevent problems down the line if some other change allows it to get into a weird state. |
calling digest or update on a hash object after digest has been called now gives a topical error message instead of an error message saying that the hash failed to initialize.
4d5a452 to
2cb82d2
Compare
|
@mscdex ... ping.. looks like this was updated. PTAL |
|
CI is green |
|
LGTM |
calling digest or update on a hash object after digest has been called now gives a topical error message instead of an error message saying that the hash failed to initialize. PR-URL: #6042 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
|
Landed in 1d9451b |
calling digest or update on a hash object after digest has been called now gives a topical error message instead of an error message saying that the hash failed to initialize. PR-URL: nodejs#6042 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
calling digest or update on a hash object after digest has been called now gives a topical error message instead of an error message saying that the hash failed to initialize. PR-URL: #6042 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
Pull Request check-list
Please make sure to review and check all of these items:
make -j8 test(UNIX) orvcbuild test nosign(Windows) pass withthis change (including linting)?
I'm getting an error on the test-tick-processor test, seems unrelated
test (or a benchmark) included?
existing APIs, or introduces new ones)?
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Affected core subsystem(s)
Please provide affected core subsystem(s) (like buffer, cluster, crypto, etc)
Description of change
calling digest twice on a hash used to give an unhelpful error about the hash not being initialized, this fixes that