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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: move _scrypt call out of handleError funct #28318

Closed
wants to merge 5 commits into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Jun 20, 2019

This commit moves the _scrypt function call out of the handleError
function, which now only takes in an error object as its parameter.

The motivation for this is to hopefully improve readability as it was
not clear to me the first time I stepped through the code where the
actual call to _scrypt was.

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

This commit moves the _scrypt function call out of the handleError
function, which now only takes in an error object as its parameter.

The motivation for this is to hopefully improve readability as it was
not clear to me the first time I stepped through the code where the
actual call to _scrypt was.
@nodejs-github-bot nodejs-github-bot added the crypto Issues and PRs related to the crypto subsystem. label Jun 20, 2019
@nodejs-github-bot
Copy link
Collaborator

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.

If you're going to make this change, you should also make it to pbkdf2.js, random.js and (possibly) keygen.js, otherwise you're introducing style inconsistencies between the files in lib/internal/crypto.

lib/internal/crypto/scrypt.js Outdated Show resolved Hide resolved
@danbev
Copy link
Contributor Author

danbev commented Jun 20, 2019

f you're going to make this change, you should also make it to pbkdf2.js, random.js and (possibly) keygen.js

Ah I see, let me take a look and update them too. Thanks

This commit moves the _randomBytes function call out of the handleError
function, which now it takes in an error and a buf object as its
parameters.
This commit moves the _pbkdf2 function call out of the handleError
function, which now only takes in an error and a digest object as
its parameters.
This commit moves the _impl function call out of the handleError
function, which now only takes in an object as its parameter.
@nodejs-github-bot
Copy link
Collaborator

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 although it drops the D in DRY.

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 21, 2019
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@danbev
Copy link
Contributor Author

danbev commented Jun 24, 2019

Landed in 882e8fe, 556b38a, 7edd5f3, and c6f968d.

@danbev danbev closed this Jun 24, 2019
@danbev danbev deleted the scrypt_handleError branch June 24, 2019 03:44
danbev added a commit that referenced this pull request Jun 24, 2019
This commit moves the _scrypt function call out of the handleError
function, which now only takes in an error object as its parameter.

The motivation for this is to hopefully improve readability as it was
not clear to me the first time I stepped through the code where the
actual call to _scrypt was.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
danbev added a commit that referenced this pull request Jun 24, 2019
This commit moves the _randomBytes function call out of the handleError
function, which now it takes in an error and a buf object as its
parameters.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
danbev added a commit that referenced this pull request Jun 24, 2019
This commit moves the _pbkdf2 function call out of the handleError
function, which now only takes in an error and a digest object as
its parameters.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
danbev added a commit that referenced this pull request Jun 24, 2019
This commit moves the _impl function call out of the handleError
function, which now only takes in an object as its parameter.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jul 2, 2019
This commit moves the _scrypt function call out of the handleError
function, which now only takes in an error object as its parameter.

The motivation for this is to hopefully improve readability as it was
not clear to me the first time I stepped through the code where the
actual call to _scrypt was.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jul 2, 2019
This commit moves the _randomBytes function call out of the handleError
function, which now it takes in an error and a buf object as its
parameters.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jul 2, 2019
This commit moves the _pbkdf2 function call out of the handleError
function, which now only takes in an error and a digest object as
its parameters.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jul 2, 2019
This commit moves the _impl function call out of the handleError
function, which now only takes in an object as its parameter.

PR-URL: #28318
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targos targos mentioned this pull request Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. crypto Issues and PRs related to the crypto subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants