github.com/cloudflare/circl@v1.5.0/ecc/p384/p384.go (about)

     1  package p384
     2  
     3  import (
     4  	"crypto/elliptic"
     5  	"math/big"
     6  )
     7  
     8  // Curve is used to provide the extended functionality and performance of
     9  // elliptic.Curve interface.
    10  type Curve interface {
    11  	elliptic.Curve
    12  	// IsAtInfinity returns True is the point is the identity point.
    13  	IsAtInfinity(X, Y *big.Int) bool
    14  	// CombinedMult calculates P=mG+nQ, where G is the generator and
    15  	// Q=(Qx,Qy). The scalars m and n are positive integers in big-endian form.
    16  	// Runs in non-constant time to be used in signature verification.
    17  	CombinedMult(Qx, Qy *big.Int, m, n []byte) (Px, Py *big.Int)
    18  }
    19  
    20  // Params returns the parameters for the curve. Note: The value returned by
    21  // this function fallbacks to the stdlib implementation of elliptic curve
    22  // operations. Use this method to only recover elliptic curve parameters.
    23  func (c curve) Params() *elliptic.CurveParams { return elliptic.P384().Params() }
    24  
    25  // IsAtInfinity returns True is the point is the identity point.
    26  func (c curve) IsAtInfinity(x, y *big.Int) bool {
    27  	return x.Sign() == 0 && y.Sign() == 0
    28  }