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 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/include/fc/thread/future.hpp b/include/fc/thread/future.hpp index d8d157d..cf57a24 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 ) { @@ -225,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 ) { 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() { }