Bump reva to 85468735db
To get new GetUserNoGroups() helper
This commit is contained in:
+2
-1
@@ -1,4 +1,5 @@
|
||||
// +build amd64
|
||||
//go:build amd64 && !purego
|
||||
// +build amd64,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// +build amd64
|
||||
//go:build amd64 && !purego
|
||||
// +build amd64,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
|
||||
+7
-3
@@ -18,6 +18,9 @@ func (Curve) Identity() *Point {
|
||||
func (Curve) IsOnCurve(P *Point) bool {
|
||||
x2, y2, t, t2, z2 := &fp.Elt{}, &fp.Elt{}, &fp.Elt{}, &fp.Elt{}, &fp.Elt{}
|
||||
rhs, lhs := &fp.Elt{}, &fp.Elt{}
|
||||
// Check z != 0
|
||||
eq0 := !fp.IsZero(&P.z)
|
||||
|
||||
fp.Mul(t, &P.ta, &P.tb) // t = ta*tb
|
||||
fp.Sqr(x2, &P.x) // x^2
|
||||
fp.Sqr(y2, &P.y) // y^2
|
||||
@@ -27,13 +30,14 @@ func (Curve) IsOnCurve(P *Point) bool {
|
||||
fp.Mul(rhs, t2, ¶mD) // dt^2
|
||||
fp.Add(rhs, rhs, z2) // z^2 + dt^2
|
||||
fp.Sub(lhs, lhs, rhs) // x^2 + y^2 - (z^2 + dt^2)
|
||||
eq0 := fp.IsZero(lhs)
|
||||
eq1 := fp.IsZero(lhs)
|
||||
|
||||
fp.Mul(lhs, &P.x, &P.y) // xy
|
||||
fp.Mul(rhs, t, &P.z) // tz
|
||||
fp.Sub(lhs, lhs, rhs) // xy - tz
|
||||
eq1 := fp.IsZero(lhs)
|
||||
return eq0 && eq1
|
||||
eq2 := fp.IsZero(lhs)
|
||||
|
||||
return eq0 && eq1 && eq2
|
||||
}
|
||||
|
||||
// Generator returns the generator point.
|
||||
|
||||
+33
@@ -5,6 +5,8 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/crypto/cryptobyte"
|
||||
)
|
||||
|
||||
// BytesLe2Hex returns an hexadecimal string of a number stored in a
|
||||
@@ -138,3 +140,34 @@ func BigInt2Uint64Le(z []uint64, x *big.Int) {
|
||||
z[i] = 0
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalBinary encodes a value into a byte array in a format readable by UnmarshalBinary.
|
||||
func MarshalBinary(v cryptobyte.MarshalingValue) ([]byte, error) {
|
||||
const DefaultSize = 32
|
||||
b := cryptobyte.NewBuilder(make([]byte, 0, DefaultSize))
|
||||
b.AddValue(v)
|
||||
return b.Bytes()
|
||||
}
|
||||
|
||||
// MarshalBinaryLen encodes a value into an array of n bytes in a format readable by UnmarshalBinary.
|
||||
func MarshalBinaryLen(v cryptobyte.MarshalingValue, length uint) ([]byte, error) {
|
||||
b := cryptobyte.NewFixedBuilder(make([]byte, 0, length))
|
||||
b.AddValue(v)
|
||||
return b.Bytes()
|
||||
}
|
||||
|
||||
// A UnmarshalingValue decodes itself from a cryptobyte.String and advances the pointer.
|
||||
// It reports whether the read was successful.
|
||||
type UnmarshalingValue interface {
|
||||
Unmarshal(*cryptobyte.String) bool
|
||||
}
|
||||
|
||||
// UnmarshalBinary recovers a value from a byte array.
|
||||
// It returns an error if the read was unsuccessful.
|
||||
func UnmarshalBinary(v UnmarshalingValue, data []byte) (err error) {
|
||||
s := cryptobyte.String(data)
|
||||
if data == nil || !v.Unmarshal(&s) || !s.Empty() {
|
||||
err = fmt.Errorf("cannot read %T from input string", v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// +build amd64
|
||||
//go:build amd64 && !purego
|
||||
// +build amd64,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
#include "fp_amd64.h"
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// +build amd64
|
||||
//go:build amd64 && !purego
|
||||
// +build amd64,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
#include "fp_amd64.h"
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package math
|
||||
|
||||
import "math/bits"
|
||||
|
||||
// NextPow2 finds the next power of two (N=2^k, k>=0) greater than n.
|
||||
// If n is already a power of two, then this function returns n, and log2(n).
|
||||
func NextPow2(n uint) (N uint, k uint) {
|
||||
if bits.OnesCount(n) == 1 {
|
||||
k = uint(bits.TrailingZeros(n))
|
||||
N = n
|
||||
} else {
|
||||
k = uint(bits.Len(n))
|
||||
N = uint(1) << k
|
||||
}
|
||||
return
|
||||
}
|
||||
+1
-1
@@ -164,7 +164,7 @@ func (P *pointR1) isEqual(Q *pointR1) bool {
|
||||
fp.Mul(r, r, &P.z)
|
||||
fp.Sub(l, l, r)
|
||||
b = b && fp.IsZero(l)
|
||||
return b
|
||||
return b && !fp.IsZero(&P.z) && !fp.IsZero(&Q.z)
|
||||
}
|
||||
|
||||
func (P *pointR3) neg() {
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ func newKeyFromSeed(privateKey, seed []byte) {
|
||||
|
||||
func signAll(signature []byte, privateKey PrivateKey, message, ctx []byte, preHash bool) {
|
||||
if len(ctx) > ContextMaxSize {
|
||||
panic(fmt.Errorf("ed448: bad context length: " + strconv.Itoa(len(ctx))))
|
||||
panic(fmt.Errorf("ed448: bad context length: %v", len(ctx)))
|
||||
}
|
||||
|
||||
H := sha3.NewShake256()
|
||||
|
||||
+3
@@ -107,4 +107,7 @@ var (
|
||||
// ErrContextNotSupported is the error used if a context is not
|
||||
// supported.
|
||||
ErrContextNotSupported = errors.New("context not supported")
|
||||
|
||||
// ErrContextTooLong is the error used if the context string is too long.
|
||||
ErrContextTooLong = errors.New("context string too long")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user