github.com/cloudflare/circl@v1.5.0/dh/sidh/internal/templates/arith_decl.gotemp (about) 1 // Code generated by go generate; DO NOT EDIT. 2 // This file was generated by robots. 3 4 //go:build {{if .OPT_ARM}}({{end}}amd64 && !purego{{if .OPT_ARM}}) || (arm64 && !purego){{end}} 5 // +build amd64,!purego{{if .OPT_ARM}} arm64,!purego{{end}} 6 7 package {{.PACKAGE}} 8 9 import ( 10 . "github.com/cloudflare/circl/dh/sidh/internal/common" 11 ) 12 13 // If choice = 0, leave x unchanged. If choice = 1, sets x to y. 14 // If choice is neither 0 nor 1 then behaviour is undefined. 15 // This function executes in constant time. 16 // 17 //go:noescape 18 func cmov{{.FIELD}}(x, y *Fp, choice uint8) 19 20 // If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x. 21 // If choice is neither 0 nor 1 then behaviour is undefined. 22 // This function executes in constant time. 23 // 24 //go:noescape 25 func cswap{{.FIELD}}(x, y *Fp, choice uint8) 26 27 // Compute z = x + y (mod p). 28 // 29 //go:noescape 30 func add{{.FIELD}}(z, x, y *Fp) 31 32 // Compute z = x - y (mod p). 33 // 34 //go:noescape 35 func sub{{.FIELD}}(z, x, y *Fp) 36 37 // Compute z = x + y, without reducing mod p. 38 // 39 //go:noescape 40 func adl{{.FIELD}}(z, x, y *FpX2) 41 42 // Compute z = x - y, without reducing mod p. 43 // 44 //go:noescape 45 func sul{{.FIELD}}(z, x, y *FpX2) 46 47 // Reduce a field element in [0, 2*p) to one in [0,p). 48 // 49 //go:noescape 50 func mod{{.FIELD}}(x *Fp) 51 52 // Computes z = x * y. 53 // 54 //go:noescape 55 func mul{{.FIELD}}(z *FpX2, x, y *Fp) 56 57 // Computes the Montgomery reduction z = x R^{-1} (mod 2*p). On return value 58 // of x may be changed. z=x not allowed. 59 // 60 //go:noescape 61 func rdc{{.FIELD}}(z *Fp, x *FpX2)