From b8a9c7726966f522b501ab10ad20550ead3f8698 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 9 Dec 2013 22:25:59 -0500 Subject: [PATCH 1/4] adding helper function to return uncompressed ecc pub key --- include/fc/crypto/elliptic.hpp | 3 +++ src/crypto/elliptic.cpp | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/fc/crypto/elliptic.hpp b/include/fc/crypto/elliptic.hpp index 5168bd3..401c132 100644 --- a/include/fc/crypto/elliptic.hpp +++ b/include/fc/crypto/elliptic.hpp @@ -16,6 +16,7 @@ namespace fc { } typedef fc::array public_key_data; + typedef fc::array public_key_point_data; ///< the full non-compressed version of the ECC point typedef fc::array signature; typedef fc::array compact_signature; @@ -31,9 +32,11 @@ namespace fc { ~public_key(); bool verify( const fc::sha256& digest, const signature& sig ); public_key_data serialize()const; + public_key_point_data serialize_ecc_point()const; operator public_key_data()const { return serialize(); } + public_key( const public_key_data& v ); public_key( const compact_signature& c, const fc::sha256& digest ); diff --git a/src/crypto/elliptic.cpp b/src/crypto/elliptic.cpp index 68f7ad6..1e85200 100644 --- a/src/crypto/elliptic.cpp +++ b/src/crypto/elliptic.cpp @@ -369,7 +369,7 @@ namespace fc { namespace ecc { public_key_data dat; if( !my->_key ) return dat; EC_KEY_set_conv_form( my->_key, POINT_CONVERSION_COMPRESSED ); - /*size_t nbytes = */i2o_ECPublicKey( my->_key, nullptr ); + /*size_t nbytes = i2o_ECPublicKey( my->_key, nullptr ); */ /*assert( nbytes == 33 )*/ char* front = &dat.data[0]; i2o_ECPublicKey( my->_key, (unsigned char**)&front ); @@ -380,6 +380,23 @@ namespace fc { namespace ecc { EC_POINT_get_affine_coordinates_GFp( group, pub, self.my->_pub_x.get(), self.my->_pub_y.get(), nullptr ); */ } + public_key_point_data public_key::serialize_ecc_point()const + { + public_key_point_data dat; + if( !my->_key ) return dat; + // EC_KEY_set_conv_form( my->_key, POINT_CONVERSION_COMPRESSED ); + // size_t nbytes = i2o_ECPublicKey( my->_key, nullptr ); + // assert( nbytes == 65 ) + char* front = &dat.data[0]; + i2o_ECPublicKey( my->_key, (unsigned char**)&front ); + return dat; + /* + EC_POINT* pub = EC_KEY_get0_public_key( my->_key ); + EC_GROUP* group = EC_KEY_get0_group( my->_key ); + EC_POINT_get_affine_coordinates_GFp( group, pub, self.my->_pub_x.get(), self.my->_pub_y.get(), nullptr ); + */ + } + public_key::public_key() { } From fe8771d64294e350c5ced8ae51e7963076d9d793 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 9 Dec 2013 22:26:13 -0500 Subject: [PATCH 2/4] ignoring generated files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 054859e..25103bf 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ cmake_install.cmake libfc.a libfc_debug.a +fc_automoc.cpp +*.swp From 2d0bdb8e7ab43cbc037d1e54f8c105d9ef0b5f64 Mon Sep 17 00:00:00 2001 From: dnotestein Date: Thu, 12 Dec 2013 22:18:09 -0500 Subject: [PATCH 3/4] attempt to fix Linux compile error, needs to be verified on a Linux build machine --- include/fc/thread/future.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/fc/thread/future.hpp b/include/fc/thread/future.hpp index d8d157d..d2deb76 100644 --- a/include/fc/thread/future.hpp +++ b/include/fc/thread/future.hpp @@ -169,6 +169,7 @@ namespace fc { public: future( const fc::shared_ptr>& p ):m_prom(p){} future( fc::shared_ptr>&& p ):m_prom(fc::move(p)){} + future(const future& f ) : m_prom(f.m_prom){} future(){} future& operator=(future&& f ) { From d1d365beaf9d2a00752878b9e392792f5933c0f7 Mon Sep 17 00:00:00 2001 From: dnotestein Date: Fri, 13 Dec 2013 09:13:08 -0500 Subject: [PATCH 4/4] further attempt at fixing Linux compile error --- include/fc/thread/future.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/fc/thread/future.hpp b/include/fc/thread/future.hpp index d2deb76..cf57a24 100644 --- a/include/fc/thread/future.hpp +++ b/include/fc/thread/future.hpp @@ -226,6 +226,7 @@ namespace fc { public: future( const fc::shared_ptr>& p ):m_prom(p){} future( fc::shared_ptr>&& p ):m_prom(fc::move(p)){} + future(const future& f ) : m_prom(f.m_prom){} future(){} future& operator=(future&& f ) {