|
|
@ -22,7 +22,9 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
#include <random> |
|
|
|
#if ETH_HAVE_SECP256K1 |
|
|
|
#include <secp256k1/secp256k1.h> |
|
|
|
#endif |
|
|
|
#include <libdevcore/Common.h> |
|
|
|
#include <libdevcore/RLP.h> |
|
|
|
#include <libdevcore/Log.h> |
|
|
@ -64,6 +66,7 @@ BOOST_AUTO_TEST_CASE(emptySHA3Types) |
|
|
|
BOOST_REQUIRE_EQUAL(emptyListSHA3, EmptyListSHA3); |
|
|
|
} |
|
|
|
|
|
|
|
#if ETH_HAVE_SECP256K1 |
|
|
|
BOOST_AUTO_TEST_CASE(secp256k1lib) |
|
|
|
{ |
|
|
|
secp256k1Init(); |
|
|
@ -73,6 +76,7 @@ BOOST_AUTO_TEST_CASE(secp256k1lib) |
|
|
|
Public test = toPublic(k.sec()); |
|
|
|
BOOST_REQUIRE(k.pub() == test); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(cryptopp_patch) |
|
|
|
{ |
|
|
@ -111,7 +115,9 @@ BOOST_AUTO_TEST_CASE(common_encrypt_decrypt) |
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(cryptopp_cryptopp_secp256k1libport) |
|
|
|
{ |
|
|
|
#if ETH_HAVE_SECP256K1 |
|
|
|
secp256k1_start(); |
|
|
|
#endif |
|
|
|
|
|
|
|
// base secret
|
|
|
|
Secret secret(sha3("privacy")); |
|
|
@ -160,7 +166,9 @@ BOOST_AUTO_TEST_CASE(cryptopp_cryptopp_secp256k1libport) |
|
|
|
byte dersig[72]; |
|
|
|
size_t cssz = DSAConvertSignatureFormat(dersig, 72, DSA_DER, sig.data(), 64, DSA_P1363); |
|
|
|
BOOST_CHECK(cssz <= 72); |
|
|
|
#if ETH_HAVE_SECP256K1 |
|
|
|
BOOST_REQUIRE(1 == secp256k1_ecdsa_verify(he.data(), sizeof(he), dersig, cssz, encpub, 65)); |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -759,7 +767,6 @@ BOOST_AUTO_TEST_CASE(cryptopp_aes128_cbc) |
|
|
|
BOOST_AUTO_TEST_CASE(eth_keypairs) |
|
|
|
{ |
|
|
|
cnote << "Testing Crypto..."; |
|
|
|
secp256k1_start(); |
|
|
|
|
|
|
|
KeyPair p(Secret(fromHex("3ecb44df2159c26e0f995712d4f39b6f6e499b40749b1cf1246c37f9516cb6a4"))); |
|
|
|
BOOST_REQUIRE(p.pub() == Public(fromHex("97466f2b32bc3bb76d4741ae51cd1d8578b48d3f1e68da206d47321aec267ce78549b514e4453d74ef11b0cd5e4e4c364effddac8b51bcfc8de80682f952896f"))); |
|
|
@ -783,7 +790,6 @@ BOOST_AUTO_TEST_CASE(eth_keypairs) |
|
|
|
int cryptoTest() |
|
|
|
{ |
|
|
|
cnote << "Testing Crypto..."; |
|
|
|
secp256k1_start(); |
|
|
|
|
|
|
|
KeyPair p(Secret(fromHex("3ecb44df2159c26e0f995712d4f39b6f6e499b40749b1cf1246c37f9516cb6a4"))); |
|
|
|
BOOST_REQUIRE(p.pub() == Public(fromHex("97466f2b32bc3bb76d4741ae51cd1d8578b48d3f1e68da206d47321aec267ce78549b514e4453d74ef11b0cd5e4e4c364effddac8b51bcfc8de80682f952896f"))); |
|
|
|