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

Created on 26 Oct 2020  路  2Comments  路  Source: nodejs/node

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

confirmed-bug crypto

Most helpful comment

All 2 comments

Ok, able to reproduce. Will investigate today!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsemozhetbyt picture vsemozhetbyt  路  3Comments

fanjunzhi picture fanjunzhi  路  3Comments

srl295 picture srl295  路  3Comments

ksushilmaurya picture ksushilmaurya  路  3Comments

addaleax picture addaleax  路  3Comments