Skip to content
Snippets Groups Projects
Commit d677798b authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

Merge branch 'hotfix/disableNodeSigsOnWASM' into 'project/Channels'

Disable node signature checking when using WASM.

See merge request !417
parents ff780cd3 088629fd
No related branches found
No related tags found
4 merge requests!510Release,!419rewrote the health tracker to both consider if there are waiting rounds and...,!417Disable node signature checking when using WASM.,!340Project/channels
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
package nodes package nodes
import ( import (
"io"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/pkg/errors" "github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
...@@ -27,7 +29,6 @@ import ( ...@@ -27,7 +29,6 @@ import (
"gitlab.com/xx_network/crypto/tls" "gitlab.com/xx_network/crypto/tls"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/netTime" "gitlab.com/xx_network/primitives/netTime"
"io"
) )
// requestKey is a helper function which constructs a ClientKeyRequest message. // requestKey is a helper function which constructs a ClientKeyRequest message.
...@@ -184,7 +185,7 @@ func processRequestResponse(signedKeyResponse *pb.SignedKeyResponse, ...@@ -184,7 +185,7 @@ func processRequestResponse(signedKeyResponse *pb.SignedKeyResponse,
} }
// Verify the response signature // Verify the response signature
err = rsa.Verify(nodePubKey, opts.Hash, hashedResponse, err = verifyNodeSignature(nodePubKey, opts.Hash, hashedResponse,
signedKeyResponse.KeyResponseSignedByGateway.Signature, opts) signedKeyResponse.KeyResponseSignedByGateway.Signature, opts)
if err != nil { if err != nil {
return nil, nil, 0, return nil, nil, 0,
......
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2022 xx foundation //
// //
// Use of this source code is governed by a license that can be found in the //
// LICENSE file. //
////////////////////////////////////////////////////////////////////////////////
//go:build !js || !wasm
package nodes
import (
"crypto"
"gitlab.com/xx_network/crypto/signature/rsa"
)
func verifyNodeSignature(pub *rsa.PublicKey, hash crypto.Hash,
hashed []byte, sig []byte, opts *rsa.Options) error {
// Verify the response signature
return rsa.Verify(pub, hash, hashed, sig, opts)
}
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2022 xx foundation //
// //
// Use of this source code is governed by a license that can be found in the //
// LICENSE file. //
////////////////////////////////////////////////////////////////////////////////
//go:build js && wasm
package nodes
import (
"crypto"
"gitlab.com/xx_network/crypto/signature/rsa"
)
func verifyNodeSignature(pub *rsa.PublicKey, hash crypto.Hash,
hashed []byte, sig []byte, opts *rsa.Options) error {
jww.WARN.Printf("node signature checking disabled for wasm")
return nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment