Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: z_from_bytes func signature error #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Summer-Field
Copy link

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:

  1. add const to z_from_bytes's data variable to match the function signature
  2. use temporary pointer ptr to handle the neg operation

1. add const to z_from_bytes's data variable
@Summer-Field
Copy link
Author

✅ 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. 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant