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) {
166166 fCompressed = fCompressedIn ;
167167}
168168
169- bool CKey::Negate ()
170- {
171- assert (keydata);
172- return secp256k1_ec_seckey_negate (secp256k1_context_sign, keydata->data ());
173- }
174-
175169CPrivKey CKey::GetPrivKey () const {
176170 assert (keydata);
177171 CPrivKey seckey;
Original file line number Diff line number Diff line change @@ -124,9 +124,6 @@ class CKey
124124 // ! Generate a new private key using a cryptographic PRNG.
125125 void MakeNewKey (bool fCompressed );
126126
127- // ! Negate private key
128- bool Negate ();
129-
130127 /* *
131128 * Convert the private key to a CPrivKey (serialized OpenSSL private key data).
132129 * This is expensive.
Original file line number Diff line number Diff line change @@ -78,16 +78,6 @@ FUZZ_TARGET(key, .init = initialize_key)
7878 assert (copied_key == key);
7979 }
8080
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-
9181 const uint256 random_uint256 = Hash (buffer);
9282
9383 {
Original file line number Diff line number Diff line change @@ -201,37 +201,6 @@ BOOST_AUTO_TEST_CASE(key_signature_tests)
201201 BOOST_CHECK (found_small);
202202}
203203
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-
235204static CPubKey UnserializePubkey (const std::vector<uint8_t >& data)
236205{
237206 DataStream stream{};
You can’t perform that action at this time.
0 commit comments