1
0
mirror of https://github.com/henrydcase/nobs.git synced 2024-11-22 23:28:57 +00:00
nobs/dh/sidh/p503/arith_decl.go

47 lines
1.2 KiB
Go
Raw Permalink Normal View History

// +build amd64,!noasm arm64,!noasm
2018-07-23 23:18:38 +01:00
package p503
import (
. "github.com/henrydcase/nobs/dh/sidh/internal/isogeny"
)
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
func fp503ConditionalSwap(x, y *FpElement, choice uint8)
2018-07-23 23:18:38 +01:00
// Compute z = x + y (mod p).
//go:noescape
func fp503AddReduced(z, x, y *FpElement)
2018-07-23 23:18:38 +01:00
// Compute z = x - y (mod p).
//go:noescape
func fp503SubReduced(z, x, y *FpElement)
2018-07-23 23:18:38 +01:00
// Compute z = x + y, without reducing mod p.
//go:noescape
func fp503AddLazy(z, x, y *FpElement)
2018-07-23 23:18:38 +01:00
// Compute z = x + y, without reducing mod p.
//go:noescape
func fp503X2AddLazy(z, x, y *FpElementX2)
2018-07-23 23:18:38 +01:00
// Compute z = x - y, without reducing mod p.
//go:noescape
func fp503X2SubLazy(z, x, y *FpElementX2)
2018-07-23 23:18:38 +01:00
// Reduce a field element in [0, 2*p) to one in [0,p).
2018-07-23 23:18:38 +01:00
//go:noescape
func fp503StrongReduce(x *FpElement)
2018-07-23 23:18:38 +01:00
// Computes z = x * y.
2018-07-23 23:18:38 +01:00
//go:noescape
func fp503Mul(z *FpElementX2, x, y *FpElement)
2018-07-23 23:18:38 +01: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
func fp503MontgomeryReduce(z *FpElement, x *FpElementX2)