From 96972fee3a8e6326482e578171ff597c05dde705 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Fri, 28 Jun 2019 12:35:29 +0200 Subject: [PATCH] fixup: openssl --- crypto/openssl_common.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/crypto/openssl_common.go b/crypto/openssl_common.go index f235e75f..06c458af 100644 --- a/crypto/openssl_common.go +++ b/crypto/openssl_common.go @@ -3,6 +3,8 @@ package crypto import ( + "bytes" + pb "github.com/libp2p/go-libp2p-core/crypto/pb" openssl "github.com/spacemonkeygo/openssl" @@ -61,7 +63,15 @@ func (pk *opensslPublicKey) Raw() ([]byte, error) { // Equals checks whether this key is equal to another func (pk *opensslPublicKey) Equals(k Key) bool { - return KeyEqual(pk, k) + a, err := pk.Raw() + if err != nil { + return false + } + b, err := k.Raw() + if err != nil { + return false + } + return bytes.Equal(a, b) } // Sign returns a signature of the input data @@ -94,5 +104,13 @@ func (sk *opensslPrivateKey) Raw() ([]byte, error) { // Equals checks whether this key is equal to another func (sk *opensslPrivateKey) Equals(k Key) bool { - return KeyEqual(sk, k) + a, err := sk.Raw() + if err != nil { + return false + } + b, err := k.Raw() + if err != nil { + return false + } + return bytes.Equal(a, b) }