diff --git a/include/asym_field.h b/include/asym_field.h deleted file mode 100644 index 6eba2b5da74635af55b8376a5dc32f38f04a8105..0000000000000000000000000000000000000000 --- a/include/asym_field.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include <gmp.h> - -extern "C" { -#include "relic_asym/relic.h" -} - -struct ZP_ASYM { - bn_t point{}; - bn_t modular{}; -}; - -ZP_ASYM rand_zp(bn_t modular); - -ZP_ASYM zp_zero(bn_t modular); - -ZP_ASYM zp_one(bn_t modular); - -ZP_ASYM zp_copy(ZP_ASYM x); - -ZP_ASYM zp_from_int(int x, bn_t modular); - -ZP_ASYM zp_add(ZP_ASYM x, ZP_ASYM y); - -ZP_ASYM zp_neg(ZP_ASYM x); - -ZP_ASYM zp_mul(ZP_ASYM x, ZP_ASYM y); - -ZP_ASYM zp_inv(ZP_ASYM x); - -int zp_cmp(ZP_ASYM x, ZP_ASYM y); - -int zp_cmp_int(ZP_ASYM x, int y); \ No newline at end of file diff --git a/include/asym_field.hpp b/include/asym_field.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4d74626cccd1ec2d26864ae77ef2d517bff2bf7b --- /dev/null +++ b/include/asym_field.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include <gmp.h> + +extern "C" { +#include "relic_asym/relic.h" +} + +// Set specific asym data types. +typedef bn_t asymPoint; +struct asymZp { + asymPoint point{}; + asymPoint modular{}; +}; + +namespace asym { + asymZp rand_zp(asymPoint modular); + + asymZp zp_zero(asymPoint modular); + + asymZp zp_one(asymPoint modular); + + asymZp zp_copy(asymZp x); + + asymZp zp_from_int(int x, asymPoint modular); + + asymZp zp_add(asymZp x, asymZp y); + + asymZp zp_neg(asymZp x); + + asymZp zp_mul(asymZp x, asymZp y); + + asymZp zp_inv(asymZp x); + + int zp_cmp(asymZp x, asymZp y); + + int zp_cmp_int(asymZp x, int y); +} diff --git a/include/asym_group.h b/include/asym_group.h deleted file mode 100644 index 45b1c93e66422871d71e61f4effc3e85a3d8190e..0000000000000000000000000000000000000000 --- a/include/asym_group.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "asym_field.h" - -typedef g1_t g1_asym; -typedef g2_t g2_asym; -typedef gt_t gt_asym; - -void g1_gen(g1_asym x); - -void g2_gen(g2_asym x); - -void g1_mul(g1_asym r, g1_asym x, ZP_ASYM y); - -void g2_mul(g2_asym r, g2_asym x, ZP_ASYM y); - -void gt_raise(gt_asym r, gt_asym x, ZP_ASYM y); - -void bp_map(gt_asym r, g1_asym x, g2_asym y); \ No newline at end of file diff --git a/include/asym_group.hpp b/include/asym_group.hpp new file mode 100644 index 0000000000000000000000000000000000000000..19287fb33c1814b50656803cd58cbb025252ff3d --- /dev/null +++ b/include/asym_group.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "asym_field.hpp" + +typedef g1_t asymG1; +typedef g2_t asymG2; +typedef gt_t asymGt; + +namespace asym { + void g1_gen(asymG1 x); + + void g2_gen(asymG2 x); + + void g1_mul(asymG1 r, asymG1 x, asymZp y); + + void g2_mul(asymG2 r, asymG2 x, asymZp y); + + void gt_raise(asymGt r, asymGt x, asymZp y); + + void bp_map(asymGt r, asymG1 x, asymG2 y); +} diff --git a/include/sym_group.hpp b/include/sym_group.hpp index 92d6bb5ecb4b1a52f8b05fc6b3306ffb4860f2ab..8e13419aff596b6a6e229028170ec41227a62ed3 100644 --- a/include/sym_group.hpp +++ b/include/sym_group.hpp @@ -12,6 +12,6 @@ namespace sym { void gt_raise(symGt r, symGt x, symZp y); - void bp_map(symG a, symG b, symGt r); + void bp_map(symGt r, symG a, symG b); } diff --git a/src/asym_field.cpp b/src/asym_field.cpp index b7f0fa2fe1e371bd74a0cb8146fc3be46b582ff1..60bf35ca939db09481855ea4b1b7648203452232 100644 --- a/src/asym_field.cpp +++ b/src/asym_field.cpp @@ -1,75 +1,75 @@ -#include "asym_field.h" +#include "asym_field.hpp" -ZP_ASYM rand_zp(bn_st *modular) { - ZP_ASYM result; +asymZp asym::rand_zp(asymPoint modular) { + asymZp result; bn_rand_mod(result.point, modular); bn_copy(result.modular, modular); return result; } -ZP_ASYM zp_zero(bn_st *modular) { - ZP_ASYM result; +asymZp asym::zp_zero(asymPoint modular) { + asymZp result; bn_set_dig(result.point, 0); bn_copy(result.modular, modular); return result; } -ZP_ASYM zp_one(bn_st *modular) { - ZP_ASYM result; +asymZp asym::zp_one(asymPoint modular) { + asymZp result; bn_set_dig(result.point, 1); bn_copy(result.modular, modular); return result; } -ZP_ASYM zp_copy(ZP_ASYM x) { - ZP_ASYM result; +asymZp asym::zp_copy(asymZp x) { + asymZp result; bn_copy(result.point, x.point); bn_copy(result.modular, x.modular); return result; } -ZP_ASYM zp_from_int(int x, bn_st *modular) { - ZP_ASYM result; +asymZp asym::zp_from_int(int x, asymPoint modular) { + asymZp result; bn_set_dig(result.point, x); bn_copy(result.modular, modular); return result; } -ZP_ASYM zp_add(ZP_ASYM x, ZP_ASYM y) { - ZP_ASYM result; +asymZp asym::zp_add(asymZp x, asymZp y) { + asymZp result; bn_add(result.point, x.point, y.point); bn_mod(result.point, result.point, x.modular); bn_copy(result.modular, x.modular); return result; } -ZP_ASYM zp_neg(ZP_ASYM x) { - ZP_ASYM result; +asymZp asym::zp_neg(asymZp x) { + asymZp result; bn_neg(result.point, x.point); bn_mod(result.point, result.point, x.modular); bn_copy(result.modular, x.modular); return result; } -ZP_ASYM zp_mul(ZP_ASYM x, ZP_ASYM y) { - ZP_ASYM result; +asymZp asym::zp_mul(asymZp x, asymZp y) { + asymZp result; bn_mul(result.point, x.point, y.point); bn_mod(result.point, result.point, x.modular); bn_copy(result.modular, x.modular); return result; } -ZP_ASYM zp_inv(ZP_ASYM x) { - ZP_ASYM result; +asymZp asym::zp_inv(asymZp x) { + asymZp result; bn_mod_inv(result.point, x.point, x.modular); bn_copy(result.modular, x.modular); return result; } -int zp_cmp(ZP_ASYM x, ZP_ASYM y) { +int asym::zp_cmp(asymZp x, asymZp y) { return bn_cmp(x.point, y.point) == RLC_EQ; } -int zp_cmp_int(ZP_ASYM x, int y) { +int asym::zp_cmp_int(asymZp x, int y) { return bn_cmp_dig(x.point, y) == RLC_EQ; } \ No newline at end of file diff --git a/src/asym_group.cpp b/src/asym_group.cpp index 5fd16eceb93f9da88d1a7111ccd2eafb719a08a7..c89aefeec01b23c7d0ab6cb00450bf62c7305924 100644 --- a/src/asym_group.cpp +++ b/src/asym_group.cpp @@ -1,26 +1,26 @@ -#include "asym_group.h" +#include "asym_group.hpp" -void g1_gen(asym_ep_st *x) { +void asym::g1_gen(asymG1 x) { g1_get_gen(x); } -void g2_gen(asym_ep2_st *x) { +void asym::g2_gen(asymG2 x) { g2_get_gen(x); } -void g1_mul(asym_ep_st *r, asym_ep_st *x, ZP_ASYM y) { +void asym::g1_mul(asymG1 r, asymG1 x, asymZp y) { g1_mul(r, x, y.point); } -void g2_mul(asym_ep2_st *r, asym_ep2_st *x, ZP_ASYM y) { +void asym::g2_mul(asymG2 r, asymG2 x, asymZp y) { g2_mul(r, x, y.point); } -void gt_raise(asym_fp6_t *r, asym_fp6_t *x, ZP_ASYM y) { +void asym::gt_raise(asymGt r, asymGt x, asymZp y) { gt_exp(r, x, y.point); } -void bp_map(asym_fp6_t *r, asym_ep_st *x, asym_ep2_st *y) { +void asym::bp_map(asymGt r, asymG1 x, asymG2 y) { pc_map(r, x, y); } diff --git a/src/ipre.cpp b/src/ipre.cpp index a3bb5ef09ddd6d5ac7a0b4d165011e3bd5f60c9d..0776baf1cc4ab90659d004d55bd8c94c7bcac5c2 100644 --- a/src/ipre.cpp +++ b/src/ipre.cpp @@ -4,7 +4,7 @@ Key setup(int size) { Key key{}; pc_get_ord(key.modular); sym::g_gen(key.base); - sym::bp_map(key.base, key.base, key.t_base); + sym::bp_map(key.t_base, key.base, key.base); key.A = sym::matrix_zp_rand(2, size, key.modular); key.B = sym::matrix_zp_rand(B_SIZE, B_SIZE, key.modular); key.Bi = sym::matrix_transpose(sym::matrix_inverse(key.B, B_SIZE, key.modular), B_SIZE, B_SIZE); @@ -12,7 +12,7 @@ Key setup(int size) { } Ct enc(Key key, const int *message, int size) { - // Declare the returned ciphertext and convert message to ZP_ASYM. + // Declare the returned ciphertext and convert message to asymZp. Ct ct{}; symZpVec x = sym::vector_zp_from_int(message, size, key.modular); diff --git a/src/sym_group.cpp b/src/sym_group.cpp index d8b7301390159d9b3d5670f1d096e5adcb189be8..fe5957c7c5f9fa66d2cd46ac558a32f5f5d688b3 100644 --- a/src/sym_group.cpp +++ b/src/sym_group.cpp @@ -4,14 +4,14 @@ void sym::g_gen(symG x) { g1_get_gen(x); } -void sym::g_mul(ep_st *r, ep_st *x, symZp y) { +void sym::g_mul(symG r, symG x, symZp y) { g1_mul(r, x, y.point); } -void sym::gt_raise(fp_t *r, fp_t *x, symZp y) { +void sym::gt_raise(symGt r, symGt x, symZp y) { gt_exp(r, x, y.point); } -void sym::bp_map(ep_st *a, ep_st *b, fp_t *r) { +void sym::bp_map(symGt r, symG a, symG b) { pc_map(r, a, b); } \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index dd4d4914ba578e5f9eea5a2ea2f1f27b3f608834..a486392c85b6b3434327f55166b67a2f6f841982 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -18,6 +18,16 @@ add_executable(test_sym_vector test_sym_vector.cpp) target_link_libraries(test_sym_vector PRIVATE ppann_lib) add_test(NAME test_sym_vector COMMAND test_sym_vector) +# ----------------------------------------------------- +add_executable(test_asym_field test_asym_field.cpp) +target_link_libraries(test_asym_field PRIVATE ppann_lib) +add_test(NAME test_asym_field COMMAND test_asym_field) + +# ----------------------------------------------------- +add_executable(test_asym_group test_asym_group.cpp) +target_link_libraries(test_asym_group PRIVATE ppann_lib) +add_test(NAME test_asym_group COMMAND test_asym_group) + ## Add tests as separate executables. diff --git a/tests/test_asym_field.cpp b/tests/test_asym_field.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f3046357287a96fb9e2f9ab681251433244e1aba --- /dev/null +++ b/tests/test_asym_field.cpp @@ -0,0 +1,72 @@ +#include "asym_field.hpp" + +int test_zp_zero(asymPoint N) { + asymZp x = asym::zp_zero(N); + return asym::zp_cmp_int(x, 0); +} + +int test_zp_one(asymPoint N) { + asymZp x = asym::zp_one(N); + return asym::zp_cmp_int(x, 1); +} + +int test_zp_copy(asymPoint N) { + asymZp x = asym::zp_from_int(10, N); + asymZp y = asym::zp_copy(x); + return asym::zp_cmp(x, y); +} + +int test_zp_from_int(asymPoint N) { + asymZp x = asym::zp_from_int(3, N); + return asym::zp_cmp_int(x, 3); +} + +int test_zp_add(asymPoint N) { + asymZp x = asym::zp_from_int(10, N); + asymZp y = asym::zp_from_int(20, N); + asymZp z = asym::zp_add(x, y); + return asym::zp_cmp_int(z, 30); +} + +int test_zp_neg(asymPoint N) { + asymZp x = asym::rand_zp(N); + asymZp y = asym::zp_neg(x); + asymZp z = asym::zp_add(x, y); + return asym::zp_cmp_int(z, 0); +} + +int test_zp_mul(asymPoint N) { + asymZp x = asym::zp_from_int(10, N); + asymZp y = asym::zp_from_int(20, N); + asymZp z = asym::zp_mul(x, y); + return asym::zp_cmp_int(z, 200); +} + +int test_zp_inv(asymPoint N) { + asymZp x = asym::rand_zp(N); + asymZp y = asym::zp_inv(x); + asymZp z = asym::zp_mul(x, y); + return asym::zp_cmp_int(z, 1); +} + +int main() { + // Init core and setup. + core_init(); + pc_param_set_any(); + + // Get order. + bn_t N; + pc_get_ord(N); + + // Perform tests. + if (test_zp_zero(N) != 1) return 1; + if (test_zp_one(N) != 1) return 1; + if (test_zp_copy(N) != 1) return 1; + if (test_zp_from_int(N) != 1) return 1; + if (test_zp_add(N) != 1) return 1; + if (test_zp_neg(N) != 1) return 1; + if (test_zp_mul(N) != 1) return 1; + if (test_zp_inv(N) != 1) return 1; + + return 0; +} \ No newline at end of file diff --git a/tests/test_asym_group.cpp b/tests/test_asym_group.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ecff7789ad0cdd8e31df7b6a2f46eea938e965da --- /dev/null +++ b/tests/test_asym_group.cpp @@ -0,0 +1,26 @@ +#include "asym_group.hpp" + +int test_g1_generator() { + asymG1 x; + asym::g1_gen(x); + // Specifically this line goes wrong... I don't know how to further debug it. + return g1_is_valid(x); +} + +int main() { + // Init core and setup. + core_init(); + pc_param_set_any(); + + // Print the param used. + pc_param_print(); + + // Get order. + bn_t N; + pc_get_ord(N); + + // Perform tests. + if (test_g1_generator() != 1) return 1; + + return 0; +} \ No newline at end of file diff --git a/tests/test_field_asym.cpp b/tests/test_field_asym.cpp deleted file mode 100644 index 0c942611b710782b8a7319b9c1441ec5e4407de8..0000000000000000000000000000000000000000 --- a/tests/test_field_asym.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "asym_field.h" - -int test_zp_zero(bn_st *N) { - ZP_ASYM x = zp_zero(N); - return zp_cmp_int(x, 0); -} - -int test_zp_one(bn_st *N) { - ZP_ASYM x = zp_one(N); - return zp_cmp_int(x, 1); -} - -int test_zp_copy(bn_st *N) { - ZP_ASYM x = zp_from_int(10, N); - ZP_ASYM y = zp_copy(x); - return zp_cmp(x, y); -} - -int test_zp_from_int(bn_st *N) { - ZP_ASYM x = zp_from_int(3, N); - return zp_cmp_int(x, 3); -} - -int test_zp_add(bn_st *N) { - ZP_ASYM x = zp_from_int(10, N); - ZP_ASYM y = zp_from_int(20, N); - ZP_ASYM z = zp_add(x, y); - return zp_cmp_int(z, 30); -} - -int test_zp_neg(bn_st *N) { - ZP_ASYM x = rand_zp(N); - ZP_ASYM y = zp_neg(x); - ZP_ASYM z = zp_add(x, y); - return zp_cmp_int(z, 0); -} - -int test_zp_mul(bn_st *N) { - ZP_ASYM x = zp_from_int(10, N); - ZP_ASYM y = zp_from_int(20, N); - ZP_ASYM z = zp_mul(x, y); - return zp_cmp_int(z, 200); -} - -int test_zp_inv(bn_st *N) { - ZP_ASYM x = rand_zp(N); - ZP_ASYM y = zp_inv(x); - ZP_ASYM z = zp_mul(x, y); - return zp_cmp_int(z, 1); -} - -int main() { - // Init core and setup. - core_init(); - pc_param_set_any(); - - // Get order. - bn_t N; - pc_get_ord(N); - - // Perform tests. - if (test_zp_zero(N) != 1) return 1; - if (test_zp_one(N) != 1) return 1; - if (test_zp_copy(N) != 1) return 1; - if (test_zp_from_int(N) != 1) return 1; - if (test_zp_add(N) != 1) return 1; - if (test_zp_neg(N) != 1) return 1; - if (test_zp_mul(N) != 1) return 1; - if (test_zp_inv(N) != 1) return 1; - - return 0; -} \ No newline at end of file diff --git a/tests/test_group_asym.cpp b/tests/test_group_asym.cpp deleted file mode 100644 index 8272552419af0813fbeb14bd3a1ed4fab5bb64f6..0000000000000000000000000000000000000000 --- a/tests/test_group_asym.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "asym_group.h" - -//int test_all(bn_st *N) { -// // Set integers. -// ZP_ASYM a = zp_from_int(5, N); -// ZP_ASYM b = zp_from_int(6, N); -// ZP_ASYM c = zp_from_int(30, N); -// -// // Declare variables. -// g1_asym j, k; -// g2_asym m, n; -// gt_asym x, y, z; -// -// // -// g1_gen(j); -// g2_gen(m); -// -// asym_bn_t test; -// asym_bn_set_dig(test, 20); -// -// g1_mul(k, j, test); -// -// -// // Compare e(symG^5, symG^5) with e(symG, symG)^25. -// return RLC_EQ; -//} - -int main() { - core_clean(); - - // Init core and setup. - core_init(); - pc_param_set_any(); - - g1_asym p; - g1_new(p); - g1_get_gen(p); - - // Get order. -// bn_t N; -// pc_get_ord(N); - - // Perform tests. -// if (test_all(N) != RLC_EQ) return 1; - - return 0; -} \ No newline at end of file diff --git a/tests/test_sym_field.cpp b/tests/test_sym_field.cpp index 981227d759886f09a7c0df53036b346c747022a5..45c4397ddcc46ef329ded64fa11d8ac41f45083d 100644 --- a/tests/test_sym_field.cpp +++ b/tests/test_sym_field.cpp @@ -1,48 +1,48 @@ #include "sym_field.hpp" -int test_zp_zero(bn_st *N) { +int test_zp_zero(symPoint N) { symZp x = sym::zp_zero(N); return sym::zp_cmp_int(x, 0); } -int test_zp_one(bn_st *N) { +int test_zp_one(symPoint N) { symZp x = sym::zp_one(N); return sym::zp_cmp_int(x, 1); } -int test_zp_copy(bn_st *N) { +int test_zp_copy(symPoint N) { symZp x = sym::zp_from_int(10, N); symZp y = sym::zp_copy(x); return sym::zp_cmp(x, y); } -int test_zp_from_int(bn_st *N) { +int test_zp_from_int(symPoint N) { symZp x = sym::zp_from_int(3, N); return sym::zp_cmp_int(x, 3); } -int test_zp_add(bn_st *N) { +int test_zp_add(symPoint N) { symZp x = sym::zp_from_int(10, N); symZp y = sym::zp_from_int(20, N); symZp z = sym::zp_add(x, y); return sym::zp_cmp_int(z, 30); } -int test_zp_neg(bn_st *N) { +int test_zp_neg(symPoint N) { symZp x = sym::zp_rand(N); symZp y = sym::zp_neg(x); symZp z = sym::zp_add(x, y); return sym::zp_cmp_int(z, 0); } -int test_zp_mul(bn_st *N) { +int test_zp_mul(symPoint N) { symZp x = sym::zp_from_int(10, N); symZp y = sym::zp_from_int(20, N); symZp z = sym::zp_mul(x, y); return sym::zp_cmp_int(z, 200); } -int test_zp_inv(bn_st *N) { +int test_zp_inv(symPoint N) { symZp x = sym::zp_rand(N); symZp y = sym::zp_inv(x); symZp z = sym::zp_mul(x, y); diff --git a/tests/test_sym_group.cpp b/tests/test_sym_group.cpp index 04ae5bfcb894282b4d68f5743704c157cb04d7bb..6fa61be4ca8afd5718feed363d82fd6febc83b9b 100644 --- a/tests/test_sym_group.cpp +++ b/tests/test_sym_group.cpp @@ -6,7 +6,7 @@ int test_generator() { return g1_is_valid(x); } -int test_all(bn_st *N) { +int test_all(symPoint N) { // Set integers. symZp m = sym::zp_from_int(5, N); symZp n = sym::zp_from_int(25, N); @@ -20,8 +20,8 @@ int test_all(bn_st *N) { sym::g_mul(b, a, m); // Get e(symG, symG) and e(symG^5, symG^5). - sym::bp_map(a, a, x); - sym::bp_map(b, b, y); + sym::bp_map(x, a, a); + sym::bp_map(y, b, b); // Get e(symG, symG)^25. sym::gt_raise(z, x, n); diff --git a/tests/test_sym_matrix.cpp b/tests/test_sym_matrix.cpp index 45447a35c1c7702441bff27e46a9c1bc9e1a57d8..3822b11215e7c17aa54babc96a667b3c9003257e 100644 --- a/tests/test_sym_matrix.cpp +++ b/tests/test_sym_matrix.cpp @@ -1,25 +1,25 @@ #include "sym_matrix.hpp" -int test_zp_from_int(bn_st *N) { +int test_zp_from_int(symPoint N) { int int_mat[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; symZpMat x = sym::matrix_zp_from_int(int_mat, 3, 3, N); return sym::zp_cmp_int(x[8], 9); } -int test_transpose(bn_st *N) { +int test_transpose(symPoint N) { int row = 3, col = 3; symZpMat x = sym::matrix_zp_rand(row, col, N); symZpMat xt = sym::matrix_transpose(x, row, col); return sym::zp_cmp(xt[col - 1], x[2 * row]); } -int test_identity(bn_st *N) { +int test_identity(symPoint N) { int size = 10; symZpMat x = sym::matrix_identity(size, N); return sym::matrix_is_identity(x, size); } -int test_merge(bn_st *N) { +int test_merge(symPoint N) { int size = 10; symZpMat x = sym::matrix_zp_rand(size, size, N); symZpMat y = sym::matrix_identity(size, N); @@ -27,7 +27,7 @@ int test_merge(bn_st *N) { return sym::zp_cmp(x[2 * size + 1], xy[4 * size + 1]); } -int test_multiply_vector(bn_st *N) { +int test_multiply_vector(symPoint N) { int mat_x[5] = {1, 2, 3, 4, 5}; int mat_y[15] = { 10, 20, 30, @@ -43,7 +43,7 @@ int test_multiply_vector(bn_st *N) { return sym::zp_cmp_int(xy[2], 450); } -int test_inverse(bn_st *N) { +int test_inverse(symPoint N) { int size = 10; symZpMat x = sym::matrix_zp_rand(size, size, N); symZpMat xi = sym::matrix_inverse(x, size, N); diff --git a/tests/test_sym_vector.cpp b/tests/test_sym_vector.cpp index 50040bb4cd8b50c121001b8fe01e7c9c28789b4e..7873f3a06c8b5e63fa56dbc9e0e812fd43790333 100644 --- a/tests/test_sym_vector.cpp +++ b/tests/test_sym_vector.cpp @@ -1,12 +1,12 @@ #include "sym_vector.hpp" -int test_zp_from_int(bn_st *N) { +int test_zp_from_int(symPoint N) { int int_vec[4] = {1, 2, 3, 4}; symZpVec x = sym::vector_zp_from_int(int_vec, 4, N); return sym::zp_cmp_int(x[3], 4); } -int test_merge_vector(bn_st *N) { +int test_merge_vector(symPoint N) { int int_vec_x[3] = {1, 2, 3}; int int_vec_y[3] = {11, 22, 33}; symZpVec x = sym::vector_zp_from_int(int_vec_x, 3, N); @@ -15,7 +15,7 @@ int test_merge_vector(bn_st *N) { return sym::zp_cmp_int(z[5], 33); } -int test_add_vector(bn_st *N) { +int test_add_vector(symPoint N) { int int_vec_x[3] = {1, 2, 3}; int int_vec_y[3] = {11, 22, 33}; symZpVec x = sym::vector_zp_from_int(int_vec_x, 3, N); @@ -24,7 +24,7 @@ int test_add_vector(bn_st *N) { return sym::zp_cmp_int(z[2], 36); } -int test_inner_product(bn_st *N) { +int test_inner_product(symPoint N) { int int_vec_x[3] = {1, 2, 3}; int int_vec_y[3] = {4, 5, 6}; symZpVec x = sym::vector_zp_from_int(int_vec_x, 3, N); @@ -38,7 +38,7 @@ int test_inner_product(bn_st *N) { symGt b, r; sym::inner_product(r, gx, gy, 3); - sym::bp_map(base, base, b); + sym::bp_map(b, base, base); gt_exp_dig(b, b, 32); return gt_cmp(b, r);