Beispiel #1
0
void add_to (EC_GROUP const* group,
             ec_point const& a,
             ec_point& b,
             bn_ctx& ctx)
{
    if (!EC_POINT_add (group, b.get(), a.get(), b.get(), ctx.get()))
    {
        throw std::runtime_error ("EC_POINT_add() failed");
    }
}
Beispiel #2
0
void serialize_ec_point (ec_point const& point, std::uint8_t* ptr)
{
    ec_key key = ec_key_new_secp256k1_compressed();

    if (EC_KEY_set_public_key((EC_KEY*) key.get(), point.get()) <= 0)
    {
        throw std::runtime_error ("EC_KEY_set_public_key() failed");
    }

    int const size = i2o_ECPublicKey ((EC_KEY*) key.get(), &ptr);

    assert (size <= 33);
    (void) size;
}