File tree Expand file tree Collapse file tree 4 files changed +0
-50
lines changed Expand file tree Collapse file tree 4 files changed +0
-50
lines changed Original file line number Diff line number Diff line change @@ -166,12 +166,6 @@ void CKey::MakeNewKey(bool fCompressedIn) {
166
166
fCompressed = fCompressedIn ;
167
167
}
168
168
169
- bool CKey::Negate ()
170
- {
171
- assert (keydata);
172
- return secp256k1_ec_seckey_negate (secp256k1_context_sign, keydata->data ());
173
- }
174
-
175
169
CPrivKey CKey::GetPrivKey () const {
176
170
assert (keydata);
177
171
CPrivKey seckey;
Original file line number Diff line number Diff line change @@ -124,9 +124,6 @@ class CKey
124
124
// ! Generate a new private key using a cryptographic PRNG.
125
125
void MakeNewKey (bool fCompressed );
126
126
127
- // ! Negate private key
128
- bool Negate ();
129
-
130
127
/* *
131
128
* Convert the private key to a CPrivKey (serialized OpenSSL private key data).
132
129
* This is expensive.
Original file line number Diff line number Diff line change @@ -78,16 +78,6 @@ FUZZ_TARGET(key, .init = initialize_key)
78
78
assert (copied_key == key);
79
79
}
80
80
81
- {
82
- CKey negated_key = key;
83
- negated_key.Negate ();
84
- assert (negated_key.IsValid ());
85
- assert (!(negated_key == key));
86
-
87
- negated_key.Negate ();
88
- assert (negated_key == key);
89
- }
90
-
91
81
const uint256 random_uint256 = Hash (buffer);
92
82
93
83
{
Original file line number Diff line number Diff line change @@ -201,37 +201,6 @@ BOOST_AUTO_TEST_CASE(key_signature_tests)
201
201
BOOST_CHECK (found_small);
202
202
}
203
203
204
- BOOST_AUTO_TEST_CASE (key_key_negation)
205
- {
206
- // create a dummy hash for signature comparison
207
- unsigned char rnd[8 ];
208
- std::string str = " Bitcoin key verification\n " ;
209
- GetRandBytes (rnd);
210
- uint256 hash{Hash (str, rnd)};
211
-
212
- // import the static test key
213
- CKey key = DecodeSecret (strSecret1C);
214
-
215
- // create a signature
216
- std::vector<unsigned char > vch_sig;
217
- std::vector<unsigned char > vch_sig_cmp;
218
- key.Sign (hash, vch_sig);
219
-
220
- // negate the key twice
221
- BOOST_CHECK (key.GetPubKey ().data ()[0 ] == 0x03 );
222
- key.Negate ();
223
- // after the first negation, the signature must be different
224
- key.Sign (hash, vch_sig_cmp);
225
- BOOST_CHECK (vch_sig_cmp != vch_sig);
226
- BOOST_CHECK (key.GetPubKey ().data ()[0 ] == 0x02 );
227
- key.Negate ();
228
- // after the second negation, we should have the original key and thus the
229
- // same signature
230
- key.Sign (hash, vch_sig_cmp);
231
- BOOST_CHECK (vch_sig_cmp == vch_sig);
232
- BOOST_CHECK (key.GetPubKey ().data ()[0 ] == 0x03 );
233
- }
234
-
235
204
static CPubKey UnserializePubkey (const std::vector<uint8_t >& data)
236
205
{
237
206
DataStream stream{};
You can’t perform that action at this time.
0 commit comments