mirror of
https://github.com/henrydcase/nobs.git
synced 2024-11-25 08:31:21 +00:00
Henry Case
a152c09fd5
* makes common reusable * exports some more symbols from common * remove kem for a moment
46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
// Code generated by go generate; DO NOT EDIT.
|
|
// This file was generated by robots.
|
|
|
|
// +build amd64,!noasm{{if .OPT_ARM}} arm64,!noasm{{end}}
|
|
|
|
package {{ .PACKAGE}}
|
|
|
|
import (
|
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
|
)
|
|
|
|
// 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
|
|
func cswap{{ .FIELD}}(x, y *Fp, choice uint8)
|
|
|
|
// Compute z = x + y (mod p).
|
|
//go:noescape
|
|
func add{{ .FIELD}}(z, x, y *Fp)
|
|
|
|
// Compute z = x - y (mod p).
|
|
//go:noescape
|
|
func sub{{ .FIELD}}(z, x, y *Fp)
|
|
|
|
// Compute z = x + y, without reducing mod p.
|
|
//go:noescape
|
|
func adl{{ .FIELD}}(z, x, y *FpX2)
|
|
|
|
// Compute z = x - y, without reducing mod p.
|
|
//go:noescape
|
|
func sul{{ .FIELD}}(z, x, y *FpX2)
|
|
|
|
// Reduce a field element in [0, 2*p) to one in [0,p).
|
|
//go:noescape
|
|
func mod{{ .FIELD}}(x *Fp)
|
|
|
|
// Computes z = x * y.
|
|
//go:noescape
|
|
func mul{{ .FIELD}}(z *FpX2, x, y *Fp)
|
|
|
|
// Computes the Montgomery reduction z = x R^{-1} (mod 2*p). On return value
|
|
// of x may be changed. z=x not allowed.
|
|
//go:noescape
|
|
func rdc{{ .FIELD}}(z *Fp, x *FpX2)
|