github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/crypto/internal/nistec/fiat/p384.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 // P384Element is an integer modulo 2^384 - 2^128 - 2^96 + 2^32 - 1. 10 // 11 // The zero value is a valid zero element. 12 type P384Element struct { 13 // Values are represented internally always in the Montgomery domain, and 14 // converted in Bytes and SetBytes. 15 x p384MontgomeryDomainFieldElement 16 } 17 18 // One sets e = 1, and returns e. 19 func (e *P384Element) One() *P384Element 20 21 // Equal returns 1 if e == t, and zero otherwise. 22 func (e *P384Element) Equal(t *P384Element) int 23 24 // IsZero returns 1 if e == 0, and zero otherwise. 25 func (e *P384Element) IsZero() int 26 27 // Set sets e = t, and returns e. 28 func (e *P384Element) Set(t *P384Element) *P384Element 29 30 // Bytes returns the 48-byte big-endian encoding of e. 31 func (e *P384Element) Bytes() []byte 32 33 // SetBytes sets e = v, where v is a big-endian 48-byte encoding, and returns e. 34 // If v is not 48 bytes or it encodes a value higher than 2^384 - 2^128 - 2^96 + 2^32 - 1, 35 // SetBytes returns nil and an error, and e is unchanged. 36 func (e *P384Element) SetBytes(v []byte) (*P384Element, error) 37 38 // Add sets e = t1 + t2, and returns e. 39 func (e *P384Element) Add(t1, t2 *P384Element) *P384Element 40 41 // Sub sets e = t1 - t2, and returns e. 42 func (e *P384Element) Sub(t1, t2 *P384Element) *P384Element 43 44 // Mul sets e = t1 * t2, and returns e. 45 func (e *P384Element) Mul(t1, t2 *P384Element) *P384Element 46 47 // Square sets e = t * t, and returns e. 48 func (e *P384Element) Square(t *P384Element) *P384Element 49 50 // Select sets v to a if cond == 1, and to b if cond == 0. 51 func (v *P384Element) Select(a, b *P384Element, cond int) *P384Element