1
0
mirror of https://github.com/libp2p/go-libp2p-core.git synced 2025-04-28 17:10:14 +08:00

Merge pull request from libp2p/fix/fallback-cmp

fix: use fallback comparison for ed25519 keys
This commit is contained in:
Steven Allen 2019-09-27 15:33:55 -07:00 committed by GitHub
commit 469ed581a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,7 +68,7 @@ func (k *Ed25519PrivateKey) pubKeyBytes() []byte {
func (k *Ed25519PrivateKey) Equals(o Key) bool {
edk, ok := o.(*Ed25519PrivateKey)
if !ok {
return false
return basicEquals(k, o)
}
return subtle.ConstantTimeCompare(k.k, edk.k) == 1
@ -103,7 +103,7 @@ func (k *Ed25519PublicKey) Raw() ([]byte, error) {
func (k *Ed25519PublicKey) Equals(o Key) bool {
edk, ok := o.(*Ed25519PublicKey)
if !ok {
return false
return basicEquals(k, o)
}
return bytes.Equal(k.k, edk.k)