diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-12-08 23:43:40 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-12-08 23:43:41 +0200 |
commit | 22e16e88e3d2d4475761f9c2c0c59a7b20247f9f (patch) | |
tree | ffa7dae44cca09099708d6386cb0b0b4c802f10a /tests/unit_tests/ringct.cpp | |
parent | Merge pull request #1405 (diff) | |
parent | blockchain: bring the v4 fork height one block forward (diff) | |
download | monero-22e16e88e3d2d4475761f9c2c0c59a7b20247f9f.tar.xz |
Merge pull request #1413
648ea6be blockchain: bring the v4 fork height one block forward (luigi1111)
46a0dcc1 ringct: luigi1111's changes to fix and speedup Borromean sigs (luigi1111)
76958fc7 ringct: switch to Borromean signatures (Shen Noether)
Diffstat (limited to 'tests/unit_tests/ringct.cpp')
-rw-r--r-- | tests/unit_tests/ringct.cpp | 49 |
1 files changed, 14 insertions, 35 deletions
diff --git a/tests/unit_tests/ringct.cpp b/tests/unit_tests/ringct.cpp index 1abf2511d..f6409d1ae 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; @@ -74,34 +57,30 @@ TEST(ringct, ASNL) xv[j] = skGen(); if ( (int)indi[j] == 0 ) { - P1v[j] = scalarmultBase(xv[j]); - P2v[j] = pkGen(); - + scalarmultBase(P1v[j], xv[j]); } else { - - P2v[j] = scalarmultBase(xv[j]); - P1v[j] = pkGen(); - + addKeys1(P1v[j], xv[j], H2[j]); } + subKeys(P2v[j], P1v[j], H2[j]); } //#true one - asnlSig L1s2s = GenASNL(xv, P1v, P2v, indi); - ASSERT_TRUE(VerASNL(P1v, P2v, L1s2s)); + boroSig 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) |