From 4ff9e88b2986e723d385d5f86793d913f3871db6 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Wed, 10 Mar 2021 18:12:27 +0530 Subject: [PATCH] define Insert in crypto_util.h itself --- src/crypto/crypto_util.cc | 27 --------------------------- src/crypto/crypto_util.h | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc index 84dfc66783b8fa..31f5d4a91d3c83 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc @@ -201,33 +201,6 @@ bool CryptoErrorStore::Empty() const { return errors_.empty(); } -template -void CryptoErrorStore::Insert(const NodeCryptoError error, Args&&... args) { - const char* error_string; - switch (error) { - case NodeCryptoError::CIPHER_JOB_FAILED: - error_string = "Cipher job failed"; - break; - case NodeCryptoError::DERIVING_BITS_FAILED: - error_string = "Deriving bits failed"; - break; - case NodeCryptoError::ENGINE_NOT_FOUND: - error_string = "Engine \"%s\" was not found"; - break; - case NodeCryptoError::INVALID_KEY_TYPE: - error_string = "Invalid key type"; - break; - case NodeCryptoError::KEY_GENERATION_JOB_FAILED: - error_string = "Key generation failed"; - break; - case NodeCryptoError::NO_ERROR: - error_string = "No error"; - break; - } - errors.emplace_back(SPrintF(error_string, - std::forward(args)...)); -} - MaybeLocal CryptoErrorStore::ToException( Environment* env, Local exception_string) const { diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h index 74ecc191dcd8be..0d8e534b5cb2d6 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h @@ -186,6 +186,33 @@ struct CryptoErrorStore { std::vector errors_; }; +template +void CryptoErrorStore::Insert(const NodeCryptoError error, Args&&... args) { + const char* error_string; + switch (error) { + case NodeCryptoError::CIPHER_JOB_FAILED: + error_string = "Cipher job failed"; + break; + case NodeCryptoError::DERIVING_BITS_FAILED: + error_string = "Deriving bits failed"; + break; + case NodeCryptoError::ENGINE_NOT_FOUND: + error_string = "Engine \"%s\" was not found"; + break; + case NodeCryptoError::INVALID_KEY_TYPE: + error_string = "Invalid key type"; + break; + case NodeCryptoError::KEY_GENERATION_JOB_FAILED: + error_string = "Key generation failed"; + break; + case NodeCryptoError::NO_ERROR: + error_string = "No error"; + break; + } + errors_.emplace_back(SPrintF(error_string, + std::forward(args)...)); +} + template T* MallocOpenSSL(size_t count) { void* mem = OPENSSL_malloc(MultiplyWithOverflowCheck(count, sizeof(T)));