2020-05-14 01:02:32 +01:00
|
|
|
// Code generated by go generate; DO NOT EDIT.
|
|
|
|
// This file was generated by robots.
|
2018-07-23 23:18:38 +01:00
|
|
|
|
2020-05-14 01:02:32 +01:00
|
|
|
// +build amd64,!noasm{{if .OPT_ARM}} arm64,!noasm{{end}}
|
|
|
|
|
|
|
|
package {{ .PACKAGE}}
|
2018-09-11 12:02:29 +01:00
|
|
|
|
|
|
|
import (
|
2020-05-14 01:02:32 +01:00
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
2018-09-11 12:02:29 +01:00
|
|
|
)
|
2018-07-23 23:18:38 +01:00
|
|
|
|
|
|
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x.
|
|
|
|
// If choice is neither 0 nor 1 then behaviour is undefined.
|
|
|
|
// This function executes in constant time.
|
|
|
|
//go:noescape
|
2020-05-14 01:02:32 +01:00
|
|
|
func cswap{{ .FIELD}}(x, y *Fp, choice uint8)
|
2018-07-23 23:18:38 +01:00
|
|
|
|
|
|
|
// Compute z = x + y (mod p).
|
|
|
|
//go:noescape
|
2020-05-14 01:02:32 +01:00
|
|
|
func add{{ .FIELD}}(z, x, y *Fp)
|
2018-07-23 23:18:38 +01:00
|
|
|
|
|
|
|
// Compute z = x - y (mod p).
|
|
|
|
//go:noescape
|
2020-05-14 01:02:32 +01:00
|
|
|
func sub{{ .FIELD}}(z, x, y *Fp)
|
2018-07-23 23:18:38 +01:00
|
|
|
|
|
|
|
// Compute z = x + y, without reducing mod p.
|
|
|
|
//go:noescape
|
2020-05-14 01:02:32 +01:00
|
|
|
func adl{{ .FIELD}}(z, x, y *FpX2)
|
2018-07-23 23:18:38 +01:00
|
|
|
|
|
|
|
// Compute z = x - y, without reducing mod p.
|
|
|
|
//go:noescape
|
2020-05-14 01:02:32 +01:00
|
|
|
func sul{{ .FIELD}}(z, x, y *FpX2)
|
2018-07-23 23:18:38 +01:00
|
|
|
|
2018-12-03 23:07:01 +00:00
|
|
|
// Reduce a field element in [0, 2*p) to one in [0,p).
|
2018-07-23 23:18:38 +01:00
|
|
|
//go:noescape
|
2020-05-14 01:02:32 +01:00
|
|
|
func mod{{ .FIELD}}(x *Fp)
|
2018-07-23 23:18:38 +01:00
|
|
|
|
2018-12-03 23:07:01 +00:00
|
|
|
// Computes z = x * y.
|
2018-07-23 23:18:38 +01:00
|
|
|
//go:noescape
|
2020-05-14 01:02:32 +01:00
|
|
|
func mul{{ .FIELD}}(z *FpX2, x, y *Fp)
|
2018-07-23 23:18:38 +01:00
|
|
|
|
2018-12-03 23:07:01 +00:00
|
|
|
// Computes the Montgomery reduction z = x R^{-1} (mod 2*p). On return value
|
|
|
|
// of x may be changed. z=x not allowed.
|
2018-07-23 23:18:38 +01:00
|
|
|
//go:noescape
|
2020-05-14 01:02:32 +01:00
|
|
|
func rdc{{ .FIELD}}(z *Fp, x *FpX2)
|