securityopensslcryptographygmpcharm

SystemError occurs when adding and subtracting elements on GT in Charm-crypto lib


Code show as below:

from charm.toolbox.pairinggroup import PairingGroup, ZR, G1, G2, GT, pair
groupObj = PairingGroup('MNT224') 
gt = groupObj.random(GT)
g2 = groupObj.random(GT)
result = gt -g2

Env: Linux ubuntu22.04 , charm-crypt 0.5, python3.10, libgmp5.1, openssl1.0, ide is vscode.

The error message is as follows:

Traceback (most recent call last):
  File "/home/x/ex/scheme.py", line 284, in <module>
    main()
  File "/home/x/ex/scheme.py", line 252, in main
    gt - g2
SystemError: error return without exception set

Solution

  • PBC Library Manual:The GT group is currently implemented as a subgroup of a finite field, so only multiplicative operations should be used for GT.(From: https://crypto.stanford.edu/pbc/manual/ch04s04.html)

    So, Charm also can't support this operation.

    enter image description here