Merge branch 'phoenix' of https://github.com/InvictusInnovations/fc into phoenix
This commit is contained in:
commit
f3be57dc63
4 changed files with 25 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -40,3 +40,5 @@ cmake_install.cmake
|
||||||
libfc.a
|
libfc.a
|
||||||
libfc_debug.a
|
libfc_debug.a
|
||||||
|
|
||||||
|
fc_automoc.cpp
|
||||||
|
*.swp
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ namespace fc {
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef fc::array<char,33> public_key_data;
|
typedef fc::array<char,33> public_key_data;
|
||||||
|
typedef fc::array<char,65> public_key_point_data; ///< the full non-compressed version of the ECC point
|
||||||
typedef fc::array<char,72> signature;
|
typedef fc::array<char,72> signature;
|
||||||
typedef fc::array<unsigned char,65> compact_signature;
|
typedef fc::array<unsigned char,65> compact_signature;
|
||||||
|
|
||||||
|
|
@ -31,9 +32,11 @@ namespace fc {
|
||||||
~public_key();
|
~public_key();
|
||||||
bool verify( const fc::sha256& digest, const signature& sig );
|
bool verify( const fc::sha256& digest, const signature& sig );
|
||||||
public_key_data serialize()const;
|
public_key_data serialize()const;
|
||||||
|
public_key_point_data serialize_ecc_point()const;
|
||||||
|
|
||||||
operator public_key_data()const { return serialize(); }
|
operator public_key_data()const { return serialize(); }
|
||||||
|
|
||||||
|
|
||||||
public_key( const public_key_data& v );
|
public_key( const public_key_data& v );
|
||||||
public_key( const compact_signature& c, const fc::sha256& digest );
|
public_key( const compact_signature& c, const fc::sha256& digest );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@ namespace fc {
|
||||||
public:
|
public:
|
||||||
future( const fc::shared_ptr<promise<T>>& p ):m_prom(p){}
|
future( const fc::shared_ptr<promise<T>>& p ):m_prom(p){}
|
||||||
future( fc::shared_ptr<promise<T>>&& p ):m_prom(fc::move(p)){}
|
future( fc::shared_ptr<promise<T>>&& p ):m_prom(fc::move(p)){}
|
||||||
|
future(const future<T>& f ) : m_prom(f.m_prom){}
|
||||||
future(){}
|
future(){}
|
||||||
|
|
||||||
future& operator=(future<T>&& f ) {
|
future& operator=(future<T>&& f ) {
|
||||||
|
|
@ -225,6 +226,7 @@ namespace fc {
|
||||||
public:
|
public:
|
||||||
future( const fc::shared_ptr<promise<void>>& p ):m_prom(p){}
|
future( const fc::shared_ptr<promise<void>>& p ):m_prom(p){}
|
||||||
future( fc::shared_ptr<promise<void>>&& p ):m_prom(fc::move(p)){}
|
future( fc::shared_ptr<promise<void>>&& p ):m_prom(fc::move(p)){}
|
||||||
|
future(const future<void>& f ) : m_prom(f.m_prom){}
|
||||||
future(){}
|
future(){}
|
||||||
|
|
||||||
future& operator=(future<void>&& f ) {
|
future& operator=(future<void>&& f ) {
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ namespace fc { namespace ecc {
|
||||||
public_key_data dat;
|
public_key_data dat;
|
||||||
if( !my->_key ) return dat;
|
if( !my->_key ) return dat;
|
||||||
EC_KEY_set_conv_form( my->_key, POINT_CONVERSION_COMPRESSED );
|
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 )*/
|
/*assert( nbytes == 33 )*/
|
||||||
char* front = &dat.data[0];
|
char* front = &dat.data[0];
|
||||||
i2o_ECPublicKey( my->_key, (unsigned char**)&front );
|
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 );
|
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()
|
public_key::public_key()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue