10
10
11
11
namespace node {
12
12
13
+ using ncrypto::Cipher;
14
+ using ncrypto::CipherCtxPointer;
15
+ using ncrypto::EVPKeyCtxPointer;
16
+ using ncrypto::EVPKeyPointer;
17
+ using ncrypto::MarkPopErrorOnReturn;
18
+ using ncrypto::SSLCtxPointer;
19
+ using ncrypto::SSLPointer;
13
20
using v8::Array;
14
21
using v8::ArrayBuffer;
15
22
using v8::BackingStore;
@@ -42,10 +49,10 @@ void GetCipherInfo(const FunctionCallbackInfo<Value>& args) {
42
49
const auto cipher = ([&] {
43
50
if (args[1 ]->IsString ()) {
44
51
Utf8Value name (env->isolate (), args[1 ]);
45
- return ncrypto:: Cipher::FromName (*name);
52
+ return Cipher::FromName (*name);
46
53
} else {
47
54
int nid = args[1 ].As <Int32>()->Value ();
48
- return ncrypto:: Cipher::FromNid (nid);
55
+ return Cipher::FromNid (nid);
49
56
}
50
57
})();
51
58
@@ -334,7 +341,7 @@ void CipherBase::CommonInit(const char* cipher_type,
334
341
return THROW_ERR_CRYPTO_INVALID_KEYLEN (env ());
335
342
}
336
343
337
- if (!ctx_.init (ncrypto:: Cipher (), encrypt , key, iv)) {
344
+ if (!ctx_.init (Cipher (), encrypt , key, iv)) {
338
345
return ThrowCryptoError (env (), ERR_get_error (),
339
346
" Failed to initialize cipher" );
340
347
}
@@ -345,7 +352,7 @@ void CipherBase::Init(const char* cipher_type,
345
352
unsigned int auth_tag_len) {
346
353
HandleScope scope (env ()->isolate ());
347
354
MarkPopErrorOnReturn mark_pop_error_on_return;
348
- auto cipher = ncrypto:: Cipher::FromName (cipher_type);
355
+ auto cipher = Cipher::FromName (cipher_type);
349
356
if (!cipher) {
350
357
return THROW_ERR_CRYPTO_UNKNOWN_CIPHER (env ());
351
358
}
@@ -415,7 +422,7 @@ void CipherBase::InitIv(const char* cipher_type,
415
422
HandleScope scope (env ()->isolate ());
416
423
MarkPopErrorOnReturn mark_pop_error_on_return;
417
424
418
- auto cipher = ncrypto:: Cipher::FromName (cipher_type);
425
+ auto cipher = Cipher::FromName (cipher_type);
419
426
if (!cipher) return THROW_ERR_CRYPTO_UNKNOWN_CIPHER (env ());
420
427
421
428
const int expected_iv_len = cipher.getIvLength ();
@@ -628,8 +635,7 @@ void CipherBase::SetAuthTag(const FunctionCallbackInfo<Value>& args) {
628
635
} else {
629
636
// At this point, the tag length is already known and must match the
630
637
// length of the given authentication tag.
631
- CHECK (
632
- ncrypto::Cipher::FromCtx (cipher->ctx_ ).isSupportedAuthenticatedMode ());
638
+ CHECK (Cipher::FromCtx (cipher->ctx_ ).isSupportedAuthenticatedMode ());
633
639
CHECK_NE (cipher->auth_tag_len_ , kNoAuthTagLength );
634
640
is_valid = cipher->auth_tag_len_ == tag_len;
635
641
}
@@ -855,7 +861,7 @@ bool CipherBase::Final(std::unique_ptr<BackingStore>* out) {
855
861
}
856
862
857
863
if (kind_ == kDecipher &&
858
- ncrypto:: Cipher::FromCtx (ctx_).isSupportedAuthenticatedMode ()) {
864
+ Cipher::FromCtx (ctx_).isSupportedAuthenticatedMode ()) {
859
865
MaybePassAuthTagToOpenSSL ();
860
866
}
861
867
0 commit comments