Skip to content

Commit

Permalink
CCIP-4710: Adding nil and length check on input value to Ed25519 veri…
Browse files Browse the repository at this point in the history
…fy call
  • Loading branch information
b-gopalswami committed Dec 20, 2024
1 parent 428f005 commit 01dbd80
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions commit/merkleroot/rmn/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ func verifyObservationSignature(
msg := append([]byte(signedObservationPrefix), observationBytesSha256[:]...)
msgSha256 := sha256.Sum256(msg)

if rmnNode.OffchainPublicKey == nil {
return fmt.Errorf("node %d has no offchain public key", rmnNode.ID)
}
if len(*rmnNode.OffchainPublicKey) != ed25519.PublicKeySize {
return fmt.Errorf("node %d has an invalid offchain public key", rmnNode.ID)
}
isValid := verifier.Verify(*rmnNode.OffchainPublicKey, msgSha256[:], signedObs.Signature)
if !isValid {
return fmt.Errorf("observation signature does not match node %d public key", rmnNode.ID)
Expand Down

0 comments on commit 01dbd80

Please sign in to comment.