aboutsummaryrefslogtreecommitdiff
path: root/src/key.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Sanitize assert usage and refuse to compile with NDEBUG.Gregory Maxwell2013-12-021-2/+5
| | | | | | | | There were quite a few places where assert() was used with side effects, making operation with NDEBUG non-functional. This commit fixes all the cases I know about, but also adds an #error on NDEBUG because the code is untested without assertions and may still have vulnerabilities if used without assert.
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-4/+3
| | | | | | | | | Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
* Merge pull request #3119Pieter Wuille2013-10-201-1/+1
|\ | | | | | | db0e8cc Bump Year Number to 2013 (super3)
| * Bump Year Number to 2013super32013-10-201-1/+1
| |
* | Merge pull request #2950 from pstratem/walletloadGavin Andresen2013-10-161-1/+22
|\ \ | |/ |/| Walletload
| * verify vchPubKey matches calculated public key unless fSkipCheck is setpatrick s2013-08-291-0/+6
| |
| * improve wallet load time by removing duplicated calls to EC_KEY_check_key ↵patrick s2013-08-281-1/+16
| | | | | | | | | | | | and adding a hash for vchPubKey/vchPrivKey entries in wallet.dat backwards compatible with previous wallet.dat format
* | Use 'low S' as malleability breaker rather than 'even S'Pieter Wuille2013-09-201-9/+11
|/
* Merge pull request #2131 from sipa/evensGregory Maxwell2013-08-151-1/+18
|\ | | | | Only create signatures with even S, and verification mode to check.
| * Only create signatures with even S, and verification mode to check.Pieter Wuille2013-08-161-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To fix a minor malleability found by Sergio Lerner (reported here: https://bitcointalk.org/index.php?topic=8392.msg1245898#msg1245898) The problem is that if (R,S) is a valid ECDSA signature for a given message and public key, (R,-S) is also valid. Modulo N (the order of the secp256k1 curve), this means that both (R,S) and (R,N-S) are valid. Given that N is odd, S and N-S have a different lowest bit. We solve the problem by forcing signatures to have an even S value, excluding one of the alternatives. This commit just changes the signing code to always produce even S values, and adds a verification mode to check it. This code is not enabled anywhere yet. Existing tests in key_tests.cpp verify that the produced signatures are still valid.
* | Merge pull request #2829 from sipa/bip32Gavin Andresen2013-08-151-0/+180
|\ \ | |/ |/| BIP 32 derivation + test vectors
| * BIP32 derivation implementationPieter Wuille2013-07-151-0/+180
| |
* | Fix minor backward incompatibilityPieter Wuille2013-07-131-2/+3
|/ | | | | | | | | The key refactor changed the way unencrypted private keys with compressed public key are stored in the wallet. Apparently older versions relied on this to verify the correctness of stored keys. Note that earlier pre-release versions do risk creating wallets that can not be opened by 0.8.3 and earlier.
* CSecret/CKey -> CKey/CPubKey split/refactorPieter Wuille2013-05-301-242/+225
|
* Make CPubKey statically allocatedPieter Wuille2013-05-301-6/+8
|
* Fix memory leak on exception in Key::SignCompactDaniel Larimer2013-05-191-0/+3
|
* fix memory leak in CKey::SetCompactSignature()Daniel Larimer2013-05-191-0/+1
|
* Compact serialization for scriptsPieter Wuille2012-10-201-2/+2
| | | | | | | | | | | Special serializers for script which detect common cases and encode them much more efficiently. 3 special cases are defined: * Pay to pubkey hash (encoded as 21 bytes) * Pay to script hash (encoded as 21 bytes) * Pay to pubkey starting with 0x02, 0x03 or 0x04 (encoded as 33 bytes) Other scripts up to 121 bytes require 1 byte + script length. Above that, scripts up to 16505 bytes require 2 bytes + script length.
* Handle corrupt wallets gracefully.Gavin Andresen2012-10-081-10/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Corrupt wallets used to cause a DB_RUNRECOVERY uncaught exception and a crash. This commit does three things: 1) Runs a BDB verify early in the startup process, and if there is a low-level problem with the database: + Moves the bad wallet.dat to wallet.timestamp.bak + Runs a 'salvage' operation to get key/value pairs, and writes them to a new wallet.dat + Continues with startup. 2) Much more tolerant of serialization errors. All errors in deserialization are reported by tolerated EXCEPT for errors related to reading keypairs or master key records-- those are reported and then shut down, so the user can get help (or recover from a backup). 3) Adds a new -salvagewallet option, which: + Moves the wallet.dat to wallet.timestamp.bak + extracts ONLY keypairs and master keys into a new wallet.dat + soft-sets -rescan, to recreate transaction history This was tested by randomly corrupting testnet wallets using a little python script I wrote (https://gist.github.com/3812689)
* Bugfix: Fix a variety of misspellingsLuke Dashjr2012-08-011-1/+1
|
* fix a memory leak in key.cppPhilip Kaufmann2012-06-211-0/+3
| | | | | - add EC_KEY_free() in CKey::Reset() when pkey != NULL - init pkey with NULL in CKey constructor
* Encapsulate public keys in CPubKeyPieter Wuille2012-05-241-6/+6
|
* Move signature cache from CKey::Verify to CheckSig in script.cppGavin Andresen2012-05-221-65/+0
| | | | | | | | | | | More than doubles the speed of verifying already-cached signatures that use compressed pubkeys: Before: ~200 microseconds After: ~80 microseconds (no caching at all: ~3,300 microseconds per signature) Also encapsulates the signature cache code in a class and fixes a signed/unsigned comparison warning.
* Merge branch 'optimize'Gavin Andresen2012-05-221-1/+331
|\
| * Cache signature verificationsGavin Andresen2012-05-181-0/+68
| | | | | | | | | | | | | | | | | | Create a maximum-10MB signature verification result cache. This should almost double the number of transactions that can be processed on a given CPU, because before this change ECDSA signatures were verified when transactions were added to the memory pool and then again when they appeared in a block.
| * Refactor: move code from key.h to key.cppGavin Andresen2012-05-171-1/+262
| |
* | Update License in File HeadersFordy2012-05-181-1/+1
|/ | | | | | I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
* Update all copyrights to 2012Gavin Andresen2012-02-071-1/+1
|
* Add GetSecret() and GetKeys() to CKeyStorePieter Wuille2011-12-171-0/+117