summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2019-07-21 20:14:34 +0200
committerRich Trott <rtrott@gmail.com>2019-07-23 21:17:19 -0700
commit1dc458cdd0a578093d5e84439158c799664b78cf (patch)
tree9d919b307df1ff952e46484acf0aa14ea6adc4be /src
parentbd3b85bf89df16515ad79b537da02b8a6d3fba55 (diff)
downloadandroid-node-v8-1dc458cdd0a578093d5e84439158c799664b78cf.tar.gz
android-node-v8-1dc458cdd0a578093d5e84439158c799664b78cf.tar.bz2
android-node-v8-1dc458cdd0a578093d5e84439158c799664b78cf.zip
crypto: increase maxmem range from 32 to 53 bits
Fixes: https://github.com/nodejs/node/issues/28755 PR-URL: https://github.com/nodejs/node/pull/28799 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/node_crypto.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 8a2ec41161..ef8983b2f7 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -6015,7 +6015,7 @@ struct ScryptJob : public CryptoJob {
uint32_t N;
uint32_t r;
uint32_t p;
- uint32_t maxmem;
+ uint64_t maxmem;
CryptoErrorVector errors;
inline explicit ScryptJob(Environment* env) : CryptoJob(env) {}
@@ -6070,7 +6070,7 @@ void Scrypt(const FunctionCallbackInfo<Value>& args) {
CHECK(args[3]->IsUint32()); // N
CHECK(args[4]->IsUint32()); // r
CHECK(args[5]->IsUint32()); // p
- CHECK(args[6]->IsUint32()); // maxmem
+ CHECK(args[6]->IsNumber()); // maxmem
CHECK(args[7]->IsObject() || args[7]->IsUndefined()); // wrap object
std::unique_ptr<ScryptJob> job(new ScryptJob(env));
job->keybuf_data = reinterpret_cast<unsigned char*>(Buffer::Data(args[0]));
@@ -6080,7 +6080,8 @@ void Scrypt(const FunctionCallbackInfo<Value>& args) {
job->N = args[3].As<Uint32>()->Value();
job->r = args[4].As<Uint32>()->Value();
job->p = args[5].As<Uint32>()->Value();
- job->maxmem = args[6].As<Uint32>()->Value();
+ Local<Context> ctx = env->isolate()->GetCurrentContext();
+ job->maxmem = static_cast<uint64_t>(args[6]->IntegerValue(ctx).ToChecked());
if (!job->Validate()) {
// EVP_PBE_scrypt() does not always put errors on the error stack
// and therefore ToResult() may or may not return an exception