@@ -81,6 +81,7 @@ func (cs *ConnectionState) Decrypt(l *slog.Logger, messageCounter uint64, out []
8181 return out , nil
8282}
8383
84+ // VerifyRelay verifies AEAD protected (but not encrypted) relay frames. packet must be length-checked by the caller.
8485func (cs * ConnectionState ) VerifyRelay (l * slog.Logger , messageCounter uint64 , packet []byte , nb []byte ) error {
8586 cs .decryptLock .Lock ()
8687 result := cs .window .Check (l , messageCounter )
@@ -89,15 +90,9 @@ func (cs *ConnectionState) VerifyRelay(l *slog.Logger, messageCounter uint64, pa
8990 return ErrAlreadySeen
9091 }
9192
92- // The entire body is sent as AD, not encrypted.
93- // The packet consists of a 16-byte parsed Nebula header, Associated Data-protected payload, and a trailing 16-byte AEAD signature value.
94- // The packet is guaranteed to be at least 16 bytes at this point, b/c it got past the h.Parse() call above. If it's
95- // otherwise malformed (meaning, there is no trailing 16 byte AEAD value), then this will result in at worst a 0-length slice
96- // which will gracefully fail in the DecryptDanger call.
9793 signedPayload := packet [:len (packet )- cs .dKey .Overhead ()]
9894 signatureValue := packet [len (packet )- cs .dKey .Overhead ():]
99- var err error
100- _ , err = cs .dKey .DecryptDanger (nil , signedPayload , signatureValue , messageCounter , nb )
95+ _ , err := cs .dKey .DecryptDanger (nil , signedPayload , signatureValue , messageCounter , nb )
10196 if err != nil {
10297 return err
10398 }
0 commit comments