Merge pull request #6687 from thaJeztah/bump_crypto
vendor: golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd
This commit is contained in:
		
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @@ -64,7 +64,7 @@ require ( | |||||||
| 	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0 | 	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0 | ||||||
| 	go.opentelemetry.io/otel/sdk v1.3.0 | 	go.opentelemetry.io/otel/sdk v1.3.0 | ||||||
| 	go.opentelemetry.io/otel/trace v1.3.0 | 	go.opentelemetry.io/otel/trace v1.3.0 | ||||||
| 	golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect | 	golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect | ||||||
| 	golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect | 	golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect | ||||||
| 	golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect | 	golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect | ||||||
| 	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c | 	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								go.sum
									
									
									
									
									
								
							| @@ -729,8 +729,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh | |||||||
| golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | ||||||
| golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | ||||||
| golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= | golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= | ||||||
| golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= | golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38= | ||||||
| golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= | ||||||
| golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | ||||||
| golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | ||||||
| golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= | ||||||
| @@ -812,6 +812,7 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT | |||||||
| golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
| golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
| golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
|  | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
| golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
| golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM= | golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM= | ||||||
| golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
|   | |||||||
| @@ -675,7 +675,7 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh | |||||||
| golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | ||||||
| golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | ||||||
| golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= | golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= | ||||||
| golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= | ||||||
| golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | ||||||
| golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | ||||||
| golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= | ||||||
| @@ -759,6 +759,7 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT | |||||||
| golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
| golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
| golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
|  | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
| golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
| golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM= | golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM= | ||||||
| golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
|   | |||||||
							
								
								
									
										188
									
								
								vendor/golang.org/x/crypto/ed25519/ed25519.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										188
									
								
								vendor/golang.org/x/crypto/ed25519/ed25519.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,13 +1,7 @@ | |||||||
| // Copyright 2016 The Go Authors. All rights reserved. | // Copyright 2019 The Go Authors. All rights reserved. | ||||||
| // Use of this source code is governed by a BSD-style | // Use of this source code is governed by a BSD-style | ||||||
| // license that can be found in the LICENSE file. | // license that can be found in the LICENSE file. | ||||||
|  |  | ||||||
| // In Go 1.13, the ed25519 package was promoted to the standard library as |  | ||||||
| // crypto/ed25519, and this package became a wrapper for the standard library one. |  | ||||||
| // |  | ||||||
| //go:build !go1.13 |  | ||||||
| // +build !go1.13 |  | ||||||
|  |  | ||||||
| // Package ed25519 implements the Ed25519 signature algorithm. See | // Package ed25519 implements the Ed25519 signature algorithm. See | ||||||
| // https://ed25519.cr.yp.to/. | // https://ed25519.cr.yp.to/. | ||||||
| // | // | ||||||
| @@ -16,21 +10,15 @@ | |||||||
| // representation includes a public key suffix to make multiple signing | // representation includes a public key suffix to make multiple signing | ||||||
| // operations with the same key more efficient. This package refers to the RFC | // operations with the same key more efficient. This package refers to the RFC | ||||||
| // 8032 private key as the “seed”. | // 8032 private key as the “seed”. | ||||||
|  | // | ||||||
|  | // Beginning with Go 1.13, the functionality of this package was moved to the | ||||||
|  | // standard library as crypto/ed25519. This package only acts as a compatibility | ||||||
|  | // wrapper. | ||||||
| package ed25519 | package ed25519 | ||||||
|  |  | ||||||
| // This code is a port of the public domain, “ref10” implementation of ed25519 |  | ||||||
| // from SUPERCOP. |  | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"bytes" | 	"crypto/ed25519" | ||||||
| 	"crypto" |  | ||||||
| 	cryptorand "crypto/rand" |  | ||||||
| 	"crypto/sha512" |  | ||||||
| 	"errors" |  | ||||||
| 	"io" | 	"io" | ||||||
| 	"strconv" |  | ||||||
|  |  | ||||||
| 	"golang.org/x/crypto/ed25519/internal/edwards25519" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| @@ -45,57 +33,21 @@ const ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| // PublicKey is the type of Ed25519 public keys. | // PublicKey is the type of Ed25519 public keys. | ||||||
| type PublicKey []byte | // | ||||||
|  | // This type is an alias for crypto/ed25519's PublicKey type. | ||||||
|  | // See the crypto/ed25519 package for the methods on this type. | ||||||
|  | type PublicKey = ed25519.PublicKey | ||||||
|  |  | ||||||
| // PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer. | // PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer. | ||||||
| type PrivateKey []byte | // | ||||||
|  | // This type is an alias for crypto/ed25519's PrivateKey type. | ||||||
| // Public returns the PublicKey corresponding to priv. | // See the crypto/ed25519 package for the methods on this type. | ||||||
| func (priv PrivateKey) Public() crypto.PublicKey { | type PrivateKey = ed25519.PrivateKey | ||||||
| 	publicKey := make([]byte, PublicKeySize) |  | ||||||
| 	copy(publicKey, priv[32:]) |  | ||||||
| 	return PublicKey(publicKey) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // Seed returns the private key seed corresponding to priv. It is provided for |  | ||||||
| // interoperability with RFC 8032. RFC 8032's private keys correspond to seeds |  | ||||||
| // in this package. |  | ||||||
| func (priv PrivateKey) Seed() []byte { |  | ||||||
| 	seed := make([]byte, SeedSize) |  | ||||||
| 	copy(seed, priv[:32]) |  | ||||||
| 	return seed |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // Sign signs the given message with priv. |  | ||||||
| // Ed25519 performs two passes over messages to be signed and therefore cannot |  | ||||||
| // handle pre-hashed messages. Thus opts.HashFunc() must return zero to |  | ||||||
| // indicate the message hasn't been hashed. This can be achieved by passing |  | ||||||
| // crypto.Hash(0) as the value for opts. |  | ||||||
| func (priv PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error) { |  | ||||||
| 	if opts.HashFunc() != crypto.Hash(0) { |  | ||||||
| 		return nil, errors.New("ed25519: cannot sign hashed message") |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return Sign(priv, message), nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // GenerateKey generates a public/private key pair using entropy from rand. | // GenerateKey generates a public/private key pair using entropy from rand. | ||||||
| // If rand is nil, crypto/rand.Reader will be used. | // If rand is nil, crypto/rand.Reader will be used. | ||||||
| func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) { | func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) { | ||||||
| 	if rand == nil { | 	return ed25519.GenerateKey(rand) | ||||||
| 		rand = cryptorand.Reader |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	seed := make([]byte, SeedSize) |  | ||||||
| 	if _, err := io.ReadFull(rand, seed); err != nil { |  | ||||||
| 		return nil, nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	privateKey := NewKeyFromSeed(seed) |  | ||||||
| 	publicKey := make([]byte, PublicKeySize) |  | ||||||
| 	copy(publicKey, privateKey[32:]) |  | ||||||
|  |  | ||||||
| 	return publicKey, privateKey, nil |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // NewKeyFromSeed calculates a private key from a seed. It will panic if | // NewKeyFromSeed calculates a private key from a seed. It will panic if | ||||||
| @@ -103,121 +55,17 @@ func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) { | |||||||
| // with RFC 8032. RFC 8032's private keys correspond to seeds in this | // with RFC 8032. RFC 8032's private keys correspond to seeds in this | ||||||
| // package. | // package. | ||||||
| func NewKeyFromSeed(seed []byte) PrivateKey { | func NewKeyFromSeed(seed []byte) PrivateKey { | ||||||
| 	if l := len(seed); l != SeedSize { | 	return ed25519.NewKeyFromSeed(seed) | ||||||
| 		panic("ed25519: bad seed length: " + strconv.Itoa(l)) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	digest := sha512.Sum512(seed) |  | ||||||
| 	digest[0] &= 248 |  | ||||||
| 	digest[31] &= 127 |  | ||||||
| 	digest[31] |= 64 |  | ||||||
|  |  | ||||||
| 	var A edwards25519.ExtendedGroupElement |  | ||||||
| 	var hBytes [32]byte |  | ||||||
| 	copy(hBytes[:], digest[:]) |  | ||||||
| 	edwards25519.GeScalarMultBase(&A, &hBytes) |  | ||||||
| 	var publicKeyBytes [32]byte |  | ||||||
| 	A.ToBytes(&publicKeyBytes) |  | ||||||
|  |  | ||||||
| 	privateKey := make([]byte, PrivateKeySize) |  | ||||||
| 	copy(privateKey, seed) |  | ||||||
| 	copy(privateKey[32:], publicKeyBytes[:]) |  | ||||||
|  |  | ||||||
| 	return privateKey |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // Sign signs the message with privateKey and returns a signature. It will | // Sign signs the message with privateKey and returns a signature. It will | ||||||
| // panic if len(privateKey) is not PrivateKeySize. | // panic if len(privateKey) is not PrivateKeySize. | ||||||
| func Sign(privateKey PrivateKey, message []byte) []byte { | func Sign(privateKey PrivateKey, message []byte) []byte { | ||||||
| 	if l := len(privateKey); l != PrivateKeySize { | 	return ed25519.Sign(privateKey, message) | ||||||
| 		panic("ed25519: bad private key length: " + strconv.Itoa(l)) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	h := sha512.New() |  | ||||||
| 	h.Write(privateKey[:32]) |  | ||||||
|  |  | ||||||
| 	var digest1, messageDigest, hramDigest [64]byte |  | ||||||
| 	var expandedSecretKey [32]byte |  | ||||||
| 	h.Sum(digest1[:0]) |  | ||||||
| 	copy(expandedSecretKey[:], digest1[:]) |  | ||||||
| 	expandedSecretKey[0] &= 248 |  | ||||||
| 	expandedSecretKey[31] &= 63 |  | ||||||
| 	expandedSecretKey[31] |= 64 |  | ||||||
|  |  | ||||||
| 	h.Reset() |  | ||||||
| 	h.Write(digest1[32:]) |  | ||||||
| 	h.Write(message) |  | ||||||
| 	h.Sum(messageDigest[:0]) |  | ||||||
|  |  | ||||||
| 	var messageDigestReduced [32]byte |  | ||||||
| 	edwards25519.ScReduce(&messageDigestReduced, &messageDigest) |  | ||||||
| 	var R edwards25519.ExtendedGroupElement |  | ||||||
| 	edwards25519.GeScalarMultBase(&R, &messageDigestReduced) |  | ||||||
|  |  | ||||||
| 	var encodedR [32]byte |  | ||||||
| 	R.ToBytes(&encodedR) |  | ||||||
|  |  | ||||||
| 	h.Reset() |  | ||||||
| 	h.Write(encodedR[:]) |  | ||||||
| 	h.Write(privateKey[32:]) |  | ||||||
| 	h.Write(message) |  | ||||||
| 	h.Sum(hramDigest[:0]) |  | ||||||
| 	var hramDigestReduced [32]byte |  | ||||||
| 	edwards25519.ScReduce(&hramDigestReduced, &hramDigest) |  | ||||||
|  |  | ||||||
| 	var s [32]byte |  | ||||||
| 	edwards25519.ScMulAdd(&s, &hramDigestReduced, &expandedSecretKey, &messageDigestReduced) |  | ||||||
|  |  | ||||||
| 	signature := make([]byte, SignatureSize) |  | ||||||
| 	copy(signature[:], encodedR[:]) |  | ||||||
| 	copy(signature[32:], s[:]) |  | ||||||
|  |  | ||||||
| 	return signature |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // Verify reports whether sig is a valid signature of message by publicKey. It | // Verify reports whether sig is a valid signature of message by publicKey. It | ||||||
| // will panic if len(publicKey) is not PublicKeySize. | // will panic if len(publicKey) is not PublicKeySize. | ||||||
| func Verify(publicKey PublicKey, message, sig []byte) bool { | func Verify(publicKey PublicKey, message, sig []byte) bool { | ||||||
| 	if l := len(publicKey); l != PublicKeySize { | 	return ed25519.Verify(publicKey, message, sig) | ||||||
| 		panic("ed25519: bad public key length: " + strconv.Itoa(l)) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if len(sig) != SignatureSize || sig[63]&224 != 0 { |  | ||||||
| 		return false |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	var A edwards25519.ExtendedGroupElement |  | ||||||
| 	var publicKeyBytes [32]byte |  | ||||||
| 	copy(publicKeyBytes[:], publicKey) |  | ||||||
| 	if !A.FromBytes(&publicKeyBytes) { |  | ||||||
| 		return false |  | ||||||
| 	} |  | ||||||
| 	edwards25519.FeNeg(&A.X, &A.X) |  | ||||||
| 	edwards25519.FeNeg(&A.T, &A.T) |  | ||||||
|  |  | ||||||
| 	h := sha512.New() |  | ||||||
| 	h.Write(sig[:32]) |  | ||||||
| 	h.Write(publicKey[:]) |  | ||||||
| 	h.Write(message) |  | ||||||
| 	var digest [64]byte |  | ||||||
| 	h.Sum(digest[:0]) |  | ||||||
|  |  | ||||||
| 	var hReduced [32]byte |  | ||||||
| 	edwards25519.ScReduce(&hReduced, &digest) |  | ||||||
|  |  | ||||||
| 	var R edwards25519.ProjectiveGroupElement |  | ||||||
| 	var s [32]byte |  | ||||||
| 	copy(s[:], sig[32:]) |  | ||||||
|  |  | ||||||
| 	// https://tools.ietf.org/html/rfc8032#section-5.1.7 requires that s be in |  | ||||||
| 	// the range [0, order) in order to prevent signature malleability. |  | ||||||
| 	if !edwards25519.ScMinimal(&s) { |  | ||||||
| 		return false |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	edwards25519.GeDoubleScalarMultVartime(&R, &hReduced, &A, &s) |  | ||||||
|  |  | ||||||
| 	var checkR [32]byte |  | ||||||
| 	R.ToBytes(&checkR) |  | ||||||
| 	return bytes.Equal(sig[:32], checkR[:]) |  | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										74
									
								
								vendor/golang.org/x/crypto/ed25519/ed25519_go113.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										74
									
								
								vendor/golang.org/x/crypto/ed25519/ed25519_go113.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,74 +0,0 @@ | |||||||
| // Copyright 2019 The Go Authors. All rights reserved. |  | ||||||
| // Use of this source code is governed by a BSD-style |  | ||||||
| // license that can be found in the LICENSE file. |  | ||||||
|  |  | ||||||
| //go:build go1.13 |  | ||||||
| // +build go1.13 |  | ||||||
|  |  | ||||||
| // Package ed25519 implements the Ed25519 signature algorithm. See |  | ||||||
| // https://ed25519.cr.yp.to/. |  | ||||||
| // |  | ||||||
| // These functions are also compatible with the “Ed25519” function defined in |  | ||||||
| // RFC 8032. However, unlike RFC 8032's formulation, this package's private key |  | ||||||
| // representation includes a public key suffix to make multiple signing |  | ||||||
| // operations with the same key more efficient. This package refers to the RFC |  | ||||||
| // 8032 private key as the “seed”. |  | ||||||
| // |  | ||||||
| // Beginning with Go 1.13, the functionality of this package was moved to the |  | ||||||
| // standard library as crypto/ed25519. This package only acts as a compatibility |  | ||||||
| // wrapper. |  | ||||||
| package ed25519 |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"crypto/ed25519" |  | ||||||
| 	"io" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| const ( |  | ||||||
| 	// PublicKeySize is the size, in bytes, of public keys as used in this package. |  | ||||||
| 	PublicKeySize = 32 |  | ||||||
| 	// PrivateKeySize is the size, in bytes, of private keys as used in this package. |  | ||||||
| 	PrivateKeySize = 64 |  | ||||||
| 	// SignatureSize is the size, in bytes, of signatures generated and verified by this package. |  | ||||||
| 	SignatureSize = 64 |  | ||||||
| 	// SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032. |  | ||||||
| 	SeedSize = 32 |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| // PublicKey is the type of Ed25519 public keys. |  | ||||||
| // |  | ||||||
| // This type is an alias for crypto/ed25519's PublicKey type. |  | ||||||
| // See the crypto/ed25519 package for the methods on this type. |  | ||||||
| type PublicKey = ed25519.PublicKey |  | ||||||
|  |  | ||||||
| // PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer. |  | ||||||
| // |  | ||||||
| // This type is an alias for crypto/ed25519's PrivateKey type. |  | ||||||
| // See the crypto/ed25519 package for the methods on this type. |  | ||||||
| type PrivateKey = ed25519.PrivateKey |  | ||||||
|  |  | ||||||
| // GenerateKey generates a public/private key pair using entropy from rand. |  | ||||||
| // If rand is nil, crypto/rand.Reader will be used. |  | ||||||
| func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) { |  | ||||||
| 	return ed25519.GenerateKey(rand) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // NewKeyFromSeed calculates a private key from a seed. It will panic if |  | ||||||
| // len(seed) is not SeedSize. This function is provided for interoperability |  | ||||||
| // with RFC 8032. RFC 8032's private keys correspond to seeds in this |  | ||||||
| // package. |  | ||||||
| func NewKeyFromSeed(seed []byte) PrivateKey { |  | ||||||
| 	return ed25519.NewKeyFromSeed(seed) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // Sign signs the message with privateKey and returns a signature. It will |  | ||||||
| // panic if len(privateKey) is not PrivateKeySize. |  | ||||||
| func Sign(privateKey PrivateKey, message []byte) []byte { |  | ||||||
| 	return ed25519.Sign(privateKey, message) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // Verify reports whether sig is a valid signature of message by publicKey. It |  | ||||||
| // will panic if len(publicKey) is not PublicKeySize. |  | ||||||
| func Verify(publicKey PublicKey, message, sig []byte) bool { |  | ||||||
| 	return ed25519.Verify(publicKey, message, sig) |  | ||||||
| } |  | ||||||
							
								
								
									
										1422
									
								
								vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1422
									
								
								vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1793
									
								
								vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1793
									
								
								vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -424,11 +424,10 @@ go.opentelemetry.io/proto/otlp/collector/trace/v1 | |||||||
| go.opentelemetry.io/proto/otlp/common/v1 | go.opentelemetry.io/proto/otlp/common/v1 | ||||||
| go.opentelemetry.io/proto/otlp/resource/v1 | go.opentelemetry.io/proto/otlp/resource/v1 | ||||||
| go.opentelemetry.io/proto/otlp/trace/v1 | go.opentelemetry.io/proto/otlp/trace/v1 | ||||||
| # golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 | # golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd | ||||||
| ## explicit | ## explicit | ||||||
| golang.org/x/crypto/cast5 | golang.org/x/crypto/cast5 | ||||||
| golang.org/x/crypto/ed25519 | golang.org/x/crypto/ed25519 | ||||||
| golang.org/x/crypto/ed25519/internal/edwards25519 |  | ||||||
| golang.org/x/crypto/openpgp | golang.org/x/crypto/openpgp | ||||||
| golang.org/x/crypto/openpgp/armor | golang.org/x/crypto/openpgp/armor | ||||||
| golang.org/x/crypto/openpgp/elgamal | golang.org/x/crypto/openpgp/elgamal | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Akihiro Suda
					Akihiro Suda