forked from lthn/blockchain
Merge branch 'cryptoassets' into multiassets
This commit is contained in:
commit
27000bdb86
4 changed files with 9 additions and 11 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include "portable_storage_template_helper.h"
|
||||
#include "net/http_base.h"
|
||||
#include "net/http_server_handlers_map2.h"
|
||||
#include "net/http_client.h"
|
||||
|
||||
namespace epee
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace crypto
|
||||
{
|
||||
namespace mp = boost::multiprecision;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "crypto/crypto-ops.h"
|
||||
|
|
|
|||
|
|
@ -8,12 +8,9 @@
|
|||
#include "crypto-sugar.h"
|
||||
#include "range_proofs.h"
|
||||
#include "clsag.h"
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
|
||||
namespace crypto
|
||||
{
|
||||
namespace mp = boost::multiprecision;
|
||||
|
||||
extern const mp::uint256_t c_zarcanum_z_coeff_mp;
|
||||
extern const scalar_t c_zarcanum_z_coeff_s;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
using namespace crypto;
|
||||
|
||||
namespace mp = boost::multiprecision;
|
||||
|
||||
// out = z ^ s (mod l)
|
||||
void sc_exp(unsigned char* out, const unsigned char* z, const unsigned char* s)
|
||||
{
|
||||
|
|
@ -475,10 +473,10 @@ uint64_t hash_64(const void* data, size_t size)
|
|||
static bool test_name_a ## _ ## test_name_b(); \
|
||||
static test_keeper_t test_name_a ## _ ## test_name_b ## _ ## keeper(STR(COMBINE(test_name_a ## _, test_name_b)), & test_name_a ## _ ## test_name_b); \
|
||||
static bool test_name_a ## _ ## test_name_b()
|
||||
#define ASSERT_TRUE(expr) CHECK_AND_ASSERT_MES(expr, false, "This is not true: " #expr)
|
||||
#define ASSERT_FALSE(expr) CHECK_AND_ASSERT_MES((expr) == false, false, "This is not false: " #expr)
|
||||
#define ASSERT_EQ(a, b) CHECK_AND_ASSERT_MES(a == b, false, #a " != " #b "\n " << a << " != " << b)
|
||||
#define ASSERT_NEQ(a, b) CHECK_AND_ASSERT_MES(a != b, false, #a " == " #b "\n " << a)
|
||||
#define ASSERT_TRUE(expr) CHECK_AND_ASSERT_MES(expr, false, "This is not true: " #expr << " @ " << LOCATION_SS)
|
||||
#define ASSERT_FALSE(expr) CHECK_AND_ASSERT_MES((expr) == false, false, "This is not false: " #expr << " @ " << LOCATION_SS)
|
||||
#define ASSERT_EQ(a, b) CHECK_AND_ASSERT_MES(a == b, false, #a " != " #b "\n " << a << " != " << b << " @ " << LOCATION_SS)
|
||||
#define ASSERT_NEQ(a, b) CHECK_AND_ASSERT_MES(a != b, false, #a " == " #b "\n " << a << " @ " << LOCATION_SS)
|
||||
|
||||
typedef bool(*bool_func_ptr_t)();
|
||||
static std::vector<std::pair<std::string, bool_func_ptr_t>> g_tests;
|
||||
|
|
@ -1539,14 +1537,14 @@ TEST(crypto, schnorr_sig)
|
|||
scalar_t a = scalar_t::random();
|
||||
point_t A_pt = a * c_point_G;
|
||||
public_key A = A_pt.to_public_key();
|
||||
ASSERT_FALSE(generate_schnorr_sig<gt_X>(m, A_pt, a, ss));
|
||||
// (different behaviour in debug and release) ASSERT_FALSE(generate_schnorr_sig<gt_X>(m, A_pt, a, ss));
|
||||
ASSERT_TRUE(generate_schnorr_sig<gt_G>(m, A_pt, a, ss));
|
||||
ASSERT_FALSE(verify_schnorr_sig<gt_X>(m, A, ss));
|
||||
ASSERT_TRUE(verify_schnorr_sig<gt_G>(m, A, ss));
|
||||
|
||||
A_pt = a * c_point_X;
|
||||
A = A_pt.to_public_key();
|
||||
ASSERT_FALSE(generate_schnorr_sig<gt_G>(m, A_pt, a, ss));
|
||||
// (different behaviour in debug and release) ASSERT_FALSE(generate_schnorr_sig<gt_G>(m, A_pt, a, ss));
|
||||
ASSERT_TRUE(generate_schnorr_sig<gt_X>(m, A_pt, a, ss));
|
||||
ASSERT_FALSE(verify_schnorr_sig<gt_G>(m, A, ss));
|
||||
ASSERT_TRUE(verify_schnorr_sig<gt_X>(m, A, ss));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue