Skip to content

Commit

Permalink
fix: grease ech parrot for chrome 120 (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
hax0r31337 authored Dec 15, 2023
1 parent ed573b3 commit 2d6258a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 34 deletions.
17 changes: 17 additions & 0 deletions u_ech.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
36 changes: 2 additions & 34 deletions u_parrots.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2d6258a

Please sign in to comment.