Skip to content

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Dec 5, 2017

This commit updates the set_field function pointer to return an int, and
also updates the lambdas with a return statement.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

src

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. labels Dec 5, 2017
@danbev
Copy link
Contributor Author

danbev commented Dec 5, 2017

@bnoordhuis
Copy link
Member

The DH_set0_key() in src/node_crypto.cc is a backwards compatibility shim for the function of the same name in openssl 1.1.0, where it returns int.

@danbev
Copy link
Contributor Author

danbev commented Dec 6, 2017

The DH_set0_key() in src/node_crypto.cc is a backwards compatibility shim for the function of the same name in openssl 1.1.0, where it returns int.

Ah I see that now, thanks for clarifying!

Is there a reason for not declaring the return type for the function pointer? I've added a commit with what I mean.

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a suggestion.

@@ -5107,12 +5107,13 @@ void DiffieHellman::SetKey(const v8::FunctionCallbackInfo<v8::Value>& args,
BN_bin2bn(reinterpret_cast<unsigned char*>(Buffer::Data(args[0])),
Buffer::Length(args[0]), nullptr);
CHECK_NE(num, nullptr);
set_field(dh->dh, num);
USE(set_field(dh->dh, num));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're threading through the return value, you might as well CHECK_EQ(1, set_field(dh->dh, num));.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I'll add the check. Thanks

This commit updates the set_field function pointer to return an int, and
also updates the lambdas with a return statement.
@danbev danbev force-pushed the crypto_dh_set0_key_void branch from acbe9e6 to 0a1bfc1 Compare December 7, 2017 06:55
@danbev danbev changed the title crypto: make DH_set0_key void crypto: declare int return type for set_field Dec 7, 2017
@danbev
Copy link
Contributor Author

danbev commented Dec 7, 2017

@danbev
Copy link
Contributor Author

danbev commented Dec 8, 2017

Landed in abc2801

@danbev danbev closed this Dec 8, 2017
danbev added a commit that referenced this pull request Dec 8, 2017
This commit updates the set_field function pointer to return an int, and
also updates the lambdas with a return statement.

PR-URL: #17468
Reviewed-By: Ben Noordhuis <[email protected]>
@danbev danbev deleted the crypto_dh_set0_key_void branch December 8, 2017 06:22
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
This commit updates the set_field function pointer to return an int, and
also updates the lambdas with a return statement.

PR-URL: #17468
Reviewed-By: Ben Noordhuis <[email protected]>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
This commit updates the set_field function pointer to return an int, and
also updates the lambdas with a return statement.

PR-URL: #17468
Reviewed-By: Ben Noordhuis <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Dec 12, 2017
@gibfahn
Copy link
Member

gibfahn commented Dec 20, 2017

Should this be backported to v8.x-staging? If yes please follow the guide and raise a backport PR, if no let me know or add the dont-land-on label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants