diff options
author | Wim <wim@42.be> | 2018-11-13 00:02:07 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-11-13 00:02:07 +0100 |
commit | f8dc24bc09fc1981637ac5c4a210780ac5512944 (patch) | |
tree | 0df78ce10744dbf3b25accdcb215a9b7b87b7e89 /vendor/golang.org/x/crypto/ed25519/internal | |
parent | e9419f10d3d24e24c9cedab93104c418f383782c (diff) | |
download | matterbridge-msglm-f8dc24bc09fc1981637ac5c4a210780ac5512944.tar.gz matterbridge-msglm-f8dc24bc09fc1981637ac5c4a210780ac5512944.tar.bz2 matterbridge-msglm-f8dc24bc09fc1981637ac5c4a210780ac5512944.zip |
Switch back go upstream bwmarrin/discordgo
Commit https://github.com/bwmarrin/discordgo/commit/ffa9956c9b41e8e2a10c26a254389854e016b006 got merged in.
Diffstat (limited to 'vendor/golang.org/x/crypto/ed25519/internal')
-rw-r--r-- | vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go b/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go index 5f8b9947..fd03c252 100644 --- a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go +++ b/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go @@ -4,6 +4,8 @@ package edwards25519 +import "encoding/binary" + // This code is a port of the public domain, “ref10” implementation of ed25519 // from SUPERCOP. @@ -1769,3 +1771,23 @@ func ScReduce(out *[32]byte, s *[64]byte) { out[30] = byte(s11 >> 9) out[31] = byte(s11 >> 17) } + +// order is the order of Curve25519 in little-endian form. +var order = [4]uint64{0x5812631a5cf5d3ed, 0x14def9dea2f79cd6, 0, 0x1000000000000000} + +// ScMinimal returns true if the given scalar is less than the order of the +// curve. +func ScMinimal(scalar *[32]byte) bool { + for i := 3; ; i-- { + v := binary.LittleEndian.Uint64(scalar[i*8:]) + if v > order[i] { + return false + } else if v < order[i] { + break + } else if i == 0 { + return false + } + } + + return true +} |