src: avoid heap allocation in hmac.digest() · nodejs/node@8e51d31 · GitHub
Skip to content

Commit 8e51d31

Browse files
bnoordhuisaddaleax
authored andcommitted
src: avoid heap allocation in hmac.digest()
Add a test that ensures the second call to .digest() returns an empty HMAC, like it did before. No comment on whether that is the right behavior or not. PR-URL: #14122 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 8be9bd1 commit 8e51d31

3 files changed

Lines changed: 40 additions & 18 deletions

File tree

src/node_crypto.cc

Lines changed: 5 additions & 17 deletions

src/node_crypto.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ class Hmac : public BaseObject {
494494
protected:
495495
void HmacInit(const char* hash_type, const char* key, int key_len);
496496
bool HmacUpdate(const char* data, int len);
497-
bool HmacDigest(unsigned char** md_value, unsigned int* md_len);
498497

499498
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
500499
static void HmacInit(const v8::FunctionCallbackInfo<v8::Value>& args);

test/parallel/test-crypto-hmac.js

Lines changed: 35 additions & 0 deletions

0 commit comments

Comments
 (0)