|
|
@ -1,7 +1,8 @@ |
|
|
|
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
|
|
|
// Copyright (c) 2017 The Zcash developers
|
|
|
|
// Copyright (c) 2019-2020 The Hush developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
// file COPYING or https://www.opensource.org/licenses/mit-license.php
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Copyright © 2014-2019 The SuperNET Developers. * |
|
|
@ -41,12 +42,12 @@ bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchS |
|
|
|
if (vchSig.size() == 0) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
/* Zcash, unlike Bitcoin, has always enforced strict DER signatures. */ |
|
|
|
/* Hush, unlike Bitcoin, has always enforced strict DER signatures. */ |
|
|
|
if (!secp256k1_ecdsa_signature_parse_der(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
/* libsecp256k1's ECDSA verification requires lower-S signatures, which have
|
|
|
|
* not historically been enforced in Bitcoin or Zcash, so normalize them first. */ |
|
|
|
* not historically been enforced in Bitcoin or Hush, so normalize them first. */ |
|
|
|
secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, &sig, &sig); |
|
|
|
return secp256k1_ecdsa_verify(secp256k1_context_verify, &sig, hash.begin(), &pubkey); |
|
|
|
} |
|
|
@ -142,7 +143,7 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int nChild) const { |
|
|
|
/* static */ bool CPubKey::CheckLowS(const std::vector<unsigned char>& vchSig) { |
|
|
|
secp256k1_ecdsa_signature sig; |
|
|
|
|
|
|
|
/* Zcash, unlike Bitcoin, has always enforced strict DER signatures. */ |
|
|
|
/* Hush, unlike Bitcoin, has always enforced strict DER signatures. */ |
|
|
|
if (!secp256k1_ecdsa_signature_parse_der(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) { |
|
|
|
return false; |
|
|
|
} |
|
|
|