(t *testing.T)
| 61 | } |
| 62 | |
| 63 | func 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 | |
| 87 | func BenchmarkBuildClientHello(b *testing.B) { |
| 88 | rnd := make([]byte, 32) |
nothing calls this directly
no test coverage detected