You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
conn.Write(noises) // make client do new handshake
188
188
returnnil, errors.New("expired ticket")
189
189
}
190
-
if_, replay:=s.Replays.LoadOrStore([32]byte(nfsKey), true); replay { // prevents bad client also
190
+
if_, loaded:=s.NfsKeys.LoadOrStore([32]byte(nfsKey), true); loaded { // prevents bad client also
191
191
returnnil, errors.New("replay detected")
192
192
}
193
-
c.UnitedKey=append(s.PfsKey, nfsKey...) // the same nfsKey links the upload & download
194
-
c.PreWrite=make([]byte, 16)// always trust yourself, not the client
195
-
rand.Read(c.PreWrite)
193
+
c.UnitedKey=append(s.PfsKey, nfsKey...) // the same nfsKey links the upload & download (prevents server -> client's another request)
194
+
c.PreWrite=make([]byte, 16)
195
+
rand.Read(c.PreWrite)// always trust yourself, not the client (also prevents being parsed as TLS thus causing false interruption for "native" and "xorpub")
196
196
c.GCM=NewGCM(c.PreWrite, c.UnitedKey)
197
-
c.PeerGCM=NewGCM(encryptedTicket, c.UnitedKey) // unchangeable ctx, and different ctx length for upload / download
197
+
c.PeerGCM=NewGCM(encryptedTicket, c.UnitedKey) // unchangeable ctx (prevents server -> server), and different ctx length for upload / download (prevents client -> client)
198
198
ifi.XorMode==2 {
199
199
c.Conn=NewXorConn(conn, NewCTR(c.UnitedKey, c.PreWrite), NewCTR(c.UnitedKey, iv), 16, 0) // it doesn't matter if the attacker sends client's iv back to the client
200
200
}
201
201
returnc, nil
202
202
}
203
203
204
-
iflength<1184+32+16 { // client may send more public keys
204
+
iflength<1184+32+16 { // client may send more public keys in the future's version
0 commit comments