nistec
packagestandard libraryThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package nistec implements the elliptic curves from NIST SP 800-186.
This package uses fiat-crypto or specialized assembly and Go code for itsbackend field arithmetic (not math/big) and exposes constant-time, heapallocation-free, byte slice-based safe APIs. Group operations use modern andsafe complete addition formulas where possible. The point at infinity ishandled and encoded according to SEC 1, Version 2.0, and invalid curve pointscan't be represented.
Index¶
- func P256OrdInverse(k []byte) ([]byte, error)
- type P224Point
- func (q *P224Point) Add(p1, p2 *P224Point) *P224Point
- func (p *P224Point) Bytes() []byte
- func (p *P224Point) BytesCompressed() []byte
- func (p *P224Point) BytesX() ([]byte, error)
- func (q *P224Point) Double(p *P224Point) *P224Point
- func (p *P224Point) ScalarBaseMult(scalar []byte) (*P224Point, error)
- func (p *P224Point) ScalarMult(q *P224Point, scalar []byte) (*P224Point, error)
- func (q *P224Point) Select(p1, p2 *P224Point, cond int) *P224Point
- func (p *P224Point) Set(q *P224Point) *P224Point
- func (p *P224Point) SetBytes(b []byte) (*P224Point, error)
- func (p *P224Point) SetGenerator() *P224Point
- type P256Point
- func (q *P256Point) Add(r1, r2 *P256Point) *P256Point
- func (p *P256Point) Bytes() []byte
- func (p *P256Point) BytesCompressed() []byte
- func (p *P256Point) BytesX() ([]byte, error)
- func (q *P256Point) Double(p *P256Point) *P256Point
- func (r *P256Point) ScalarBaseMult(scalar []byte) (*P256Point, error)
- func (r *P256Point) ScalarMult(q *P256Point, scalar []byte) (*P256Point, error)
- func (q *P256Point) Select(p1, p2 *P256Point, cond int) *P256Point
- func (p *P256Point) Set(q *P256Point) *P256Point
- func (p *P256Point) SetBytes(b []byte) (*P256Point, error)
- func (p *P256Point) SetGenerator() *P256Point
- type P384Point
- func (q *P384Point) Add(p1, p2 *P384Point) *P384Point
- func (p *P384Point) Bytes() []byte
- func (p *P384Point) BytesCompressed() []byte
- func (p *P384Point) BytesX() ([]byte, error)
- func (q *P384Point) Double(p *P384Point) *P384Point
- func (p *P384Point) ScalarBaseMult(scalar []byte) (*P384Point, error)
- func (p *P384Point) ScalarMult(q *P384Point, scalar []byte) (*P384Point, error)
- func (q *P384Point) Select(p1, p2 *P384Point, cond int) *P384Point
- func (p *P384Point) Set(q *P384Point) *P384Point
- func (p *P384Point) SetBytes(b []byte) (*P384Point, error)
- func (p *P384Point) SetGenerator() *P384Point
- type P521Point
- func (q *P521Point) Add(p1, p2 *P521Point) *P521Point
- func (p *P521Point) Bytes() []byte
- func (p *P521Point) BytesCompressed() []byte
- func (p *P521Point) BytesX() ([]byte, error)
- func (q *P521Point) Double(p *P521Point) *P521Point
- func (p *P521Point) ScalarBaseMult(scalar []byte) (*P521Point, error)
- func (p *P521Point) ScalarMult(q *P521Point, scalar []byte) (*P521Point, error)
- func (q *P521Point) Select(p1, p2 *P521Point, cond int) *P521Point
- func (p *P521Point) Set(q *P521Point) *P521Point
- func (p *P521Point) SetBytes(b []byte) (*P521Point, error)
- func (p *P521Point) SetGenerator() *P521Point
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcP256OrdInverse¶
Types¶
typeP224Point¶
type P224Point struct {// contains filtered or unexported fields}P224Point is a P224 point. The zero value is NOT valid.
funcNewP224Point¶
func NewP224Point() *P224Point
NewP224Point returns a new P224Point representing the point at infinity point.
func (*P224Point)Bytes¶
Bytes returns the uncompressed or infinity encoding of p, as specified inSEC 1, Version 2.0, Section 2.3.3. Note that the encoding of the point atinfinity is shorter than all other encodings.
func (*P224Point)BytesCompressed¶
BytesCompressed returns the compressed or infinity encoding of p, asspecified in SEC 1, Version 2.0, Section 2.3.3. Note that the encoding of thepoint at infinity is shorter than all other encodings.
func (*P224Point)BytesX¶
BytesX returns the encoding of the x-coordinate of p, as specified in SEC 1,Version 2.0, Section 2.3.5, or an error if p is the point at infinity.
func (*P224Point)ScalarBaseMult¶
ScalarBaseMult sets p = scalar * B, where B is the canonical generator, andreturns p.
func (*P224Point)ScalarMult¶
ScalarMult sets p = scalar * q, and returns p.
func (*P224Point)SetBytes¶
SetBytes sets p to the compressed, uncompressed, or infinity value encoded inb, as specified in SEC 1, Version 2.0, Section 2.3.4. If the point is not onthe curve, it returns nil and an error, and the receiver is unchanged.Otherwise, it returns p.
func (*P224Point)SetGenerator¶
SetGenerator sets p to the canonical generator and returns p.
typeP256Point¶
type P256Point struct {// contains filtered or unexported fields}P256Point is a P-256 point. The zero value should not be assumed to be valid(although it is in this implementation).
funcNewP256Point¶
func NewP256Point() *P256Point
NewP256Point returns a new P256Point representing the point at infinity.
func (*P256Point)Bytes¶
Bytes returns the uncompressed or infinity encoding of p, as specified inSEC 1, Version 2.0, Section 2.3.3. Note that the encoding of the point atinfinity is shorter than all other encodings.
func (*P256Point)BytesCompressed¶
BytesCompressed returns the compressed or infinity encoding of p, asspecified in SEC 1, Version 2.0, Section 2.3.3. Note that the encoding of thepoint at infinity is shorter than all other encodings.
func (*P256Point)BytesX¶
BytesX returns the encoding of the x-coordinate of p, as specified in SEC 1,Version 2.0, Section 2.3.5, or an error if p is the point at infinity.
func (*P256Point)ScalarBaseMult¶
ScalarBaseMult sets r = scalar * generator, where scalar is a 32-byte bigendian value, and returns r. If scalar is not 32 bytes long, ScalarBaseMultreturns an error and the receiver is unchanged.
func (*P256Point)ScalarMult¶
ScalarMult sets r = scalar * q, where scalar is a 32-byte big endian value,and returns r. If scalar is not 32 bytes long, ScalarBaseMult returns anerror and the receiver is unchanged.
func (*P256Point)SetBytes¶
SetBytes sets p to the compressed, uncompressed, or infinity value encoded inb, as specified in SEC 1, Version 2.0, Section 2.3.4. If the point is not onthe curve, it returns nil and an error, and the receiver is unchanged.Otherwise, it returns p.
func (*P256Point)SetGenerator¶
SetGenerator sets p to the canonical generator and returns p.
typeP384Point¶
type P384Point struct {// contains filtered or unexported fields}P384Point is a P384 point. The zero value is NOT valid.
funcNewP384Point¶
func NewP384Point() *P384Point
NewP384Point returns a new P384Point representing the point at infinity point.
func (*P384Point)Bytes¶
Bytes returns the uncompressed or infinity encoding of p, as specified inSEC 1, Version 2.0, Section 2.3.3. Note that the encoding of the point atinfinity is shorter than all other encodings.
func (*P384Point)BytesCompressed¶
BytesCompressed returns the compressed or infinity encoding of p, asspecified in SEC 1, Version 2.0, Section 2.3.3. Note that the encoding of thepoint at infinity is shorter than all other encodings.
func (*P384Point)BytesX¶
BytesX returns the encoding of the x-coordinate of p, as specified in SEC 1,Version 2.0, Section 2.3.5, or an error if p is the point at infinity.
func (*P384Point)ScalarBaseMult¶
ScalarBaseMult sets p = scalar * B, where B is the canonical generator, andreturns p.
func (*P384Point)ScalarMult¶
ScalarMult sets p = scalar * q, and returns p.
func (*P384Point)SetBytes¶
SetBytes sets p to the compressed, uncompressed, or infinity value encoded inb, as specified in SEC 1, Version 2.0, Section 2.3.4. If the point is not onthe curve, it returns nil and an error, and the receiver is unchanged.Otherwise, it returns p.
func (*P384Point)SetGenerator¶
SetGenerator sets p to the canonical generator and returns p.
typeP521Point¶
type P521Point struct {// contains filtered or unexported fields}P521Point is a P521 point. The zero value is NOT valid.
funcNewP521Point¶
func NewP521Point() *P521Point
NewP521Point returns a new P521Point representing the point at infinity point.
func (*P521Point)Bytes¶
Bytes returns the uncompressed or infinity encoding of p, as specified inSEC 1, Version 2.0, Section 2.3.3. Note that the encoding of the point atinfinity is shorter than all other encodings.
func (*P521Point)BytesCompressed¶
BytesCompressed returns the compressed or infinity encoding of p, asspecified in SEC 1, Version 2.0, Section 2.3.3. Note that the encoding of thepoint at infinity is shorter than all other encodings.
func (*P521Point)BytesX¶
BytesX returns the encoding of the x-coordinate of p, as specified in SEC 1,Version 2.0, Section 2.3.5, or an error if p is the point at infinity.
func (*P521Point)ScalarBaseMult¶
ScalarBaseMult sets p = scalar * B, where B is the canonical generator, andreturns p.
func (*P521Point)ScalarMult¶
ScalarMult sets p = scalar * q, and returns p.
func (*P521Point)SetBytes¶
SetBytes sets p to the compressed, uncompressed, or infinity value encoded inb, as specified in SEC 1, Version 2.0, Section 2.3.4. If the point is not onthe curve, it returns nil and an error, and the receiver is unchanged.Otherwise, it returns p.
func (*P521Point)SetGenerator¶
SetGenerator sets p to the canonical generator and returns p.