Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2018-10-11 20:56:49 +0300
committerTobias Nießen <tniessen@tnie.de>2018-10-20 01:38:21 +0300
commit7bd2912669c8975523b6d77269d29207d3ea9769 (patch)
tree8b81ecb4ac1b4e6d40959c3386d7390d8023c2dc /src/node_crypto.h
parente5accf546c30a813e268ca299c1dc8eed0adeb80 (diff)
crypto: reduce memory usage of SignFinal
The fixed-size buffer on the stack is unnecessary and way too large for most applications. This change removes it and allocates the required memory directly instead of copying into heap later. PR-URL: https://github.com/nodejs/node/pull/23427 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'src/node_crypto.h')
-rw-r--r--src/node_crypto.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/node_crypto.h b/src/node_crypto.h
index f4afd2fdaf5..9603fcf3b2e 100644
--- a/src/node_crypto.h
+++ b/src/node_crypto.h
@@ -518,13 +518,12 @@ class Sign : public SignBase {
public:
static void Initialize(Environment* env, v8::Local<v8::Object> target);
- Error SignFinal(const char* key_pem,
- int key_pem_len,
- const char* passphrase,
- unsigned char* sig,
- unsigned int* sig_len,
- int padding,
- int saltlen);
+ std::pair<Error, MallocedBuffer<unsigned char>> SignFinal(
+ const char* key_pem,
+ int key_pem_len,
+ const char* passphrase,
+ int padding,
+ int saltlen);
protected:
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);