-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Crypto add opensslerror stack #15518
Conversation
@@ -193,7 +193,7 @@ detailing the point in the code at which the `Error` was instantiated, and may | |||
provide a text description of the error. |
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.
This commit has the latest review comment fixes.
@bnoordhuis, i believe i've addressed all of your comments. Thanks for the review.
if (es->bottom != es->top) { | ||
Local<Array> error_stack = Array::New(env->isolate()); | ||
int top = es->top; | ||
|
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.
Now, we wont add the property to the exception every time.
src/node_crypto.cc
Outdated
// arithmetic to loop back around in the case where bottom is after top. | ||
// Using ERR_NUM_ERRORS macro defined in openssl. | ||
es->top = (((es->top - 1) % ERR_NUM_ERRORS) + ERR_NUM_ERRORS) % | ||
ERR_NUM_ERRORS; | ||
} |
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.
handle the ring buffer with modular arithmetic
src/node_crypto.cc
Outdated
@@ -4326,8 +4339,6 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem, | |||
int r = 0; | |||
EVP_PKEY_CTX* pkctx = nullptr; | |||
|
|||
ERR_set_mark(); | |||
|
|||
bp = BIO_new_mem_buf(const_cast<char*>(key_pem), key_pem_len); |
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.
this is not needed
test/parallel/test-crypto.js
Outdated
err.openSSLErrorStack !== undefined && | ||
Array.isArray(err.openSSLErrorStack) && | ||
err.openSSLErrorStack.length === 0) { | ||
err.openSSLErrorStack === undefined) { | ||
return true; |
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.
update test since the openSSLErrorStack is not always added
ping @nodejs/crypto |
doc/api/errors.md
Outdated
@@ -193,7 +193,7 @@ detailing the point in the code at which the `Error` was instantiated, and may | |||
provide a text description of the error. | |||
|
|||
For crypto only, `Error` objects will include the OpenSSL error stack in a | |||
separate property called `openSSLErrorStack` if it is available when the error is thrown. |
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.
long line 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.
LGTM
@gla5001 when trying to rebase this on the CI it gets a conflict. I am a bit surprised that this is not shown here but would you be so kind and rebase this nevertheless? |
@BridgeAR sure thing |
Feature request to add openSSL error stack to the exception object thrown from crypto. New exception property only added to object if the error stack has not cleared out prior to calling ThrowCryptoError. Refs: nodejs#5444
537284e
to
2ad7440
Compare
@BridgeAR rebased and pushed. Could you let me know if this resolves the issue? |
Landed in ccfcd88 |
Add openSSL error stack to the exception object thrown from crypto. The new exception property is only added to the object if the error stack has not cleared out prior to calling ThrowCryptoError. PR-URL: #15518 Refs: #5444 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
Add openSSL error stack to the exception object thrown from crypto. The new exception property is only added to the object if the error stack has not cleared out prior to calling ThrowCryptoError. PR-URL: nodejs#15518 Refs: nodejs#5444 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
The commit log could have had a link to #14725, that's where 95% of the review took place. This comment will have to do. |
Add openSSL error stack to the exception object thrown from crypto. The new exception property is only added to the object if the error stack has not cleared out prior to calling ThrowCryptoError. PR-URL: #15518 Refs: #5444 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
Add openSSL error stack to the exception object thrown from crypto. The new exception property is only added to the object if the error stack has not cleared out prior to calling ThrowCryptoError. PR-URL: nodejs/node#15518 Refs: nodejs/node#5444 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
Add openSSL error stack to the exception object thrown from crypto. The new exception property is only added to the object if the error stack has not cleared out prior to calling ThrowCryptoError. PR-URL: #15518 Refs: #5444 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
Add openSSL error stack to the exception object thrown from crypto. The new exception property is only added to the object if the error stack has not cleared out prior to calling ThrowCryptoError. PR-URL: #15518 Refs: #5444 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
Should this be backported to edit: this likely shouldn'y be backported if it is changing error messages prior to error codes... but I wanted to confirm |
@MylesBorins I believe it should not be backported. |
Feature request to add openSSL error stack to the exception object
thrown from crypto. New exception property only added to object
if the error stack has not cleared out prior to calling
ThrowCryptoError.
I did something very wrong when trying to rebase, so i just created a new branch and a new PR. This PR has all the changes requested from #14725. I will close the other one.
Refs: #5444
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
crypto