| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 955b98a commit dc2a4af
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,7 +104,17 @@ Maybe<bool> ScryptTraits::AdditionalConfig( | |||
| 104 | 104 | params->maxmem, | |
| 105 | 105 | nullptr, | |
| 106 | 106 | 0) != 1) { | |
| 107 | - THROW_ERR_CRYPTO_INVALID_SCRYPT_PARAMS(env); | ||
| 107 | + // Do not use CryptoErrorStore or ThrowCryptoError here in order to maintain | ||
| 108 | + // backward compatibility with ERR_CRYPTO_INVALID_SCRYPT_PARAMS. | ||
| 109 | + uint32_t err = ERR_peek_last_error(); | ||
| 110 | + if (err != 0) { | ||
| 111 | + char buf[256]; | ||
| 112 | + ERR_error_string_n(err, buf, sizeof(buf)); | ||
| 113 | + THROW_ERR_CRYPTO_INVALID_SCRYPT_PARAMS( | ||
| 114 | + env, "Invalid scrypt params: %s", buf); | ||
| 115 | + } else { | ||
| 116 | + THROW_ERR_CRYPTO_INVALID_SCRYPT_PARAMS(env); | ||
| 117 | + } | ||
| 108 | 118 | return Nothing<bool>(); | |
| 109 | 119 | } | |
| 110 | 120 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -178,7 +178,8 @@ for (const options of bad) { | |||
| 178 | 178 | ||
| 179 | 179 | for (const options of toobig) { | |
| 180 | 180 | const expected = { | |
| 181 | - message: /Invalid scrypt param/ | ||
| 181 | + message: /Invalid scrypt params:.*memory limit exceeded/, | ||
| 182 | + code: 'ERR_CRYPTO_INVALID_SCRYPT_PARAMS', | ||
| 182 | 183 | }; | |
| 183 | 184 | assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}), | |
| 184 | 185 | expected); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments