summaryrefslogtreecommitdiff
path: root/src/node_crypto.h
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2017-09-22 19:23:34 -0400
committerRod Vagg <rod@vagg.org>2017-11-11 20:42:49 +1100
commit6bc7480f12b179820f2cb698c5a817a7bff49bc7 (patch)
treecaabdd1894c8ca879d92e377e2f88ab46145efc8 /src/node_crypto.h
parent2b28d6cfacfd0ddd7ff97536152f4ad895bf4120 (diff)
downloadandroid-node-v8-6bc7480f12b179820f2cb698c5a817a7bff49bc7.tar.gz
android-node-v8-6bc7480f12b179820f2cb698c5a817a7bff49bc7.tar.bz2
android-node-v8-6bc7480f12b179820f2cb698c5a817a7bff49bc7.zip
crypto: make SignBase compatible with OpenSSL 1.1.0
1.1.0 requires EVP_MD_CTX be heap-allocated. In doing so, move the Init and Update hooks to shared code because they are the same between Verify and Sign. PR-URL: https://github.com/nodejs/node/pull/16130 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rod Vagg <rod@vagg.org>
Diffstat (limited to 'src/node_crypto.h')
-rw-r--r--src/node_crypto.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/node_crypto.h b/src/node_crypto.h
index 4ec1bb377f..e5eb4037eb 100644
--- a/src/node_crypto.h
+++ b/src/node_crypto.h
@@ -562,28 +562,24 @@ class SignBase : public BaseObject {
SignBase(Environment* env, v8::Local<v8::Object> wrap)
: BaseObject(env, wrap),
- initialised_(false) {
+ mdctx_(nullptr) {
}
- ~SignBase() override {
- if (!initialised_)
- return;
- EVP_MD_CTX_cleanup(&mdctx_);
- }
+ ~SignBase() override;
+
+ Error Init(const char* sign_type);
+ Error Update(const char* data, int len);
protected:
void CheckThrow(Error error);
- EVP_MD_CTX mdctx_; /* coverity[member_decl] */
- bool initialised_;
+ EVP_MD_CTX* mdctx_;
};
class Sign : public SignBase {
public:
static void Initialize(Environment* env, v8::Local<v8::Object> target);
- Error SignInit(const char* sign_type);
- Error SignUpdate(const char* data, int len);
Error SignFinal(const char* key_pem,
int key_pem_len,
const char* passphrase,
@@ -607,8 +603,6 @@ class Verify : public SignBase {
public:
static void Initialize(Environment* env, v8::Local<v8::Object> target);
- Error VerifyInit(const char* verify_type);
- Error VerifyUpdate(const char* data, int len);
Error VerifyFinal(const char* key_pem,
int key_pem_len,
const char* sig,