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