Skip to content

Commit 86eb461

Browse files
committed
Merge pull request #5839
16a58a8 keys: remove libsecp256k1 verification until it's actually supported (Cory Fields)
2 parents 10a3ff0 + 16a58a8 commit 86eb461

File tree

4 files changed

+0
-39
lines changed

4 files changed

+0
-39
lines changed

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
849849
AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])
850850
AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno])
851851
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
852-
AM_CONDITIONAL([USE_LIBSECP256K1],[test x$use_libsecp256k1 = xyes])
853852

854853
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
855854
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])

src/Makefile.am

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,6 @@ libbitcoinconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS)
379379
libbitcoinconsensus_la_LIBADD = $(CRYPTO_LIBS)
380380
libbitcoinconsensus_la_CPPFLAGS = $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
381381

382-
if USE_LIBSECP256K1
383-
libbitcoinconsensus_la_LIBADD += secp256k1/libsecp256k1.la
384-
endif
385382
endif
386383
#
387384

src/key.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,9 @@ void CExtKey::Decode(const unsigned char code[74]) {
208208
}
209209

210210
bool ECC_InitSanityCheck() {
211-
#if !defined(USE_SECP256K1)
212211
if (!CECKey::SanityCheck()) {
213212
return false;
214213
}
215-
#endif
216214
CKey key;
217215
key.MakeNewKey(true);
218216
CPubKey pubkey = key.GetPubKey();

src/pubkey.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,16 @@
66

77
#include "eccryptoverify.h"
88

9-
#ifdef USE_SECP256K1
10-
#include <secp256k1.h>
11-
#else
129
#include "ecwrapper.h"
13-
#endif
1410

1511
bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) const {
1612
if (!IsValid())
1713
return false;
18-
#ifdef USE_SECP256K1
19-
if (secp256k1_ecdsa_verify((const unsigned char*)&hash, &vchSig[0], vchSig.size(), begin(), size()) != 1)
20-
return false;
21-
#else
2214
CECKey key;
2315
if (!key.SetPubKey(begin(), size()))
2416
return false;
2517
if (!key.Verify(hash, vchSig))
2618
return false;
27-
#endif
2819
return true;
2920
}
3021

@@ -33,52 +24,33 @@ bool CPubKey::RecoverCompact(const uint256 &hash, const std::vector<unsigned cha
3324
return false;
3425
int recid = (vchSig[0] - 27) & 3;
3526
bool fComp = ((vchSig[0] - 27) & 4) != 0;
36-
#ifdef USE_SECP256K1
37-
int pubkeylen = 65;
38-
if (!secp256k1_ecdsa_recover_compact((const unsigned char*)&hash, &vchSig[1], (unsigned char*)begin(), &pubkeylen, fComp, recid))
39-
return false;
40-
assert((int)size() == pubkeylen);
41-
#else
4227
CECKey key;
4328
if (!key.Recover(hash, &vchSig[1], recid))
4429
return false;
4530
std::vector<unsigned char> pubkey;
4631
key.GetPubKey(pubkey, fComp);
4732
Set(pubkey.begin(), pubkey.end());
48-
#endif
4933
return true;
5034
}
5135

5236
bool CPubKey::IsFullyValid() const {
5337
if (!IsValid())
5438
return false;
55-
#ifdef USE_SECP256K1
56-
if (!secp256k1_ecdsa_pubkey_verify(begin(), size()))
57-
return false;
58-
#else
5939
CECKey key;
6040
if (!key.SetPubKey(begin(), size()))
6141
return false;
62-
#endif
6342
return true;
6443
}
6544

6645
bool CPubKey::Decompress() {
6746
if (!IsValid())
6847
return false;
69-
#ifdef USE_SECP256K1
70-
int clen = size();
71-
int ret = secp256k1_ecdsa_pubkey_decompress((unsigned char*)begin(), &clen);
72-
assert(ret);
73-
assert(clen == (int)size());
74-
#else
7548
CECKey key;
7649
if (!key.SetPubKey(begin(), size()))
7750
return false;
7851
std::vector<unsigned char> pubkey;
7952
key.GetPubKey(pubkey, false);
8053
Set(pubkey.begin(), pubkey.end());
81-
#endif
8254
return true;
8355
}
8456

@@ -89,17 +61,12 @@ bool CPubKey::Derive(CPubKey& pubkeyChild, unsigned char ccChild[32], unsigned i
8961
unsigned char out[64];
9062
BIP32Hash(cc, nChild, *begin(), begin()+1, out);
9163
memcpy(ccChild, out+32, 32);
92-
#ifdef USE_SECP256K1
93-
pubkeyChild = *this;
94-
bool ret = secp256k1_ecdsa_pubkey_tweak_add((unsigned char*)pubkeyChild.begin(), pubkeyChild.size(), out);
95-
#else
9664
CECKey key;
9765
bool ret = key.SetPubKey(begin(), size());
9866
ret &= key.TweakPublic(out);
9967
std::vector<unsigned char> pubkey;
10068
key.GetPubKey(pubkey, true);
10169
pubkeyChild.Set(pubkey.begin(), pubkey.end());
102-
#endif
10370
return ret;
10471
}
10572

0 commit comments

Comments
 (0)