crypto: Make Hmac 1.1.0-compatible

OpenSSL 1.1.0 requries HMAC_CTX be heap-allocated.

PR-URL: https://github.com/nodejs/node/pull/16130
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
This commit is contained in:
David Benjamin authored and Rod Vagg committed 2017-11-11 20:42:49 +11:00
1 parent 6bc7480f12
commit f7520ff7fb
2 files changed
+33 -17

No files matched your search

+3 -8
View File
@@ -494,11 +494,7 @@ class CipherBase : public BaseObject {
class Hmac : public BaseObject {
public:
~Hmac() override {
if (!initialised_)
return;
HMAC_CTX_cleanup(&ctx_);
}
~Hmac() override;
static void Initialize(Environment* env, v8::Local<v8::Object> target);
@@ -513,13 +509,12 @@ class Hmac : public BaseObject {
Hmac(Environment* env, v8::Local<v8::Object> wrap)
: BaseObject(env, wrap),
initialised_(false) {
ctx_(nullptr) {
MakeWeak<Hmac>(this);
}
private:
HMAC_CTX ctx_; /* coverity[member_decl] */
bool initialised_;
HMAC_CTX* ctx_;
};
class Hash : public BaseObject {