diff options
Diffstat (limited to 'libgo/go/crypto/elliptic/p256_s390x.go')
-rw-r--r-- | libgo/go/crypto/elliptic/p256_s390x.go | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/libgo/go/crypto/elliptic/p256_s390x.go b/libgo/go/crypto/elliptic/p256_s390x.go index 43e19e93274..40c0929cd0e 100644 --- a/libgo/go/crypto/elliptic/p256_s390x.go +++ b/libgo/go/crypto/elliptic/p256_s390x.go @@ -9,7 +9,14 @@ package elliptic import ( "crypto/subtle" + "internal/cpu" "math/big" + "unsafe" +) + +const ( + offsetS390xHasVX = unsafe.Offsetof(cpu.S390X.HasVX) + offsetS390xHasVE1 = unsafe.Offsetof(cpu.S390X.HasVE1) ) type p256CurveFast struct { @@ -27,14 +34,26 @@ var ( p256PreFast *[37][64]p256Point ) -// hasVectorFacility reports whether the machine has the z/Architecture -// vector facility installed and enabled. -func hasVectorFacility() bool +//go:noescape +func p256MulInternalTrampolineSetup() + +//go:noescape +func p256SqrInternalTrampolineSetup() + +//go:noescape +func p256MulInternalVX() + +//go:noescape +func p256MulInternalVMSL() -var hasVX = hasVectorFacility() +//go:noescape +func p256SqrInternalVX() + +//go:noescape +func p256SqrInternalVMSL() func initP256Arch() { - if hasVX { + if cpu.S390X.HasVX { p256 = p256CurveFast{p256Params} initTable() return @@ -53,11 +72,14 @@ func (curve p256CurveFast) Params() *CurveParams { // Montgomery multiplication modulo P256 // //go:noescape +func p256SqrAsm(res, in1 []byte) + +//go:noescape func p256MulAsm(res, in1, in2 []byte) // Montgomery square modulo P256 func p256Sqr(res, in []byte) { - p256MulAsm(res, in, in) + p256SqrAsm(res, in) } // Montgomery multiplication by 1 |