void fp12_inv(fp12_t c, fp12_t a) { fp6_t t0; fp6_t t1; fp6_null(t0); fp6_null(t1); TRY { fp6_new(t0); fp6_new(t1); fp6_sqr(t0, a[0]); fp6_sqr(t1, a[1]); fp6_mul_art(t1, t1); fp6_sub(t0, t0, t1); fp6_inv(t0, t0); fp6_mul(c[0], a[0], t0); fp6_neg(c[1], a[1]); fp6_mul(c[1], c[1], t0); } CATCH_ANY { THROW(ERR_CAUGHT); } FINALLY { fp6_free(t0); fp6_free(t1); } }
void fp18_neg(fp18_t c, fp18_t a) { fp6_neg(c[0], a[0]); fp6_neg(c[1], a[1]); fp6_neg(c[2], a[2]); }
void fp12_neg(fp12_t c, fp12_t a) { fp6_neg(c[0], a[0]); fp6_neg(c[1], a[1]); }
void fp12_inv_uni(fp12_t c, fp12_t a) { /* In this case, it's a simple conjugate. */ fp6_copy(c[0], a[0]); fp6_neg(c[1], a[1]); }