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.scryptSync regression in Node 15: routines:EVP_PBE_scrypt:memory limit exceeded #35815

Closed
demurgos opened this issue Oct 26, 2020 · 2 comments
Labels
confirmed-bug Issues with confirmed bugs. crypto Issues and PRs related to the crypto subsystem.

Comments

@demurgos
Copy link
Contributor

  • Version: 15.0.1
  • Platform: Linux 64 bits
  • Subsystem: crypto

What steps will reproduce the bug?

Create main.js and run it.

// main.js
const crypto = require("crypto");
// 2-3 iteration steps are enough to cause the error, but it's not deterministic so I am running it 100 times to make sure the error occurs
for (let i = 0; i < 100; i++) {
  crypto.scryptSync('', '', 64, { N: 128, r: 1, p: 1 })
}

How often does it reproduce? Is there a required condition?

Calling scryptSync a few times always produces this error. This is not deterministic: sometimes 2 calls were enough, sometimes I need 3 calls.

What is the expected behavior?

The script completes without any error

What do you see instead?

I see the following error:

node:internal/crypto/scrypt:81
    throw err;
    ^

Error: error:060B50AC:digital envelope routines:EVP_PBE_scrypt:memory limit exceeded
    at Object.scryptSync (node:internal/crypto/scrypt:78:29)
    at Object.<anonymous> (/data/projects/main.js:3:10)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
    at node:internal/main/run_main_module:17:47

Additional information

This is a regression in Node 15. Running the same code on the same computer with Node 14.14.0 works fine.

@jasnell jasnell added confirmed-bug Issues with confirmed bugs. crypto Issues and PRs related to the crypto subsystem. labels Oct 26, 2020
@jasnell
Copy link
Member

jasnell commented Oct 26, 2020

Ok, able to reproduce. Will investigate today!

jasnell added a commit to jasnell/node that referenced this issue Oct 26, 2020
Fixes a handful of regressions in scrypt support following
the refactor.

Fixes: nodejs#35815
@jasnell
Copy link
Member

jasnell commented Oct 26, 2020

PR: #35821

targos pushed a commit that referenced this issue Nov 3, 2020
Fixes a handful of regressions in scrypt support following
the refactor.

Fixes: #35815

PR-URL: #35821
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. crypto Issues and PRs related to the crypto subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants