Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit 96972fe

Browse files
fixup: openssl
1 parent d64c748 commit 96972fe

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

crypto/openssl_common.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
package crypto
44

55
import (
6+
"bytes"
7+
68
pb "github.com/libp2p/go-libp2p-core/crypto/pb"
79

810
openssl "github.com/spacemonkeygo/openssl"
@@ -61,7 +63,15 @@ func (pk *opensslPublicKey) Raw() ([]byte, error) {
6163

6264
// Equals checks whether this key is equal to another
6365
func (pk *opensslPublicKey) Equals(k Key) bool {
64-
return KeyEqual(pk, k)
66+
a, err := pk.Raw()
67+
if err != nil {
68+
return false
69+
}
70+
b, err := k.Raw()
71+
if err != nil {
72+
return false
73+
}
74+
return bytes.Equal(a, b)
6575
}
6676

6777
// Sign returns a signature of the input data
@@ -94,5 +104,13 @@ func (sk *opensslPrivateKey) Raw() ([]byte, error) {
94104

95105
// Equals checks whether this key is equal to another
96106
func (sk *opensslPrivateKey) Equals(k Key) bool {
97-
return KeyEqual(sk, k)
107+
a, err := sk.Raw()
108+
if err != nil {
109+
return false
110+
}
111+
b, err := k.Raw()
112+
if err != nil {
113+
return false
114+
}
115+
return bytes.Equal(a, b)
98116
}

0 commit comments

Comments
 (0)