diff options
author | Shen Noether <Shen.Noether@gmx.com> | 2016-11-17 23:17:21 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-12-04 21:54:11 +0000 |
commit | 76958fc75abc18c928474eea91ac05fd5e0fcb41 (patch) | |
tree | 8644fe15b761d9121c23e67d0cd553505f8a0c04 /tests/unit_tests | |
parent | Merge pull request #1403 (diff) | |
download | monero-76958fc75abc18c928474eea91ac05fd5e0fcb41.tar.xz |
ringct: switch to Borromean signatures
Diffstat (limited to 'tests/unit_tests')
-rw-r--r-- | tests/unit_tests/ringct.cpp | 39 | ||||
-rw-r--r-- | tests/unit_tests/serialization.cpp | 14 |
2 files changed, 18 insertions, 35 deletions
diff --git a/tests/unit_tests/ringct.cpp b/tests/unit_tests/ringct.cpp index 1abf2511d..5ab77d4aa 100644 --- a/tests/unit_tests/ringct.cpp +++ b/tests/unit_tests/ringct.cpp @@ -40,29 +40,12 @@ using namespace crypto; using namespace rct; -TEST(ringct, SNL) -{ - key x, P1; - skpkGen(x, P1); - - key P2 = pkGen(); - key P3 = pkGen(); - - key L1, s1, s2; - GenSchnorrNonLinkable(L1, s1, s2, x, P1, P2, 0); - - // a valid one - // an invalid one - ASSERT_TRUE(VerSchnorrNonLinkable(P1, P2, L1, s1, s2)); - ASSERT_FALSE(VerSchnorrNonLinkable(P1, P3, L1, s1, s2)); -} - -TEST(ringct, ASNL) +TEST(ringct, Borromean) { int j = 0; - //Tests for ASNL - //#ASNL true one, false one, C != sum Ci, and one out of the range.. + //Tests for Borromean signatures + //#boro true one, false one, C != sum Ci, and one out of the range.. int N = 64; key64 xv; key64 P1v; @@ -86,22 +69,22 @@ TEST(ringct, ASNL) } //#true one - asnlSig L1s2s = GenASNL(xv, P1v, P2v, indi); - ASSERT_TRUE(VerASNL(P1v, P2v, L1s2s)); + boro bb = genBorromean(xv, P1v, P2v, indi); + ASSERT_TRUE(verifyBorromean(bb, P1v, P2v)); //#false one indi[3] = (indi[3] + 1) % 2; - L1s2s = GenASNL(xv, P1v, P2v, indi); - ASSERT_FALSE(VerASNL(P1v, P2v, L1s2s)); + bb = genBorromean(xv, P1v, P2v, indi); + ASSERT_FALSE(verifyBorromean(bb, P1v, P2v)); //#true one again indi[3] = (indi[3] + 1) % 2; - L1s2s = GenASNL(xv, P1v, P2v, indi); - ASSERT_TRUE(VerASNL(P1v, P2v, L1s2s)); + bb = genBorromean(xv, P1v, P2v, indi); + ASSERT_TRUE(verifyBorromean(bb, P1v, P2v)); //#false one - L1s2s = GenASNL(xv, P2v, P1v, indi); - ASSERT_FALSE(VerASNL(P1v, P2v, L1s2s)); + bb = genBorromean(xv, P2v, P1v, indi); + ASSERT_FALSE(verifyBorromean(bb, P1v, P2v)); } TEST(ringct, MG_sigs) diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp index b592f456b..f8afb2e94 100644 --- a/tests/unit_tests/serialization.cpp +++ b/tests/unit_tests/serialization.cpp @@ -457,7 +457,7 @@ TEST(Serialization, serializes_ringct_types) rct::ctkeyV ctkeyv0, ctkeyv1; rct::ctkeyM ctkeym0, ctkeym1; rct::ecdhTuple ecdh0, ecdh1; - rct::asnlSig asnl0, asnl1; + rct::boroSig boro0, boro1; rct::mgSig mg0, mg1; rct::rangeSig rg0, rg1; rct::rctSig s0, s1; @@ -541,13 +541,13 @@ TEST(Serialization, serializes_ringct_types) for (size_t n = 0; n < 64; ++n) { - asnl0.L1[n] = rct::skGen(); - asnl0.s2[n] = rct::skGen(); + boro0.s0[n] = rct::skGen(); + boro0.s1[n] = rct::skGen(); } - asnl0.s = rct::skGen(); - ASSERT_TRUE(serialization::dump_binary(asnl0, blob)); - ASSERT_TRUE(serialization::parse_binary(blob, asnl1)); - ASSERT_TRUE(!memcmp(&asnl0, &asnl1, sizeof(asnl0))); + boro0.ee = rct::skGen(); + ASSERT_TRUE(serialization::dump_binary(boro0, blob)); + ASSERT_TRUE(serialization::parse_binary(blob, boro1)); + ASSERT_TRUE(!memcmp(&boro0, &boro1, sizeof(boro0))); // create a full rct signature to use its innards rct::ctkeyV sc, pc; |