#include #include #include #include #include #include #include #include #include "_elliptic_impl_priv.hpp" #include "_elliptic_impl_pub.hpp" namespace fc { namespace ecc { namespace detail { static int init_secp256k1() { secp256k1_start(SECP256K1_START_VERIFY | SECP256K1_START_SIGN); return 1; } void _init_lib() { static int init_s = init_secp256k1(); static int init_o = init_openssl(); } } static const private_key_secret empty_priv; fc::sha512 private_key::get_shared_secret( const public_key& other )const { FC_ASSERT( my->_key != empty_priv ); FC_ASSERT( other.my->_key != nullptr ); public_key_data pub(other.serialize()); FC_ASSERT( secp256k1_ec_pubkey_tweak_mul( (unsigned char*) pub.begin(), pub.size(), (unsigned char*) my->_key.data() ) ); return fc::sha512::hash( pub.begin() + 1, pub.size() - 1 ); } } }