You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The output when running on Ubuntu without cross-compiling:
x (set0) = 0
x (set1) = 1
x (add(set1, set1)) = 2
x (set_si 0x2) = 2
x (random seed=0x114514) = 627055856547974011506813785332492935521893207354
x (from_hash "Test data") = 481817657442947330395294957845829757162661110017
Running on Windows with cross-compiled binaries:
x (set0) = 0
x (set1) = 365375757781869456591985165927106086913303379970
x (add(set1, set1)) = 365375757781869456591985165927106086913303379971
x (set_si 0x2) = 365375757781869456591985165927106086913303379971
x (random seed=0x114514) = 704059715193577092360776882805714726779267438415
x (from_hash "Test data") = 269047460191534710553423228971153386492057830638
All of the assignment functions result in errors. The calculator and signature algorithms in the example also don't work. Someone on Stack Overflow seems to have encountered a similar problem.
This problem does not occur if the implementation of integer modulo ring used by pbc is changed to another implementation instead of the default Montgomery representation.
I don't know how to fix the implementation for now. A temporary fix is to add these lines to the code that uses pbc:
... or apply the patch before cross-compiling pbc:
--- arith/fp.c 2013-06-15 11:43:00.000000000 +0800+++ arith/fp.c 2023-08-07 23:17:39.271450800 +0800@@ -17,7 +17,11 @@
// By default, use the montfp.c implementation of F_p. After
// pbc_tweak_use_fp(), future field_init_fp calls will use the specified
// implementation. This is useful for benchmarking and testing.
+#ifdef __MINGW32__+static void (*option_fpinit) (field_ptr f, mpz_t prime) = field_init_faster_fp;+#else
static void (*option_fpinit) (field_ptr f, mpz_t prime) = field_init_mont_fp;
The text was updated successfully, but these errors were encountered:
I use mingw-w64 on Ubuntu 22.04 to cross-compile pbc to get 64-bit Windows binaries since only 32-bit binaries are provided on the homepage.
Build script
Then I found that these binaries always gives weird results. For example, for the following code:
The output when running on Ubuntu without cross-compiling:
Running on Windows with cross-compiled binaries:
All of the assignment functions result in errors. The calculator and signature algorithms in the example also don't work. Someone on Stack Overflow seems to have encountered a similar problem.
This problem does not occur if the implementation of integer modulo ring used by pbc is changed to another implementation instead of the default Montgomery representation.
I don't know how to fix the implementation for now. A temporary fix is to add these lines to the code that uses pbc:
... or apply the patch before cross-compiling pbc:
The text was updated successfully, but these errors were encountered: