Closed vusirikala closed 3 years ago
I was also trying to get Charm to work with the current version of Relic and was running into similar errors. It looks like most of them are name changes to macros in Relic that weren't changed in Charm's interface and there were a few function names in Charms that conflicted with new function names in Relic.
I attempted to fix these myself and seem to have done something that works since I can now load the Relic curves using Charm. Here's what I did
in /charm/core/math/pairing/relic/pairingmodule3.c
I changed line 115 from
bn_size_str(&size, x, 2);
to
size = bn_size_str(x, 2);
In /charm/core/math/pairing/relic/relic_interface.h
, I added some additional macros around the block in lines 59-62. I changed it from
#define FP_STR FP_BYTES * 2 + 1
#define G1_LEN (FP_BYTES * 2) + 2
#define G2_LEN (FP_BYTES * 4) + 4
#define GT_LEN (FP_BYTES * 12) + 12
to
#define FP_BYTES RLC_FP_BYTES
#define FP_STR FP_BYTES * 2 + 1
#define G1_LEN (FP_BYTES * 2) + 2
#define G2_LEN (FP_BYTES * 4) + 4
#define GT_LEN (FP_BYTES * 12) + 12
#define BN_NEG RLC_NEG
#define BN_POS RLC_POS
#define STS_OK RLC_OK
#define G1_TABLE RLC_G1_TABLE
#define G2_TABLE RLC_G2_TABLE
#define CMP_GT RLC_GT
#define CMP_EQ RLC_EQ
#define BN_BYTES (RLC_BN_DIGS * sizeof(dig_t))
#define fp_write fp_write_str
relic_interface.h
and relic_interface.c
, I added charm_
as a prefix to the functions g1_read_bin, g1_write_bin, g2_read_bin, g2_write_bin, gt_read_bin, gt_write_bin
Yeah, Relic update is overdue. Thanks for your changes @friedrichsenm! Would appreciate a PR so others can benefit.
There are at least a few things that are still not working appropriately. For example serialization/deserialization of points in the pairing groups. I'll take a look when I can, but likely won't have time in the near future to attempt a fix.
I tried to run charm using current version of RELIC. There seems to be some code change in RELIC that is not reflected in charm. Here's the error I obtain when trying to compile charm.