github.com/cloudflare/circl@v1.5.0/ecc/fourq/fq_generic.go (about) 1 package fourq 2 3 func fqAddGeneric(c, a, b *Fq) { 4 fpAddGeneric(&c[0], &a[0], &b[0]) 5 fpAddGeneric(&c[1], &a[1], &b[1]) 6 } 7 8 func fqSubGeneric(c, a, b *Fq) { 9 fpSubGeneric(&c[0], &a[0], &b[0]) 10 fpSubGeneric(&c[1], &a[1], &b[1]) 11 } 12 13 func fqMulGeneric(c, a, b *Fq) { 14 var a0b0, a0b1, a1b0, a1b1 Fp 15 fpMulGeneric(&a0b0, &a[0], &b[0]) 16 fpMulGeneric(&a0b1, &a[0], &b[1]) 17 fpMulGeneric(&a1b0, &a[1], &b[0]) 18 fpMulGeneric(&a1b1, &a[1], &b[1]) 19 fpSubGeneric(&c[0], &a0b0, &a1b1) 20 fpAddGeneric(&c[1], &a0b1, &a1b0) 21 } 22 23 func fqSqrGeneric(c, a *Fq) { 24 var aa0, a01, aa1 Fp 25 fpSqrGeneric(&aa0, &a[0]) 26 fpMulGeneric(&a01, &a[0], &a[1]) 27 fpSqrGeneric(&aa1, &a[1]) 28 fpSubGeneric(&c[0], &aa0, &aa1) 29 fpAddGeneric(&c[1], &a01, &a01) 30 }