summaryrefslogtreecommitdiff
path: root/src/node_crypto.h
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2017-07-10 12:56:37 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2017-07-17 23:09:14 +0200
commitff2c57d9654cbe277a3827d1c02e8d2fd69bc29a (patch)
tree38ebe094717c2df5fbc4651a395709e30c9b4707 /src/node_crypto.h
parentee99bfdc6592e89860a4fe9d2c3105a771963a39 (diff)
downloadandroid-node-v8-ff2c57d9654cbe277a3827d1c02e8d2fd69bc29a.tar.gz
android-node-v8-ff2c57d9654cbe277a3827d1c02e8d2fd69bc29a.tar.bz2
android-node-v8-ff2c57d9654cbe277a3827d1c02e8d2fd69bc29a.zip
src: avoid heap allocation in sign.final()
Put the 8 kB initial buffer on the stack first and don't copy it to the heap until its exact size is known (which is normally much smaller.) PR-URL: https://github.com/nodejs/node/pull/14122 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_crypto.h')
-rw-r--r--src/node_crypto.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_crypto.h b/src/node_crypto.h
index 33c9cf783e..c1ba349d2d 100644
--- a/src/node_crypto.h
+++ b/src/node_crypto.h
@@ -587,7 +587,7 @@ class Sign : public SignBase {
Error SignFinal(const char* key_pem,
int key_pem_len,
const char* passphrase,
- unsigned char** sig,
+ unsigned char* sig,
unsigned int *sig_len,
int padding,
int saltlen);