From 4df2ec9a5b47f44f3d3714f81caba9b390727232 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Fri, 16 May 2025 07:07:13 +0000 Subject: [PATCH] REALITY protocol: Remove ChaCha20-Poly1305 support for REALITY's session id auth https://github.com/XTLS/Xray-core/pull/3813#issuecomment-2885686468 https://github.com/XTLS/REALITY/pull/4#issuecomment-2885815235 Reverts https://github.com/XTLS/REALITY/commit/e07c3b04b98322bb369e3b3ee5ced7e27803d0c9 --- tls.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tls.go b/tls.go index 1261b04..6d1829c 100644 --- a/tls.go +++ b/tls.go @@ -30,7 +30,6 @@ import ( "bytes" "context" "crypto" - "crypto/cipher" "crypto/ecdsa" "crypto/ed25519" "crypto/mlkem" @@ -50,7 +49,6 @@ import ( "time" "github.com/pires/go-proxyproto" - "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/curve25519" "golang.org/x/crypto/hkdf" @@ -190,13 +188,8 @@ func Server(ctx context.Context, conn net.Conn, config *Config) (*Conn, error) { if _, err = hkdf.New(sha256.New, hs.c.AuthKey, hs.clientHello.random[:20], []byte("REALITY")).Read(hs.c.AuthKey); err != nil { break } - var aead cipher.AEAD - if isAESGCMPreferred(hs.clientHello.cipherSuites) { - block, _ := fipsaes.New(hs.c.AuthKey) - aead, _ = gcm.NewGCMForTLS13(block) - } else { - aead, _ = chacha20poly1305.New(hs.c.AuthKey) - } + block, _ := fipsaes.New(hs.c.AuthKey) + aead, _ := gcm.NewGCMForTLS13(block) if config.Show { fmt.Printf("REALITY remoteAddr: %v\ths.c.AuthKey[:16]: %v\tAEAD: %T\n", remoteAddr, hs.c.AuthKey[:16], aead) }