-
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: make some easy parts 1.1.0-compatible #15348
Conversation
@nodejs/crypto PTAL |
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 modulo style nit (and a suggestion.)
src/node_crypto.cc
Outdated
@@ -1430,10 +1430,13 @@ int SSLWrap<Base>::NewSessionCallback(SSL* s, SSL_SESSION* sess) { | |||
memset(serialized, 0, size); | |||
i2d_SSL_SESSION(sess, &serialized); | |||
|
|||
unsigned int session_id_length; | |||
const unsigned char *session_id = SSL_SESSION_get_id(sess, |
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.
char*
(star leans left)
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.
Done.
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.
@bnoordhuis is there a way to solve these issues with a new linter? On JS side there are almost no style nits since quite a while but I have seen a lot of those for C++. A issue like this one should be not to difficult to spot for a linter, right?
I do not write C++ normally, so I do not know if there is a good alternative to cpplint but google gave me e.g. http://clang.llvm.org/extra/clang-tidy/ and it seems to be extendable. So we could also add more rules if we are not happy with the PRs.
This should reduce the work for everyone involved as far as I can tell.
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.
clang-format
is wonderful and quite configurable. There's even a mode where it only applies to the code you touched in your diff. A lot of parts of Chromium require that running through that to upload a change.
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.
Apropos clang-format
, see the discussion in #3612.
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.
💯 on having a C++ linter, looking at #3612 it sounds like the massive diff was an issue, but most people were +1 on the idea of having linting.
Given how much we use eslint
, and that we've had more and more sweeping changes from it, I think we're probably more open to these kinds of refactorings these days. It could even just start with one rule (like star leans left
). Auto fixing issues sounds good too.
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.
Not just the diff was a problem, clang is hard to get, linux distro packaged versions are out of date, and each version of the formatter seems to do things differently. I think packaging for OS X and Windows was even more problematic than linux. If it was stable, easy to get, widely available, it'd would have flown further.
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.
Maybe packaging it as an npm module might be helpful then.
src/node_crypto.cc
Outdated
&p, | ||
ext->value->length, | ||
ASN1_ITEM_ptr(method->it))); | ||
GENERAL_NAMES* names = reinterpret_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(ext)); |
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.
Since you're here: static_cast
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.
Done.
This accessor exists in OpenSSL 1.0.2, so it may be used already. This is cherry-picked from PR nodejs#8491.
There is no need to reach into quite so many internals to decode an extension.
ae745c6
to
a69a443
Compare
The rest of the 1.1.0 PR is taking a bit longer to put together, but it's coming along. My plan is to send you one PR that does the full port, but with all the individual pieces split into separate commits. This way you don't need to worry about landing |
@bnoordhuis would you be so kind and sign off again? I think this could land otherwise. |
This accessor exists in OpenSSL 1.0.2, so it may be used already. This is cherry-picked from PR nodejs#8491. PR-URL: nodejs#15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
There is no need to reach into quite so many internals to decode an extension. PR-URL: nodejs#15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This accessor exists in OpenSSL 1.0.2, so it may be used already. This is cherry-picked from PR nodejs#8491. PR-URL: nodejs#15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
There is no need to reach into quite so many internals to decode an extension. PR-URL: nodejs#15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
There is no need to reach into quite so many internals to decode an extension. PR-URL: #15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This accessor exists in OpenSSL 1.0.2, so it may be used already. This is cherry-picked from PR #8491. PR-URL: nodejs/node#15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
There is no need to reach into quite so many internals to decode an extension. PR-URL: nodejs/node#15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
There is no need to reach into quite so many internals to decode an extension. PR-URL: #15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
There is no need to reach into quite so many internals to decode an extension. PR-URL: #15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@nodejs/crypto this lands cleanly on v6.x and I've opted to cherry-pick it. Please LMK if it should be backed out. |
There is no need to reach into quite so many internals to decode an extension. PR-URL: #15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
There is no need to reach into quite so many internals to decode an extension. PR-URL: #15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
I'll upload a PR for the rest of it once I've finished fixing up the original PR, but since these two work just fine in 1.0.2 without any ifdefs, I figured I'd upload them now as general cleanup.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
crypto