Debian Codegraph @

tls/handshake_messages_test.go

raw symbols SCIP
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package tlsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/
6
7 import (
8 "math/randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/"
9 "reflectscip-go gomod github.com/golang/go/src go1.16 reflect/"
10 "testingscip-go gomod github.com/golang/go/src go1.16 testing/"
11 "testing/quickscip-go gomod github.com/golang/go/src go1.16 `testing/quick`/"
12 )
13
14 var testsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/tests. = []interface{}{
15 &clientHelloMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#{},
16 &serverHelloMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#{},
17 &finishedMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/finishedMsg#{},
18
19 &certificateMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateMsg#{},
20 &certificateRequestMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateRequestMsg#{},
21 &certificateVerifyMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateVerifyMsg#{},
22 &certificateStatusMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateStatusMsg#{},
23 &clientKeyExchangeMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientKeyExchangeMsg#{},
24 &nextProtoMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/nextProtoMsg#{},
25 &newSessionTicketMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/newSessionTicketMsg#{},
26 &sessionStatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#{},
27 }
28
29 type testMessagescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage# interface {
30 marshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#marshal.() []byte
31 unmarshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#unmarshal.([]byte) bool
32 equalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#equal.(interface{}) bool
33 }
34
35 func TestMarshalUnmarshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TestMarshalUnmarshal().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
36 rand := randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Newscip-go gomod github.com/golang/go/src go1.16 `math/rand`/New().(randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.NewSourcescip-go gomod github.com/golang/go/src go1.16 `math/rand`/NewSource().(0))
37
38 for i, iface := range testsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/tests. {
39 ty := reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(iface).Typescip-go gomod github.com/golang/go/src go1.16 reflect/Value#Type().()
40
41 n := 100
42 if testingscip-go gomod github.com/golang/go/src go1.16 testing/.Shortscip-go gomod github.com/golang/go/src go1.16 testing/Short().() {
43 n = 5
44 }
45 for j := 0; j < n; j++ {
46 v, ok := quickscip-go gomod github.com/golang/go/src go1.16 `testing/quick`/.Valuescip-go gomod github.com/golang/go/src go1.16 `testing/quick`/Value().(ty, rand)
47 if !ok {
48 t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("#%d: failed to create value", i)
49 break
50 }
51
52 m1 := v.Interfacescip-go gomod github.com/golang/go/src go1.16 reflect/Value#Interface().().(testMessagescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#)
53 marshaled := m1.marshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#marshal.()
54 m2 := iface.(testMessagescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#)
55 if !m2.unmarshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#unmarshal.(marshaled) {
56 t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("#%d failed to unmarshal %#v %x", i, m1, marshaled)
57 break
58 }
59 m2.marshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#marshal.() // to fill any marshal cache in the message
60
61 if !m1.equalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#equal.(m2) {
62 t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("#%d got:%#v want:%#v %x", i, m2, m1, marshaled)
63 break
64 }
65
66 if i >= 3 {
67 // The first three message types (ClientHello,
68 // ServerHello and Finished) are allowed to
69 // have parsable prefixes because the extension
70 // data is optional and the length of the
71 // Finished varies across versions.
72 for j := 0; j < len(marshaled); j++ {
73 if m2.unmarshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#unmarshal.(marshaled[0:j]) {
74 t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("#%d unmarshaled a prefix of length %d of %#v", i, j, m1)
75 break
76 }
77 }
78 }
79 }
80 }
81 }
82
83 func TestFuzzscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TestFuzz().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
84 rand := randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Newscip-go gomod github.com/golang/go/src go1.16 `math/rand`/New().(randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.NewSourcescip-go gomod github.com/golang/go/src go1.16 `math/rand`/NewSource().(0))
85 for _, iface := range testsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/tests. {
86 m := iface.(testMessagescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#)
87
88 for j := 0; j < 1000; j++ {
89 len := rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(100)
90 bytes := randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(len, rand)
91 // This just looks for crashes due to bounds errors etc.
92 m.unmarshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/testMessage#unmarshal.(bytes)
93 }
94 }
95 }
96
97 func randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(n int, rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#) []byte {
98 r := make([]byte, n)
99 for i := 0; i < n; i++ {
100 r[i] = byte(rand.Int31scip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Int31().())
101 }
102 return r
103 }
104
105 func randomStringscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomString().(n int, rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#) string {
106 b := randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(n, rand)
107 return string(b)
108 }
109
110 func (*clientHelloMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
111 m := &clientHelloMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#{}
112 m.versscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#vers. = uint16(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(65536))
113 m.randomscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#random. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(32, rand)
114 m.sessionIdscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#sessionId. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(32), rand)
115 m.cipherSuitesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#cipherSuites. = make([]uint16, rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(63)+1)
116 for i := 0; i < len(m.cipherSuitesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#cipherSuites.); i++ {
117 m.cipherSuitesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#cipherSuites.[i] = uint16(rand.Int31scip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Int31().())
118 }
119 m.compressionMethodsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#compressionMethods. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(63)+1, rand)
120 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
121 m.nextProtoNegscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#nextProtoNeg. = true
122 }
123 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
124 m.serverNamescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#serverName. = randomStringscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomString().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(255), rand)
125 }
126 m.ocspStaplingscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#ocspStapling. = rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5
127 m.supportedPointsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#supportedPoints. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(5)+1, rand)
128 m.supportedCurvesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#supportedCurves. = make([]CurveIDscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/CurveID#, rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(5)+1)
129 for i := range m.supportedCurvesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#supportedCurves. {
130 m.supportedCurvesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#supportedCurves.[i] = CurveIDscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/CurveID#(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(30000))
131 }
132 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
133 m.ticketSupportedscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#ticketSupported. = true
134 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
135 m.sessionTicketscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#sessionTicket. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(300), rand)
136 }
137 }
138 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
139 m.signatureAndHashesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#signatureAndHashes. = supportedSKXSignatureAlgorithmsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/supportedSKXSignatureAlgorithms.
140 }
141 m.alpnProtocolsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#alpnProtocols. = make([]string, rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(5))
142 for i := range m.alpnProtocolsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#alpnProtocols. {
143 m.alpnProtocolsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientHelloMsg#alpnProtocols.[i] = randomStringscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomString().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(20)+1, rand)
144 }
145
146 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
147 }
148
149 func (*serverHelloMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
150 m := &serverHelloMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#{}
151 m.versscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#vers. = uint16(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(65536))
152 m.randomscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#random. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(32, rand)
153 m.sessionIdscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#sessionId. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(32), rand)
154 m.cipherSuitescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#cipherSuite. = uint16(rand.Int31scip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Int31().())
155 m.compressionMethodscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#compressionMethod. = uint8(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(256))
156
157 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
158 m.nextProtoNegscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#nextProtoNeg. = true
159
160 n := rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10)
161 m.nextProtosscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#nextProtos. = make([]string, n)
162 for i := 0; i < n; i++ {
163 m.nextProtosscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#nextProtos.[i] = randomStringscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomString().(20, rand)
164 }
165 }
166
167 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
168 m.ocspStaplingscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#ocspStapling. = true
169 }
170 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
171 m.ticketSupportedscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#ticketSupported. = true
172 }
173 m.alpnProtocolscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/serverHelloMsg#alpnProtocol. = randomStringscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomString().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(32)+1, rand)
174
175 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
176 }
177
178 func (*certificateMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
179 m := &certificateMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateMsg#{}
180 numCerts := rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(20)
181 m.certificatesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateMsg#certificates. = make([][]byte, numCerts)
182 for i := 0; i < numCerts; i++ {
183 m.certificatesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateMsg#certificates.[i] = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10)+1, rand)
184 }
185 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
186 }
187
188 func (*certificateRequestMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateRequestMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateRequestMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
189 m := &certificateRequestMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateRequestMsg#{}
190 m.certificateTypesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateRequestMsg#certificateTypes. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(5)+1, rand)
191 numCAs := rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(100)
192 m.certificateAuthoritiesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateRequestMsg#certificateAuthorities. = make([][]byte, numCAs)
193 for i := 0; i < numCAs; i++ {
194 m.certificateAuthoritiesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateRequestMsg#certificateAuthorities.[i] = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(15)+1, rand)
195 }
196 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
197 }
198
199 func (*certificateVerifyMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateVerifyMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateVerifyMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
200 m := &certificateVerifyMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateVerifyMsg#{}
201 m.signaturescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateVerifyMsg#signature. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(15)+1, rand)
202 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
203 }
204
205 func (*certificateStatusMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateStatusMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateStatusMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
206 m := &certificateStatusMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateStatusMsg#{}
207 if rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10) > 5 {
208 m.statusTypescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateStatusMsg#statusType. = statusTypeOCSPscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/statusTypeOCSP.
209 m.responsescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateStatusMsg#response. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10)+1, rand)
210 } else {
211 m.statusTypescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/certificateStatusMsg#statusType. = 42
212 }
213 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
214 }
215
216 func (*clientKeyExchangeMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientKeyExchangeMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientKeyExchangeMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
217 m := &clientKeyExchangeMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientKeyExchangeMsg#{}
218 m.ciphertextscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/clientKeyExchangeMsg#ciphertext. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(1000)+1, rand)
219 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
220 }
221
222 func (*finishedMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/finishedMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/finishedMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
223 m := &finishedMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/finishedMsg#{}
224 m.verifyDatascip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/finishedMsg#verifyData. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(12, rand)
225 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
226 }
227
228 func (*nextProtoMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/nextProtoMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/nextProtoMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
229 m := &nextProtoMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/nextProtoMsg#{}
230 m.protoscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/nextProtoMsg#proto. = randomStringscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomString().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(255), rand)
231 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
232 }
233
234 func (*newSessionTicketMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/newSessionTicketMsg#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/newSessionTicketMsg#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
235 m := &newSessionTicketMsgscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/newSessionTicketMsg#{}
236 m.ticketscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/newSessionTicketMsg#ticket. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(4), rand)
237 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(m)
238 }
239
240 func (*sessionStatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#) Generatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#Generate().(rand *randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/.Randscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#, size int) reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.Valuescip-go gomod github.com/golang/go/src go1.16 reflect/Value# {
241 s := &sessionStatescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#{}
242 s.versscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#vers. = uint16(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10000))
243 s.cipherSuitescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#cipherSuite. = uint16(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10000))
244 s.masterSecretscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#masterSecret. = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(100), rand)
245 numCerts := rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(20)
246 s.certificatesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#certificates. = make([][]byte, numCerts)
247 for i := 0; i < numCerts; i++ {
248 s.certificatesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/sessionState#certificates.[i] = randomBytesscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/randomBytes().(rand.Intnscip-go gomod github.com/golang/go/src go1.16 `math/rand`/Rand#Intn().(10)+1, rand)
249 }
250 return reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.16 reflect/ValueOf().(s)
251 }