mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-18 01:58:41 +00:00
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 65b467e448
This commit is contained in:
parent
7ddc4a2525
commit
09d84c42e9
3 changed files with 5 additions and 16 deletions
|
@ -30,14 +30,10 @@ import (
|
|||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/transport/internet/tls"
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
"golang.org/x/crypto/hkdf"
|
||||
"golang.org/x/net/http2"
|
||||
)
|
||||
|
||||
//go:linkname aesgcmPreferred github.com/refraction-networking/utls.aesgcmPreferred
|
||||
func aesgcmPreferred(ciphers []uint16) bool
|
||||
|
||||
type Conn struct {
|
||||
*reality.Conn
|
||||
}
|
||||
|
@ -147,13 +143,8 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati
|
|||
if _, err := hkdf.New(sha256.New, uConn.AuthKey, hello.Random[:20], []byte("REALITY")).Read(uConn.AuthKey); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var aead cipher.AEAD
|
||||
if aesgcmPreferred(hello.CipherSuites) {
|
||||
block, _ := aes.NewCipher(uConn.AuthKey)
|
||||
aead, _ = cipher.NewGCM(block)
|
||||
} else {
|
||||
aead, _ = chacha20poly1305.New(uConn.AuthKey)
|
||||
}
|
||||
block, _ := aes.NewCipher(uConn.AuthKey)
|
||||
aead, _ := cipher.NewGCM(block)
|
||||
if config.Show {
|
||||
errors.LogInfo(ctx, fmt.Sprintf("REALITY localAddr: %v\tuConn.AuthKey[:16]: %v\tAEAD: %T\n", localAddr, uConn.AuthKey[:16], aead))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue