aboutsummaryrefslogtreecommitdiffstats
path: root/moon-abe/pbc-0.5.14/pbc/g2_test.pbc
diff options
context:
space:
mode:
authorWuKong <rebirthmonkey@gmail.com>2015-09-04 09:25:34 +0200
committerWuKong <rebirthmonkey@gmail.com>2015-09-04 09:25:34 +0200
commit3baeb11a8fbcfcdbc31976d421f17b85503b3ecd (patch)
tree04891d88c1127148f1b390b5a24414e85b270aee /moon-abe/pbc-0.5.14/pbc/g2_test.pbc
parent67c5b73910f5fc437429c356978081b252a59480 (diff)
init attribute-based encryption
Change-Id: Iba1a3d722110abf747a0fba366f3ebc911d25b25
Diffstat (limited to 'moon-abe/pbc-0.5.14/pbc/g2_test.pbc')
-rw-r--r--moon-abe/pbc-0.5.14/pbc/g2_test.pbc37
1 files changed, 37 insertions, 0 deletions
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);