GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/crypto/crypto_hkdf.h Lines: 2 4 50.0 %
Date: 2021-04-21 04:11:54 Branches: 0 0 - %

Line Branch Exec Source
1
#ifndef SRC_CRYPTO_CRYPTO_HKDF_H_
2
#define SRC_CRYPTO_CRYPTO_HKDF_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include "crypto/crypto_keys.h"
7
#include "crypto/crypto_util.h"
8
#include "allocated_buffer.h"
9
#include "async_wrap.h"
10
#include "base_object.h"
11
#include "v8.h"
12
13
namespace node {
14
namespace crypto {
15
static constexpr size_t kMaxDigestMultiplier = 255;
16
17
1030
struct HKDFConfig final : public MemoryRetainer {
18
  CryptoJobMode mode;
19
  size_t length;
20
  const EVP_MD* digest;
21
  std::shared_ptr<KeyObjectData> key;
22
  ByteSource salt;
23
  ByteSource info;
24
25
517
  HKDFConfig() = default;
26
27
  explicit HKDFConfig(HKDFConfig&& other) noexcept;
28
29
  HKDFConfig& operator=(HKDFConfig&& other) noexcept;
30
31
  void MemoryInfo(MemoryTracker* tracker) const override;
32
  SET_MEMORY_INFO_NAME(HKDFConfig);
33
  SET_SELF_SIZE(HKDFConfig);
34
};
35
36
struct HKDFTraits final {
37
  using AdditionalParameters = HKDFConfig;
38
  static constexpr const char* JobName = "HKDFJob";
39
  static constexpr AsyncWrap::ProviderType Provider =
40
      AsyncWrap::PROVIDER_DERIVEBITSREQUEST;
41
42
  static v8::Maybe<bool> AdditionalConfig(
43
      CryptoJobMode mode,
44
      const v8::FunctionCallbackInfo<v8::Value>& args,
45
      unsigned int offset,
46
      HKDFConfig* params);
47
48
  static bool DeriveBits(
49
      Environment* env,
50
      const HKDFConfig& params,
51
      ByteSource* out);
52
53
  static v8::Maybe<bool> EncodeOutput(
54
      Environment* env,
55
      const HKDFConfig& params,
56
      ByteSource* out,
57
      v8::Local<v8::Value>* result);
58
};
59
60
using HKDFJob = DeriveBitsJob<HKDFTraits>;
61
62
}  // namespace crypto
63
}  // namespace node
64
65
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
66
#endif  // SRC_CRYPTO_CRYPTO_HKDF_H_