Skip to content

Commit a1ebe15

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 d48ed41 commit a1ebe15

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
@@ -601,6 +601,13 @@ func (r *Router) ProcessOnionPacket(onionPkt *OnionPacket, assocData []byte,
601601
o(cfg)
602602
}
603603

604+
// If this is an onion message, a blinding point must be provided and
605+
// associated data must be nil.
606+
if cfg.isOnionMessage && cfg.blindingPoint == nil && assocData != nil {
607+
return nil, fmt.Errorf("blinding point must be provided for " +
608+
"onion messages, and associated data must be nil")
609+
}
610+
604611
// Compute the shared secret for this onion packet.
605612
sharedSecret, err := r.generateSharedSecret(
606613
onionPkt.EphemeralKey, cfg.blindingPoint,

0 commit comments

Comments
 (0)