MCPcopy Create free account
hub / github.com/SamNet-dev/snix / TestClientHelloRejectsBadInput

Function TestClientHelloRejectsBadInput

core/injector/clienthello_test.go:63–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func TestClientHelloRejectsBadInput(t *testing.T) {
64 bad31 := make([]byte, 31)
65 good := make([]byte, 32)
66 longSNI := make([]byte, 220)
67
68 cases := []struct {
69 name string
70 rnd, sess, sni, keyShr []byte
71 }{
72 {"short_rnd", bad31, good, []byte("x"), good},
73 {"short_sess", good, bad31, []byte("x"), good},
74 {"short_keyshare", good, good, []byte("x"), bad31},
75 {"oversize_sni", good, good, longSNI, good},
76 }
77 for _, c := range cases {
78 c := c
79 t.Run(c.name, func(t *testing.T) {
80 if _, err := BuildClientHello(c.rnd, c.sess, c.sni, c.keyShr); err == nil {
81 t.Fatal("expected error")
82 }
83 })
84 }
85}
86
87func BenchmarkBuildClientHello(b *testing.B) {
88 rnd := make([]byte, 32)

Callers

nothing calls this directly

Calls 2

BuildClientHelloFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected