diff options
author | Tobias Nießen <tniessen@tnie.de> | 2020-02-20 03:16:14 +0300 |
---|---|---|
committer | Shelley Vohr <shelley.vohr@gmail.com> | 2020-02-27 20:45:35 +0300 |
commit | d0e94fc77eed49ea1b8522de2193e947d80cc40c (patch) | |
tree | ac0a993bb631824593cbc0d52dce34239441a263 /src/node_crypto.cc | |
parent | 61a0d8b6cdc2e7f8b0ead46757a38757e60d49a5 (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); |