aboutsummaryrefslogtreecommitdiff
path: root/src/pubkey.h
diff options
context:
space:
mode:
authorJack Grigg <jack@z.cash>2017-10-04 14:41:40 +0100
committerJack Grigg <jack@z.cash>2017-10-04 14:41:40 +0100
commit63179d028347bf3e32c7ea61386df4c44307b4a7 (patch)
tree13f96bb1dc55d166f3a9ec3a43aca14e3e923313 /src/pubkey.h
parent1ce9f0a952a3d5d9442ad8251da898d96209c16c (diff)
downloadbitcoin-63179d028347bf3e32c7ea61386df4c44307b4a7.tar.xz
Scope the ECDSA constant sizes to CPubKey / CKey classes
Diffstat (limited to 'src/pubkey.h')
-rw-r--r--src/pubkey.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/pubkey.h b/src/pubkey.h
index a508c238e4..df41eb4971 100644
--- a/src/pubkey.h
+++ b/src/pubkey.h
@@ -14,18 +14,6 @@
#include <stdexcept>
#include <vector>
-/**
- * secp256k1:
- */
-const unsigned int PUBLIC_KEY_SIZE = 65;
-const unsigned int COMPRESSED_PUBLIC_KEY_SIZE = 33;
-const unsigned int SIGNATURE_SIZE = 72;
-const unsigned int COMPACT_SIGNATURE_SIZE = 65;
-/**
- * see www.keylength.com
- * script supports up to 75 for single byte push
- */
-
const unsigned int BIP32_EXTKEY_SIZE = 74;
/** A reference to a CKey: the Hash160 of its serialized public key */
@@ -41,6 +29,22 @@ typedef uint256 ChainCode;
/** An encapsulated public key. */
class CPubKey
{
+public:
+ /**
+ * secp256k1:
+ */
+ static const unsigned int PUBLIC_KEY_SIZE = 65;
+ static const unsigned int COMPRESSED_PUBLIC_KEY_SIZE = 33;
+ static const unsigned int SIGNATURE_SIZE = 72;
+ static const unsigned int COMPACT_SIGNATURE_SIZE = 65;
+ /**
+ * see www.keylength.com
+ * script supports up to 75 for single byte push
+ */
+ static_assert(
+ PUBLIC_KEY_SIZE >= COMPRESSED_PUBLIC_KEY_SIZE,
+ "COMPRESSED_PUBLIC_KEY_SIZE is larger than PUBLIC_KEY_SIZE");
+
private:
/**
@@ -48,9 +52,6 @@ private:
* Its length can very cheaply be computed from the first byte.
*/
unsigned char vch[PUBLIC_KEY_SIZE];
- static_assert(
- PUBLIC_KEY_SIZE >= COMPRESSED_PUBLIC_KEY_SIZE,
- "COMPRESSED_PUBLIC_KEY_SIZE is larger than PUBLIC_KEY_SIZE");
//! Compute the length of a pubkey with a given first byte.
unsigned int static GetLen(unsigned char chHeader)