Skip to content

crypto.scryptSync regression in Node 15: routines:EVP_PBE_scrypt:memory limit exceeded #35815

@demurgos

Description

@demurgos
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions