github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/crypto/internal/nistec/fiat/p256.go (about)

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated by generate.go. DO NOT EDIT.
     6  
     7  package fiat
     8  
     9  // P256Element is an integer modulo 2^256 - 2^224 + 2^192 + 2^96 - 1.
    10  //
    11  // The zero value is a valid zero element.
    12  type P256Element struct {
    13  	// Values are represented internally always in the Montgomery domain, and
    14  	// converted in Bytes and SetBytes.
    15  	x p256MontgomeryDomainFieldElement
    16  }
    17  
    18  // One sets e = 1, and returns e.
    19  func (e *P256Element) One() *P256Element
    20  
    21  // Equal returns 1 if e == t, and zero otherwise.
    22  func (e *P256Element) Equal(t *P256Element) int
    23  
    24  // IsZero returns 1 if e == 0, and zero otherwise.
    25  func (e *P256Element) IsZero() int
    26  
    27  // Set sets e = t, and returns e.
    28  func (e *P256Element) Set(t *P256Element) *P256Element
    29  
    30  // Bytes returns the 32-byte big-endian encoding of e.
    31  func (e *P256Element) Bytes() []byte
    32  
    33  // SetBytes sets e = v, where v is a big-endian 32-byte encoding, and returns e.
    34  // If v is not 32 bytes or it encodes a value higher than 2^256 - 2^224 + 2^192 + 2^96 - 1,
    35  // SetBytes returns nil and an error, and e is unchanged.
    36  func (e *P256Element) SetBytes(v []byte) (*P256Element, error)
    37  
    38  // Add sets e = t1 + t2, and returns e.
    39  func (e *P256Element) Add(t1, t2 *P256Element) *P256Element
    40  
    41  // Sub sets e = t1 - t2, and returns e.
    42  func (e *P256Element) Sub(t1, t2 *P256Element) *P256Element
    43  
    44  // Mul sets e = t1 * t2, and returns e.
    45  func (e *P256Element) Mul(t1, t2 *P256Element) *P256Element
    46  
    47  // Square sets e = t * t, and returns e.
    48  func (e *P256Element) Square(t *P256Element) *P256Element
    49  
    50  // Select sets v to a if cond == 1, and to b if cond == 0.
    51  func (v *P256Element) Select(a, b *P256Element, cond int) *P256Element