Description
Looks like the target groups of the pairings are defined from fields via typedef
directives.
See here for eg:
https://github.com/scipr-lab/libff/blob/master/libff/algebra/curves/mnt/mnt4/mnt4_init.hpp#L39
This means that all public members of the underlying field type are accessible via any variable of type GT_type
.
This fails to account for the structural differences of the algebraic structures (G_T is a group defined as the multiplicative subgroup of a field (F_{q^k} in the example above, where the embedding degree = 4))
I think defining the target groups as classes that would be "wrappers" around the appropriate methods of the underlying field would be clearer, and would remove the possibility to access the public members of the field class from the group elements.
Something like:
class mnt4_GT {
public:
mnt4_Fq4 element;
mnt4_GT();
mnt4_GT(const my_Fp2& c0, const my_Fp2& c1) : element(c0, c1) {};
// The group is defined via wrappers around the relevant methods of the field it is "extracted from"
mnt4_GT operator*(const mnt4_GT &other) const { return this->element * other.element; }
....
Happy to open a PR later on to take care of that if you agree that this would be worth doing.