Просмотр исходного кода

Use github.com/Psiphon-Labs/psiphon-tls@2a2fae2db378

Amir Khan 1 год назад
Родитель
Сommit
75d165b766

+ 1 - 1
go.mod

@@ -39,7 +39,7 @@ require (
 	github.com/Psiphon-Labs/bolt v0.0.0-20200624191537-23cedaef7ad7
 	github.com/Psiphon-Labs/consistent v0.0.0-20240322131436-20aaa4e05737
 	github.com/Psiphon-Labs/goptlib v0.0.0-20200406165125-c0e32a7a3464
-	github.com/Psiphon-Labs/psiphon-tls v0.0.0-20250219165059-533f95b512e9
+	github.com/Psiphon-Labs/psiphon-tls v0.0.0-20250318183125-2a2fae2db378
 	github.com/Psiphon-Labs/quic-go v0.0.0-20250303214000-94770c5d46a0
 	github.com/Psiphon-Labs/utls v0.0.0-20250311210446-c1daf1ce55c1
 	github.com/armon/go-proxyproto v0.0.0-20180202201750-5b7edb60ff5f

+ 2 - 2
go.sum

@@ -22,8 +22,8 @@ github.com/Psiphon-Labs/consistent v0.0.0-20240322131436-20aaa4e05737 h1:QTMy7Uc
 github.com/Psiphon-Labs/consistent v0.0.0-20240322131436-20aaa4e05737/go.mod h1:Enj/Gszv2zCbuRbHbabmNvfO9EM+5kmaGj8CyjwNPlY=
 github.com/Psiphon-Labs/goptlib v0.0.0-20200406165125-c0e32a7a3464 h1:VmnMMMheFXwLV0noxYhbJbLmkV4iaVW3xNnj6xcCNHo=
 github.com/Psiphon-Labs/goptlib v0.0.0-20200406165125-c0e32a7a3464/go.mod h1:Pe5BqN2DdIdChorAXl6bDaQd/wghpCleJfid2NoSli0=
-github.com/Psiphon-Labs/psiphon-tls v0.0.0-20250219165059-533f95b512e9 h1:PjzuvkU8C0My+ixI+FWiJYV9PbALsw8uA1F8HrqPG/w=
-github.com/Psiphon-Labs/psiphon-tls v0.0.0-20250219165059-533f95b512e9/go.mod h1:7ZUnPnWT5z8J8hxfsVjKHYK77Zme/Y0If1b/zeziiJs=
+github.com/Psiphon-Labs/psiphon-tls v0.0.0-20250318183125-2a2fae2db378 h1:LqI8cxnYxgUKLLvv+XZKpxZAQcov6xhEKgC82FdvG/k=
+github.com/Psiphon-Labs/psiphon-tls v0.0.0-20250318183125-2a2fae2db378/go.mod h1:7ZUnPnWT5z8J8hxfsVjKHYK77Zme/Y0If1b/zeziiJs=
 github.com/Psiphon-Labs/quic-go v0.0.0-20250303214000-94770c5d46a0 h1:E1L02sxaIDWp7c7KOmU2iQHodg7On6sB//i2BMWs//w=
 github.com/Psiphon-Labs/quic-go v0.0.0-20250303214000-94770c5d46a0/go.mod h1:rONdWgPMbFjyyBai7gB1IBF4pT9r4l0GyiDst5XR1SY=
 github.com/Psiphon-Labs/utls v0.0.0-20250311210446-c1daf1ce55c1 h1:4AoKcLPErKMbqVdhA2MmnEP8kC4/CLlADnIR4rULHfM=

+ 12 - 6
vendor/github.com/Psiphon-Labs/psiphon-tls/conn.go

@@ -23,6 +23,8 @@ import (
 	"sync"
 	"sync/atomic"
 	"time"
+
+	"golang.org/x/crypto/cryptobyte"
 )
 
 // A Conn represents a secured connection.
@@ -1098,15 +1100,19 @@ func ReadClientHelloRandom(data []byte) ([]byte, error) {
 		return nil, errors.New("tls: unexpected message type")
 	}
 
-	// Unlike readHandshake, m is not retained and so making a copy of the
-	// input data is not necessary.
+	s := cryptobyte.String(data)
+	random := make([]byte, 32)
 
-	var m clientHelloMsg
-	if !m.unmarshal(data) {
-		return nil, errors.New("tls: unexpected message")
+	// Read the ClientHello random.
+	// We don't attempt to unmarshal the data into clientHelloMsg,
+	// since the data might not be a complete ClientHello message.
+	if !s.Skip(4) || // message type and uint24 length field
+		!s.Skip(2) || // protocol version
+		!s.ReadBytes(&random, 32) {
+		return nil, errors.New("tls: failed to read ClientHello random")
 	}
 
-	return m.random, nil
+	return random, nil
 }
 
 // readHandshakeBytes reads handshake data until c.hand contains at least n bytes.

+ 1 - 4
vendor/github.com/Psiphon-Labs/psiphon-tls/defaults.go

@@ -23,10 +23,7 @@ func defaultCurvePreferences() []CurveID {
 	// 	return []CurveID{X25519, CurveP256, CurveP384, CurveP521}
 	// }
 	// For now, x25519Kyber768Draft00 must always be followed by X25519.
-	// return []CurveID{x25519Kyber768Draft00, X25519, CurveP256, CurveP384, CurveP521}
-
-	// [Psiphon] Excluve X22519Kyber768Deaft00 by default
-	return []CurveID{X25519, CurveP256, CurveP384, CurveP521}
+	return []CurveID{x25519Kyber768Draft00, X25519, CurveP256, CurveP384, CurveP521}
 }
 
 // defaultSupportedSignatureAlgorithms contains the signature and hash algorithms that

+ 1 - 1
vendor/modules.txt

@@ -33,7 +33,7 @@ github.com/Psiphon-Labs/consistent
 # github.com/Psiphon-Labs/goptlib v0.0.0-20200406165125-c0e32a7a3464
 ## explicit
 github.com/Psiphon-Labs/goptlib
-# github.com/Psiphon-Labs/psiphon-tls v0.0.0-20250219165059-533f95b512e9
+# github.com/Psiphon-Labs/psiphon-tls v0.0.0-20250318183125-2a2fae2db378
 ## explicit; go 1.23
 github.com/Psiphon-Labs/psiphon-tls
 github.com/Psiphon-Labs/psiphon-tls/byteorder