Skip to content

Commit 40efd5b

Browse files
committed
sphinx: add check for blinding point
When we are parsing onion messages, we must ensure that a blinding point is provided.
1 parent b03df13 commit 40efd5b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sphinx.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,13 @@ func (r *Router) ProcessOnionPacket(onionPkt *OnionPacket, assocData []byte,
622622
o(cfg)
623623
}
624624

625+
// If this is an onion message, a blinding point must be provided and
626+
// associated data must be nil.
627+
if cfg.isOnionMessage && cfg.blindingPoint == nil && assocData != nil {
628+
return nil, fmt.Errorf("blinding point must be provided for " +
629+
"onion messages, and associated data must be nil")
630+
}
631+
625632
// Compute the shared secret for this onion packet.
626633
sharedSecret, err := r.generateSharedSecret(
627634
onionPkt.EphemeralKey, cfg.blindingPoint,

0 commit comments

Comments
 (0)