aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-07-28 20:11:20 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2015-11-15 16:06:57 +0100
commit6e182686163ce3c15b878bd78c41d8d18db344f1 (patch)
treed4e0997b1459def528557d640a480937ffc207fd /src/script
parentb632145edeb376b4d1597f192ca00634f7d2866c (diff)
Switch to libsecp256k1-based validation for ECDSA
Diffstat (limited to 'src/script')
-rw-r--r--src/script/bitcoinconsensus.cpp9
-rw-r--r--src/script/interpreter.cpp13
2 files changed, 10 insertions, 12 deletions
diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp
index b0d5faaf77..79504f6ad3 100644
--- a/src/script/bitcoinconsensus.cpp
+++ b/src/script/bitcoinconsensus.cpp
@@ -6,6 +6,7 @@
#include "bitcoinconsensus.h"
#include "primitives/transaction.h"
+#include "pubkey.h"
#include "script/interpreter.h"
#include "version.h"
@@ -60,7 +61,13 @@ inline int set_error(bitcoinconsensus_error* ret, bitcoinconsensus_error serror)
return 0;
}
-} // anon namespace
+struct ECCryptoClosure
+{
+ ECCVerifyHandle handle;
+};
+
+ECCryptoClosure instance_of_eccryptoclosure;
+}
int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
const unsigned char *txTo , unsigned int txToLen,
diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
index 6a20d497c0..8dcab832cb 100644
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -9,7 +9,6 @@
#include "crypto/ripemd160.h"
#include "crypto/sha1.h"
#include "crypto/sha256.h"
-#include "eccryptoverify.h"
#include "pubkey.h"
#include "script/script.h"
#include "uint256.h"
@@ -165,16 +164,8 @@ bool static IsLowDERSignature(const valtype &vchSig, ScriptError* serror) {
if (!IsValidSignatureEncoding(vchSig)) {
return set_error(serror, SCRIPT_ERR_SIG_DER);
}
- unsigned int nLenR = vchSig[3];
- unsigned int nLenS = vchSig[5+nLenR];
- const unsigned char *S = &vchSig[6+nLenR];
- // If the S value is above the order of the curve divided by two, its
- // complement modulo the order could have been used instead, which is
- // one byte shorter when encoded correctly.
- if (!eccrypto::CheckSignatureElement(S, nLenS, true))
- return set_error(serror, SCRIPT_ERR_SIG_HIGH_S);
-
- return true;
+ std::vector<unsigned char> vchSigCopy(vchSig.begin(), vchSig.begin() + vchSig.size() - 1);
+ return CPubKey::CheckLowS(vchSigCopy);
}
bool static IsDefinedHashtypeSignature(const valtype &vchSig) {