Skip to content

Commit

Permalink
crypto: add using directives for v8::Int32, Uint32
Browse files Browse the repository at this point in the history
Backport-PR-URL: #20706
PR-URL: #20225
Refs: #20039
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
tniessen authored and addaleax committed May 14, 2018
1 parent f5e7010 commit 1e5de6f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/node_crypto.cc
Expand Up @@ -72,6 +72,7 @@ using v8::External;
using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::HandleScope;
using v8::Int32;
using v8::Integer;
using v8::Isolate;
using v8::Local;
Expand All @@ -84,6 +85,7 @@ using v8::PropertyAttribute;
using v8::ReadOnly;
using v8::Signature;
using v8::String;
using v8::Uint32;
using v8::Value;


Expand Down Expand Up @@ -2698,9 +2700,9 @@ void CipherBase::Init(const FunctionCallbackInfo<Value>& args) {
// represent a valid length at this point.
unsigned int auth_tag_len;
if (args[2]->IsUint32()) {
auth_tag_len = args[2].As<v8::Uint32>()->Value();
auth_tag_len = args[2].As<Uint32>()->Value();
} else {
CHECK(args[2]->IsInt32() && args[2].As<v8::Int32>()->Value() == -1);
CHECK(args[2]->IsInt32() && args[2].As<Int32>()->Value() == -1);
auth_tag_len = kNoAuthTagLength;
}

Expand Down Expand Up @@ -2792,9 +2794,9 @@ void CipherBase::InitIv(const FunctionCallbackInfo<Value>& args) {
// represent a valid length at this point.
unsigned int auth_tag_len;
if (args[3]->IsUint32()) {
auth_tag_len = args[3].As<v8::Uint32>()->Value();
auth_tag_len = args[3].As<Uint32>()->Value();
} else {
CHECK(args[3]->IsInt32() && args[3].As<v8::Int32>()->Value() == -1);
CHECK(args[3]->IsInt32() && args[3].As<Int32>()->Value() == -1);
auth_tag_len = kNoAuthTagLength;
}

Expand Down Expand Up @@ -2998,7 +3000,7 @@ void CipherBase::SetAAD(const FunctionCallbackInfo<Value>& args) {

CHECK_EQ(args.Length(), 2);
CHECK(args[1]->IsInt32());
int plaintext_len = args[1].As<v8::Int32>()->Value();
int plaintext_len = args[1].As<Int32>()->Value();

if (!cipher->SetAAD(Buffer::Data(args[0]), Buffer::Length(args[0]),
plaintext_len))
Expand Down

0 comments on commit 1e5de6f

Please sign in to comment.