diff --git a/u_ech.go b/u_ech.go index e5ce83a9..9d3593c9 100644 --- a/u_ech.go +++ b/u_ech.go @@ -9,6 +9,7 @@ import ( "sync" "github.com/cloudflare/circl/hpke" + "github.com/refraction-networking/utls/dicttls" ) // Unstable API: This is a work in progress and may change in the future. Using @@ -234,3 +235,19 @@ func (*UnimplementedECHExtension) MarshalClientHello(*UConn) error { func (*UnimplementedECHExtension) mustEmbedUnimplementedECHExtension() { panic("mustEmbedUnimplementedECHExtension() is not implemented") } + +func BoringGREASEECH() *GREASEEncryptedClientHelloExtension { + return &GREASEEncryptedClientHelloExtension{ + CandidateCipherSuites: []HPKESymmetricCipherSuite{ + { + KdfId: dicttls.HKDF_SHA256, + AeadId: dicttls.AEAD_AES_128_GCM, + }, + { + KdfId: dicttls.HKDF_SHA256, + AeadId: dicttls.AEAD_CHACHA20_POLY1305, + }, + }, + CandidatePayloadLens: []uint16{128, 160, 192, 224}, // +16: 144, 176, 208, 240 + } +} diff --git a/u_parrots.go b/u_parrots.go index 5d2b96c0..36d978ed 100644 --- a/u_parrots.go +++ b/u_parrots.go @@ -726,23 +726,7 @@ func utlsIdToSpec(id ClientHelloID) (ClientHelloSpec, error) { CertCompressionBrotli, }}, &ApplicationSettingsExtension{SupportedProtocols: []string{"h2"}}, - &GREASEEncryptedClientHelloExtension{ - CandidateCipherSuites: []HPKESymmetricCipherSuite{ - { - KdfId: dicttls.HKDF_SHA256, - AeadId: dicttls.AEAD_AES_128_GCM, - }, - { - KdfId: dicttls.HKDF_SHA256, - AeadId: dicttls.AEAD_AES_256_GCM, - }, - { - KdfId: dicttls.HKDF_SHA256, - AeadId: dicttls.AEAD_CHACHA20_POLY1305, - }, - }, - CandidatePayloadLens: []uint16{128, 160}, // +16: 144, 176 - }, + BoringGREASEECH(), &UtlsGREASEExtension{}, }), }, nil @@ -816,23 +800,7 @@ func utlsIdToSpec(id ClientHelloID) (ClientHelloSpec, error) { CertCompressionBrotli, }}, &ApplicationSettingsExtension{SupportedProtocols: []string{"h2"}}, - &GREASEEncryptedClientHelloExtension{ - CandidateCipherSuites: []HPKESymmetricCipherSuite{ - { - KdfId: dicttls.HKDF_SHA256, - AeadId: dicttls.AEAD_AES_128_GCM, - }, - { - KdfId: dicttls.HKDF_SHA256, - AeadId: dicttls.AEAD_AES_256_GCM, - }, - { - KdfId: dicttls.HKDF_SHA256, - AeadId: dicttls.AEAD_CHACHA20_POLY1305, - }, - }, - CandidatePayloadLens: []uint16{128, 160}, // +16: 144, 176 - }, + BoringGREASEECH(), &UtlsGREASEExtension{}, }), }, nil