bplib
bplib copied to clipboard
OpenSSL changed "BN_zero" causing error
Hi, when I try to install bplib on Ubuntu 22.04, I get this error:
bplib/src/bp_fp2.c: In function ‘FP2_zero’:
bplib/src/bp_fp2.c:111:9: error: invalid use of void expression
111 | if (!BN_zero(a->f[0]) || !BN_zero(a->f[1]))
| ^
bplib/src/bp_fp2.c:111:30: error: invalid use of void expression
111 | if (!BN_zero(a->f[0]) || !BN_zero(a->f[1]))
| ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
[end of output]
I searched for this problem online and it seems that OpenSSL changed the behavior of BN_zero
which no longer returns a success integer. They essentially changed BN_zero
to do what BN_zero_ex
used to do.
For an ultra quick fix I changed the following and it seems to work:
index 6d7d1c7..062dd32 100644
--- a/bplib/src/bp_fp2.c
+++ b/bplib/src/bp_fp2.c
@@ -108,8 +108,9 @@ void FP2_clear_free(FP2 *a)
int FP2_zero(FP2 *a)
{
- if (!BN_zero(a->f[0]) || !BN_zero(a->f[1]))
- return 0;
+ BN_zero(a->f[0]);
+ BN_zero(a->f[1]);
+
return 1;
}