mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-23 18:16:50 +08:00
Use nfsAEAD & pfsAEAD for paddings; Refine comments
https://github.com/XTLS/Xray-core/pull/4952#issuecomment-3210125349
373558ed7a (r164355865)
This commit is contained in:
@@ -57,7 +57,7 @@ func NewXorConn(conn net.Conn, mode uint32, pKey *ecdh.PublicKey, sKey *ecdh.Pri
|
||||
if pKey != nil {
|
||||
c.head = make([]byte, 16+32)
|
||||
rand.Read(c.head)
|
||||
eSKey, _ := ecdh.X25519().GenerateKey(rand.Reader)
|
||||
eSKey, _ := ecdh.X25519().NewPrivateKey(c.head[16:])
|
||||
NewCTR(pKey.Bytes(), c.head[:16], false).XORKeyStream(c.head[16:], eSKey.PublicKey().Bytes()) // make X25519 public key distinguishable from random bytes
|
||||
c.key, _ = eSKey.ECDH(pKey)
|
||||
c.ctr = NewCTR(c.key, c.head[:16], false)
|
||||
|
Reference in New Issue
Block a user