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: support Uint8Array prime in createDH #11983

Closed
wants to merge 3 commits into from

Conversation

addaleax
Copy link
Member

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

@nodejs-github-bot nodejs-github-bot added the crypto Issues and PRs related to the crypto subsystem. label Mar 22, 2017
@addaleax addaleax force-pushed the crypto-uint8array branch from b18f95d to dbee04c Compare March 22, 2017 06:56
@addaleax addaleax added the semver-major PRs that contain breaking changes and should be released in the next major version. label Mar 22, 2017
const modp2Secret = modp2.computeSecret(exmodp2.getPublicKey())
.toString('hex');
const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey())
.toString('hex');
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for indenting some of these differently?

Copy link
Member

Choose a reason for hiding this comment

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

Happens around lines 120, 148, 168 and 172 too.

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 modulo style nits.

lib/crypto.js Outdated
typeof sizeOrKey !== 'string' &&
!isUint8Array(sizeOrKey))
throw new TypeError('First argument should be number, string, ' +
'Uint8Array or Buffer');
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add braces while you're here.

const modp2Secret = modp2.computeSecret(exmodp2.getPublicKey())
.toString('hex');
const exmodp2Secret = exmodp2.computeSecret(modp2.getPublicKey())
.toString('hex');
Copy link
Member

Choose a reason for hiding this comment

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

Happens around lines 120, 148, 168 and 172 too.

@addaleax
Copy link
Member Author

{
// Ensure specific generator (string with encoding) works as expected,
// with a Uint8Array as the first argument to createDiffieHellman().
const exmodp2 = crypto.createDiffieHellman(new Uint8Array([...modp2buf]),
Copy link
Member

Choose a reason for hiding this comment

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

Nit: avoid using the spread operator? Feel free to ignore

@addaleax
Copy link
Member Author

Landed in 0db49fe

@addaleax addaleax closed this Mar 27, 2017
@addaleax addaleax deleted the crypto-uint8array branch March 27, 2017 00:16
addaleax added a commit that referenced this pull request Mar 27, 2017
PR-URL: #11983
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@jasnell jasnell mentioned this pull request Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Issues and PRs related to the crypto subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants