Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: simplify internal state handling #23648

Conversation

tniessen
Copy link
Member

Uninitialized DH instances are never exposed to users, so this condition should always be true.

(This also increases coverage 馃帀)

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

Uninitialized instances are not exposed to users, so this condition should
always be true.
@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 Oct 13, 2018
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

I suspect you could get rid of initialised_ altogether since at no point should instances where initialised_ == true leak to JS land.

@tniessen
Copy link
Member Author

tniessen added a commit that referenced this pull request Oct 17, 2018
Uninitialized instances are not exposed to users, so this condition should
always be true.

PR-URL: #23648
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@tniessen
Copy link
Member Author

Landed in e2f58c7.

@tniessen tniessen closed this Oct 17, 2018
tniessen added a commit to tniessen/node that referenced this pull request Oct 17, 2018
As pointed out by Ben Noordhuis, this internal field can be removed
since all instances are initialised when exposed to users.

Refs: nodejs#23648
jasnell pushed a commit that referenced this pull request Oct 17, 2018
Uninitialized instances are not exposed to users, so this condition should
always be true.

PR-URL: #23648
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
tniessen added a commit that referenced this pull request Oct 19, 2018
As pointed out by Ben Noordhuis, this internal field can be removed
since all instances are initialized when exposed to users.

PR-URL: #23717
Refs: #23648
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@refack
Copy link
Contributor

refack commented Oct 20, 2018

This borkes Travis that uses unsupported 馃槪GCC 4.8

../src/node_crypto.cc:3641:29: error: no matching function for call to 'get'
    return sign->CheckThrow(std::get<Error>(ret));
                            ^~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/utility:142:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Int'
    get(std::pair<_Tp1, _Tp2>& __in) noexcept
    ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/utility:147:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Int'
    get(std::pair<_Tp1, _Tp2>&& __in) noexcept
    ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/utility:152:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Int'
    get(const std::pair<_Tp1, _Tp2>& __in) noexcept
    ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/array:268:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Int'
    get(array<_Tp, _Nm>& __arr) noexcept
    ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/array:277:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter '_Int'

@refack
Copy link
Contributor

refack commented Oct 20, 2018

Suggested fix in #23778

addaleax pushed a commit that referenced this pull request Oct 20, 2018
Uninitialized instances are not exposed to users, so this condition should
always be true.

PR-URL: #23648
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
addaleax pushed a commit that referenced this pull request Oct 20, 2018
As pointed out by Ben Noordhuis, this internal field can be removed
since all instances are initialized when exposed to users.

PR-URL: #23717
Refs: #23648
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
jasnell pushed a commit that referenced this pull request Oct 21, 2018
As pointed out by Ben Noordhuis, this internal field can be removed
since all instances are initialized when exposed to users.

PR-URL: #23717
Refs: #23648
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Oct 30, 2018
Uninitialized instances are not exposed to users, so this condition should
always be true.

PR-URL: #23648
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Oct 30, 2018
As pointed out by Ben Noordhuis, this internal field can be removed
since all instances are initialized when exposed to users.

PR-URL: #23717
Refs: #23648
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@codebytere codebytere mentioned this pull request Nov 27, 2018
rvagg pushed a commit that referenced this pull request Nov 28, 2018
Uninitialized instances are not exposed to users, so this condition should
always be true.

PR-URL: #23648
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
As pointed out by Ben Noordhuis, this internal field can be removed
since all instances are initialized when exposed to users.

PR-URL: #23717
Refs: #23648
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Nov 29, 2018
Uninitialized instances are not exposed to users, so this condition should
always be true.

PR-URL: #23648
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Nov 29, 2018
As pointed out by Ben Noordhuis, this internal field can be removed
since all instances are initialized when exposed to users.

PR-URL: #23717
Refs: #23648
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@codebytere codebytere mentioned this pull request Nov 29, 2018
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.

None yet

5 participants