Commit graph

26 commits

Author SHA1 Message Date
DrahtBot eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
Andrew Chow 41c607f09b Implement PSBT Structures and un/serialization methods per BIP 174 2018-07-13 14:27:31 -07:00
Pieter Wuille c814e2e7e8 Remove template matching and pseudo opcodes
The current code contains a rather complex script template matching engine,
which is only used for 3 particular script types (P2PK, P2PKH, multisig).
The first two of these are trivial to match for otherwise, and a specialized
matcher for multisig is both more compact and more efficient than a generic
one.

The goal is being more flexible, so that for example larger standard multisigs
inside SegWit outputs are more easy to implement.

As a side-effect, it also gets rid of the pseudo opcodes hack.
2018-05-29 14:40:18 -07:00
Ben Woosley f8c249ab91
Assert CPubKey::ValidLength to the pubkey's header-relevent size
Previously this was an inline test where the specificity was probably judged
overly specific. As a class method it makes sense to maintain consistency.

And replace some magic values with their constant equivalents.
2018-02-16 12:30:26 -08:00
Akira Takizawa 595a7bab23 Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
Wladimir J. van der Laan 79399c8cd0
Merge #10657: Utils: Improvements to ECDSA key-handling code
63179d0 Scope the ECDSA constant sizes to CPubKey / CKey classes (Jack Grigg)
1ce9f0a Ensure that ECDSA constant sizes are correctly-sized (Jack Grigg)
48abe78 Remove redundant `= 0` initialisations (Jack Grigg)
17fa391 Specify ECDSA constant sizes as constants (Jack Grigg)
e4a1086 Update Debian copyright list (Jack Grigg)
e181dbe Add comments (Jack Grigg)
a3603ac Fix potential overflows in ECDSA DER parsers (Jack Grigg)

Pull request description:

  Mostly trivial, but includes fixes to potential overflows in the ECDSA DER parsers.

  Cherry-picked from Zcash PR https://github.com/zcash/zcash/pull/2335

Tree-SHA512: 8fcbd51b0bd6723e5d33fa5d592f7cb68ed182796a9b837ecc8217991ad69d6c970258617dc00eb378c8caa4cec5d6b304d9d2c066acd40cda98e4da68e0caa4
2017-12-20 18:00:32 +01:00
MeshCollider 1a445343f6 scripted-diff: Replace #include "" with #include <> (ryanofsky)
-BEGIN VERIFY SCRIPT-
for f in \
  src/*.cpp \
  src/*.h \
  src/bench/*.cpp \
  src/bench/*.h \
  src/compat/*.cpp \
  src/compat/*.h \
  src/consensus/*.cpp \
  src/consensus/*.h \
  src/crypto/*.cpp \
  src/crypto/*.h \
  src/crypto/ctaes/*.h \
  src/policy/*.cpp \
  src/policy/*.h \
  src/primitives/*.cpp \
  src/primitives/*.h \
  src/qt/*.cpp \
  src/qt/*.h \
  src/qt/test/*.cpp \
  src/qt/test/*.h \
  src/rpc/*.cpp \
  src/rpc/*.h \
  src/script/*.cpp \
  src/script/*.h \
  src/support/*.cpp \
  src/support/*.h \
  src/support/allocators/*.h \
  src/test/*.cpp \
  src/test/*.h \
  src/wallet/*.cpp \
  src/wallet/*.h \
  src/wallet/test/*.cpp \
  src/wallet/test/*.h \
  src/zmq/*.cpp \
  src/zmq/*.h
do
  base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f
done
-END VERIFY SCRIPT-
2017-11-16 08:23:01 +13:00
Jack Grigg 63179d0283
Scope the ECDSA constant sizes to CPubKey / CKey classes 2017-10-04 14:41:40 +01:00
practicalswift 64fb0ac016 Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
2017-08-16 16:33:25 +02:00
Jack Grigg 1ce9f0a952
Ensure that ECDSA constant sizes are correctly-sized 2017-07-17 11:57:23 -05:00
Jack Grigg 17fa3913ef
Specify ECDSA constant sizes as constants 2017-07-17 11:57:23 -05:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Pieter Wuille 25a211aa9e Add optimized CSizeComputer serializers
To get the advantages of faster GetSerializeSize() implementations
back that were removed in "Make GetSerializeSize a wrapper on top of
CSizeComputer", reintroduce them in the few places in the form of a
specialized Serialize() implementation. This actually gets us in a
better state than before, as these even get used when they're invoked
indirectly in the serialization of another object.
2016-11-07 13:56:27 -08:00
Pieter Wuille 528472111b Get rid of nType and nVersion
Remove the nType and nVersion as parameters to all serialization methods
and functions. There is only one place where it's read and has an impact
(in CAddress), and even there it does not impact any of the recursively
invoked serializers.

Instead, the few places that need nType or nVersion are changed to read
it directly from the stream object, through GetType() and GetVersion()
methods which are added to all stream classes.
2016-11-07 13:56:27 -08:00
Pieter Wuille 657e05ab2e Make GetSerializeSize a wrapper on top of CSizeComputer
Given that in default GetSerializeSize implementations created by
ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid
of the specialized GetSerializeSize methods everywhere, and just use
CSizeComputer. This removes a lot of code which isn't actually used
anywhere.

For CCompactSize and CVarInt this actually removes a more efficient
size computing algorithm, which is brought back in a later commit.
2016-11-07 13:56:22 -08:00
Pavel Janík 4731cab8fb Do not shadow variables 2016-09-27 09:25:15 +02:00
Thomas Snider fbc60703a5 [trivial] Switched constants to sizeof() 2016-07-18 19:42:09 -07:00
Jonas Schnelli 90604f16af
add bip32 pubkey serialization
CExtPubKey should be serializable like CPubKey
2016-04-14 20:56:33 +02:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Pieter Wuille 6e18268616 Switch to libsecp256k1-based validation for ECDSA 2015-11-15 16:06:57 +01:00
Cory Fields a574899671 chaincodes: abstract away more chaincode behavior
[squashme] replace struct CCainCode with a typedef uint256 ChainCode
2015-05-06 17:22:46 +02:00
Pieter Wuille 8cf1485f3b Abstract chaincodes into CChainCode
# Conflicts:
#	src/key.cpp
#	src/key.h
2015-05-02 11:17:16 +02:00
Wladimir J. van der Laan 4f1524966a Replace direct use of 0 with SetNull and IsNull
Replace x=0 with .SetNull(),
x==0 with IsNull(), x!=0 with !IsNull().
Replace uses of uint256(0) with uint256().
2015-01-05 15:45:34 +01:00
sandakersmann f914f1a746
Added "Core" to copyright headers
Github-Pull: #5494
Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-19 19:55:32 +01:00
Philip Kaufmann b4347f6035 minor code style cleanup after recent merges
- add a missing license header
- correct some header orderings etc.
2014-11-04 14:36:46 +01:00
Cory Fields d2e74c55bd boost: moveonly: split CPubKey and friends to new files 2014-10-31 01:19:37 -04:00