Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
elliptic_mixed.cpp
Go to the documentation of this file.
2
5
6#include <fc/fwd_impl.hpp>
8#include <fc/log/logger.hpp>
9
10#include <secp256k1.h>
11
14
15namespace fc { namespace ecc {
16 namespace detail
17 {
18 const secp256k1_context_t* _get_context() {
20 return ctx;
21 }
22
23 void _init_lib() {
24 static const secp256k1_context_t* ctx = _get_context();
25 }
26 }
27
28 static const private_key_secret empty_priv;
30 {
31 FC_ASSERT( my->_key != empty_priv );
32 FC_ASSERT( other.my->_key != nullptr );
33 public_key_data pub(other.serialize());
34 FC_ASSERT( secp256k1_ec_pubkey_tweak_mul( detail::_get_context(), (unsigned char*) pub.begin(), pub.size(), (unsigned char*) my->_key.data() ) );
35 return fc::sha512::hash( pub.begin() + 1, pub.size() - 1 );
36 }
37
38} }
fc::sha512 get_shared_secret(const public_key &pub) const
contains only the public point of an elliptic curve key.
Definition elliptic.hpp:36
static sha512 hash(const char *d, uint32_t dlen)
Definition sha512.cpp:37
Defines exception's used by fc.
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
const secp256k1_context * _get_context()
fc::sha256 private_key_secret
Definition elliptic.hpp:23
namespace sysio::chain
Definition authority.cpp:3
#define SECP256K1_CONTEXT_SIGN
Definition secp256k1.h:196
SECP256K1_API secp256k1_context * secp256k1_context_create(unsigned int flags) SECP256K1_WARN_UNUSED_RESULT
Definition secp256k1.c:107
#define SECP256K1_CONTEXT_VERIFY
Definition secp256k1.h:195
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Definition secp256k1.c:683
bool pub