Skip to content

Commit

Permalink
fixup: openssl
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire authored and Stebalien committed Aug 1, 2019
1 parent 5915b53 commit e64c956
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions core/crypto/openssl_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package crypto

import (
"bytes"

pb "github.com/libp2p/go-libp2p-core/crypto/pb"

openssl "github.com/spacemonkeygo/openssl"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

0 comments on commit e64c956

Please sign in to comment.