From 3baeb11a8fbcfcdbc31976d421f17b85503b3ecd Mon Sep 17 00:00:00 2001 From: WuKong Date: Fri, 4 Sep 2015 09:25:34 +0200 Subject: init attribute-based encryption Change-Id: Iba1a3d722110abf747a0fba366f3ebc911d25b25 --- moon-abe/pbc-0.5.14/pbc/g2_test.pbc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 moon-abe/pbc-0.5.14/pbc/g2_test.pbc (limited to 'moon-abe/pbc-0.5.14/pbc/g2_test.pbc') diff --git a/moon-abe/pbc-0.5.14/pbc/g2_test.pbc b/moon-abe/pbc-0.5.14/pbc/g2_test.pbc new file mode 100644 index 00000000..892660f9 --- /dev/null +++ b/moon-abe/pbc-0.5.14/pbc/g2_test.pbc @@ -0,0 +1,37 @@ +# Exercises a bug found by Zhang Ye. + +define test_cmp_0(initfn) { + initfn(); + CHECK(random(G2) != G2(0)); + CHECK(G2(0) != random(G2)); + CHECK(G2(0) == G2(0)); + CHECK(random(G1) != G1(0)); + CHECK(G1(0) != random(G1)); + CHECK(G1(0) == G1(0)); +} + +test_cmp_0(init_pairing_a); +test_cmp_0(init_pairing_d); +test_cmp_0(init_pairing_e); +test_cmp_0(init_pairing_f); +test_cmp_0(init_pairing_g); +test_cmp_0(init_pairing_i); + +# Exercises a bug found by Mario Di Raimondo. + +define test_g2_cmp(initfn) { + initfn(); + a := rnd(G2); + m := rnd(Zr); + n := rnd(Zr); + CHECK((a^m)^n == a^(m*n)); + CHECK(a != a^m); + CHECK(a != a^n); +} + +test_g2_cmp(init_pairing_a); +test_g2_cmp(init_pairing_d); +test_g2_cmp(init_pairing_e); +test_g2_cmp(init_pairing_f); +test_g2_cmp(init_pairing_g); +test_g2_cmp(init_pairing_i); -- cgit 1.2.3-korg