GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/node_crypto.cc Lines: 30 30 100.0 %
Date: 2021-04-09 04:13:47 Branches: 9 12 75.0 %

Line Branch Exec Source
1
// Copyright Joyent, Inc. and other Node contributors.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a
4
// copy of this software and associated documentation files (the
5
// "Software"), to deal in the Software without restriction, including
6
// without limitation the rights to use, copy, modify, merge, publish,
7
// distribute, sublicense, and/or sell copies of the Software, and to permit
8
// persons to whom the Software is furnished to do so, subject to the
9
// following conditions:
10
//
11
// The above copyright notice and this permission notice shall be included
12
// in all copies or substantial portions of the Software.
13
//
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22
#include "node_crypto.h"
23
#include "async_wrap-inl.h"
24
#include "debug_utils-inl.h"
25
#include "threadpoolwork-inl.h"
26
#include "memory_tracker-inl.h"
27
#include "v8.h"
28
29
namespace node {
30
31
using v8::Context;
32
using v8::Local;
33
using v8::Object;
34
using v8::TryCatch;
35
using v8::Value;
36
37
namespace crypto {
38
39
4095
void Initialize(Local<Object> target,
40
                Local<Value> unused,
41
                Local<Context> context,
42
                void* priv) {
43
4095
  Environment* env = Environment::GetCurrent(context);
44
45
  static uv_once_t init_once = UV_ONCE_INIT;
46
8179
  TryCatch try_catch{env->isolate()};
47
4095
  uv_once(&init_once, InitCryptoOnce);
48

4095
  if (try_catch.HasCaught() && !try_catch.HasTerminated()) {
49
11
    try_catch.ReThrow();
50
11
    return;
51
  }
52
53
4084
  AES::Initialize(env, target);
54
4084
  CipherBase::Initialize(env, target);
55
4084
  DiffieHellman::Initialize(env, target);
56
4084
  DSAAlg::Initialize(env, target);
57
4084
  ECDH::Initialize(env, target);
58
4084
  Hash::Initialize(env, target);
59
4084
  HKDFJob::Initialize(env, target);
60
4084
  Hmac::Initialize(env, target);
61
4084
  Keygen::Initialize(env, target);
62
4084
  Keys::Initialize(env, target);
63
4084
  NativeKeyObject::Initialize(env, target);
64
4084
  PBKDF2Job::Initialize(env, target);
65
4084
  Random::Initialize(env, target);
66
4084
  RSAAlg::Initialize(env, target);
67
4084
  SecureContext::Initialize(env, target);
68
4084
  Sign::Initialize(env, target);
69
4084
  SPKAC::Initialize(env, target);
70
4084
  Timing::Initialize(env, target);
71
4084
  Util::Initialize(env, target);
72
4084
  Verify::Initialize(env, target);
73
4084
  X509Certificate::Initialize(env, target);
74
75
#ifndef OPENSSL_NO_SCRYPT
76
4084
  ScryptJob::Initialize(env, target);
77
#endif
78
}
79
80
}  // namespace crypto
81
}  // namespace node
82
83

19020
NODE_MODULE_CONTEXT_AWARE_INTERNAL(crypto, node::crypto::Initialize)