From f4e0aefadcc9f37611a6d5a13e3f7b4b9a37bf76 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 5 Nov 2014 10:53:59 -0800 Subject: Do signature-s negation inside the tests To avoid the need for libsecp256k1 to expose such functionality. --- src/ecwrapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ecwrapper.cpp') diff --git a/src/ecwrapper.cpp b/src/ecwrapper.cpp index ebaa350264..3377dce0c1 100644 --- a/src/ecwrapper.cpp +++ b/src/ecwrapper.cpp @@ -193,7 +193,7 @@ bool CECKey::SetPubKey(const unsigned char* pubkey, size_t size) { return o2i_ECPublicKey(&pkey, &pubkey, size) != NULL; } -bool CECKey::Sign(const uint256 &hash, std::vector& vchSig, bool lowS) { +bool CECKey::Sign(const uint256 &hash, std::vector& vchSig) { vchSig.clear(); ECDSA_SIG *sig = ECDSA_do_sign((unsigned char*)&hash, sizeof(hash), pkey); if (sig == NULL) @@ -205,7 +205,7 @@ bool CECKey::Sign(const uint256 &hash, std::vector& vchSig, bool BIGNUM *halforder = BN_CTX_get(ctx); EC_GROUP_get_order(group, order, ctx); BN_rshift1(halforder, order); - if (lowS && BN_cmp(sig->s, halforder) > 0) { + if (BN_cmp(sig->s, halforder) > 0) { // enforce low S values, by negating the value (modulo the order) if above order/2. BN_sub(sig->s, order, sig->s); } -- cgit v1.2.3