Fix bad check

This commit is contained in:
Neil Alexander 2020-05-09 12:49:02 +01:00
parent 2a2ad76479
commit f70b2ebcea
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -103,7 +103,7 @@ func (l *link) call(uri string, sintf string) error {
if pubkeys, ok := u.Query()["curve25519"]; ok && len(pubkeys) > 0 { if pubkeys, ok := u.Query()["curve25519"]; ok && len(pubkeys) > 0 {
tcpOpts.pinnedCurve25519Keys = make(map[crypto.BoxPubKey]struct{}) tcpOpts.pinnedCurve25519Keys = make(map[crypto.BoxPubKey]struct{})
for _, pubkey := range pubkeys { for _, pubkey := range pubkeys {
if boxPub, err := hex.DecodeString(pubkey); err != nil { if boxPub, err := hex.DecodeString(pubkey); err == nil {
var boxPubKey crypto.BoxPubKey var boxPubKey crypto.BoxPubKey
copy(boxPubKey[:], boxPub) copy(boxPubKey[:], boxPub)
tcpOpts.pinnedCurve25519Keys[boxPubKey] = struct{}{} tcpOpts.pinnedCurve25519Keys[boxPubKey] = struct{}{}
@ -113,7 +113,7 @@ func (l *link) call(uri string, sintf string) error {
if pubkeys, ok := u.Query()["ed25519"]; ok && len(pubkeys) > 0 { if pubkeys, ok := u.Query()["ed25519"]; ok && len(pubkeys) > 0 {
tcpOpts.pinnedEd25519Keys = make(map[crypto.SigPubKey]struct{}) tcpOpts.pinnedEd25519Keys = make(map[crypto.SigPubKey]struct{})
for _, pubkey := range pubkeys { for _, pubkey := range pubkeys {
if sigPub, err := hex.DecodeString(pubkey); err != nil { if sigPub, err := hex.DecodeString(pubkey); err == nil {
var sigPubKey crypto.SigPubKey var sigPubKey crypto.SigPubKey
copy(sigPubKey[:], sigPub) copy(sigPubKey[:], sigPub)
tcpOpts.pinnedEd25519Keys[sigPubKey] = struct{}{} tcpOpts.pinnedEd25519Keys[sigPubKey] = struct{}{}