Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions u_chrome155_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"net"
"os"
"reflect"
"slices"
"sort"
"strings"
"testing"
Expand Down Expand Up @@ -113,7 +112,7 @@ func chrome155NormalizeExtension(t *testing.T, id uint16, body []byte) string {
outer, kdf, aead := r.number(1), r.number(2), r.number(2)
r.take(1) // randomized config_id
enc, payload := r.vector(2), r.vector(2)
if outer != 0 || !slices.Contains([]int{144, 176, 208, 240}, len(payload)) {
if outer != 0 || !chrome155ECHPayloadLen(len(payload)) {
t.Fatalf("unexpected GREASE ECH shape: outer=%d, payload length=%d", outer, len(payload))
}
value = fmt.Sprintf("%d/%d/%d/enc=%d/payload=144,176,208,240", outer, kdf, aead, len(enc))
Expand Down Expand Up @@ -251,7 +250,7 @@ func TestChrome155DefaultFingerprintRoundTrip(t *testing.T) {
client := chrome155Build(t, HelloCustom, chrome155FixtureServerName(t, raw), spec)
got, gotOrder, _ := chrome155ParseWire(t, client.HandshakeState.Hello.Raw)
chrome155CompareWire(t, want, got)
if !slices.Equal(gotOrder, wantOrder) {
if !reflect.DeepEqual(gotOrder, wantOrder) {
t.Errorf("fingerprint roundtrip reordered extensions: got %x, want %x", gotOrder, wantOrder)
}
if chrome155TrustAnchors(t, spec.Extensions) == nil {
Expand Down Expand Up @@ -311,10 +310,21 @@ func TestChrome133CapabilitiesPreserved(t *testing.T) {
uint16(ECDSAWithP384AndSHA384), uint16(PSSWithSHA384), uint16(PKCS1WithSHA384),
uint16(PSSWithSHA512), uint16(PKCS1WithSHA512),
}
if !slices.Equal(got, want) {
if !reflect.DeepEqual(got, want) {
t.Fatalf("Chrome 133 signature schemes changed: got %x, want original classical schemes %x", got, want)
}
if _, ok := raw[0xca34]; ok {
t.Fatal("Chrome 155 trust anchor IDs leaked into the Chrome 133 profile")
}
}

// chrome155ECHPayloadLen reports a GREASE ECH payload length Chrome uses. A
// loop instead of slices.Contains keeps the tests building with Go 1.20.
func chrome155ECHPayloadLen(n int) bool {
for _, want := range []int{144, 176, 208, 240} {
if n == want {
return true
}
}
return false
}
4 changes: 2 additions & 2 deletions u_mldsa_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tls
import (
"encoding/json"
"fmt"
"slices"
"reflect"
"testing"

"github.com/metacubex/utls/dicttls"
Expand Down Expand Up @@ -46,7 +46,7 @@ func TestMLDSASignatureSchemeJSON(t *testing.T) {
t.Fatalf("unexpected extension type %T", ext)
}
want := []SignatureScheme{GREASE_PLACEHOLDER, MLDSA44, MLDSA65, MLDSA87}
if !slices.Equal(got, want) {
if !reflect.DeepEqual(got, want) {
t.Fatalf("signature algorithms = %x, want %x", got, want)
}
})
Expand Down
Loading