mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
// Copyright 2024 Sun Yimin. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build (ppc64 || ppc64le) && !purego
|
|
|
|
package bn256
|
|
|
|
// Set c = p - a, if c == p, then c = 0
|
|
// It seems this function's performance is worse than gfpSub with zero.
|
|
//
|
|
//go:noescape
|
|
func gfpNegAsm(c, a *gfP)
|
|
|
|
// Set c = a + b, if c >= p, then c = c - p
|
|
//
|
|
//go:noescape
|
|
func gfpAddAsm(c, a, b *gfP)
|
|
|
|
// Set c = a + a
|
|
//
|
|
//go:noescape
|
|
func gfpDoubleAsm(c, a *gfP)
|
|
|
|
// Set c = a + a + a
|
|
//
|
|
//go:noescape
|
|
func gfpTripleAsm(c, a *gfP)
|
|
|
|
// Set c = a - b, if c is negative, then c = c + p
|
|
//
|
|
//go:noescape
|
|
func gfpSubAsm(c, a, b *gfP)
|
|
|
|
// Montgomery multiplication. Sets res = in1 * in2 * R⁻¹ mod p.
|
|
//
|
|
//go:noescape
|
|
func gfpMulAsm(c, a, b *gfP)
|
|
|
|
// Montgomery square, repeated n times (n >= 1).
|
|
//
|
|
//go:noescape
|
|
func gfpSqrAsm(res, in *gfP, n int)
|
|
|
|
// Marshal gfP into big endian form
|
|
//
|
|
//go:noescape
|
|
func gfpMarshalAsm(out *[32]byte, in *gfP)
|
|
|
|
// Unmarshal the bytes into little endian form
|
|
//
|
|
//go:noescape
|
|
func gfpUnmarshalAsm(out *gfP, in *[32]byte)
|