diff options
author | Tobias Nießen <tniessen@tnie.de> | 2020-02-20 03:16:14 +0300 |
---|---|---|
committer | Tobias Nießen <tniessen@tnie.de> | 2020-02-23 05:09:55 +0300 |
commit | 0e63a079e8f535e1d4f0398400c534b0b5772fa5 (patch) | |
tree | ad678b85b302ff40152cd01e1dc2e22e05447301 /src/node_crypto.cc | |
parent | 21bd6679ce150e193cacd4b1b6585928224f255a (diff) |
crypto: fix ieee-p1363 for createVerify
Fixes: https://github.com/nodejs/node/issues/31866
PR-URL: https://github.com/nodejs/node/pull/31876
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_crypto.cc')
-rw-r--r-- | src/node_crypto.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 2176fffc543..d47cc4e1e82 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5323,8 +5323,7 @@ void Verify::VerifyUpdate(const FunctionCallbackInfo<Value>& args) { SignBase::Error Verify::VerifyFinal(const ManagedEVPPKey& pkey, - const char* sig, - int siglen, + const ByteSource& sig, int padding, const Maybe<int>& saltlen, bool* verify_result) { @@ -5345,11 +5344,8 @@ SignBase::Error Verify::VerifyFinal(const ManagedEVPPKey& pkey, ApplyRSAOptions(pkey, pkctx.get(), padding, saltlen) && EVP_PKEY_CTX_set_signature_md(pkctx.get(), EVP_MD_CTX_md(mdctx.get())) > 0) { - const int r = EVP_PKEY_verify(pkctx.get(), - reinterpret_cast<const unsigned char*>(sig), - siglen, - m, - m_len); + const unsigned char* s = reinterpret_cast<const unsigned char*>(sig.get()); + const int r = EVP_PKEY_verify(pkctx.get(), s, sig.size(), m, m_len); *verify_result = r == 1; } @@ -5394,7 +5390,7 @@ void Verify::VerifyFinal(const FunctionCallbackInfo<Value>& args) { } bool verify_result; - Error err = verify->VerifyFinal(pkey, hbuf.data(), hbuf.length(), padding, + Error err = verify->VerifyFinal(pkey, signature, padding, salt_len, &verify_result); if (err != kSignOk) return verify->CheckThrow(err); |