pbc
pbc copied to clipboard
fix: z_from_bytes func signature error
When I build pbc lib on my Mac M2 Pro.
I got this error message:
arith/multiz.c:563:17: error: incompatible function pointer types assigning to 'int (*)(element_ptr, const unsigned char *)' (aka 'int (*)(struct element_s *, const unsigned char *)') from 'int (struct element_s *, unsigned char *)' [-Wincompatible-function-pointer-types]
f->from_bytes = z_from_bytes;
It seems that the signature of z_from_bytes in arith/multiz.c and arith/z.c did not match with the function pointer f->from_bytes's signature defined in include/pbc_field.h
Thus, I make the following changes to fix this:
- add const to z_from_bytes's data variable to match the function signature
- use temporary pointer
ptrto handle the neg operation
✅ Oh, FYI, all the test have passed on my laptop.
➜ pbc (master) ✗ ./test
make: Nothing to be done for `test'.
make: `pbc/pbc' is up to date.
[PASSED] pbc/pairing_test.pbc
[PASSED] pbc/g2_test.pbc
[PASSED] pbc/bilinear.test
[PASSED] guru/fp_test
[PASSED] guru/quadratic_test
[PASSED] guru/poly_test
[PASSED] guru/prodpairing_test
[PASSED] guru/ternary_extension_field_test
[PASSED] guru/eta_T_3_test
BTW, great thanks for all your contribution to cryptography. 🫡