Browse Source

Disable libsecp256k1-specific tests for windows compile.

cl-refactor
subtly 10 years ago
parent
commit
7beccf2a8d
  1. 10
      test/libdevcrypto/crypto.cpp

10
test/libdevcrypto/crypto.cpp

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

Loading…
Cancel
Save