Browse Source

fix the key_exchange length in the ClientHello and ServerHello tests

The marshaller correctly checks the key_exchange length, but the test
code sometimes generated empty key_exchanges.
v1.2.3
Marten Seemann 6 years ago
committed by Kris Kwiatkowski
parent
commit
9919e0e977
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      handshake_messages_test.go

+ 2
- 2
handshake_messages_test.go View File

@@ -162,7 +162,7 @@ func (*clientHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value {
m.keyShares = make([]keyShare, rand.Intn(4)) m.keyShares = make([]keyShare, rand.Intn(4))
for i := range m.keyShares { for i := range m.keyShares {
m.keyShares[i].group = CurveID(rand.Intn(30000)) m.keyShares[i].group = CurveID(rand.Intn(30000))
m.keyShares[i].data = randomBytes(rand.Intn(300), rand)
m.keyShares[i].data = randomBytes(rand.Intn(300)+1, rand)
} }
m.supportedVersions = make([]uint16, rand.Intn(5)) m.supportedVersions = make([]uint16, rand.Intn(5))
for i := range m.supportedVersions { for i := range m.supportedVersions {
@@ -211,7 +211,7 @@ func (*serverHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value {


if rand.Intn(10) > 5 { if rand.Intn(10) > 5 {
m.keyShare.group = CurveID(rand.Intn(30000)) m.keyShare.group = CurveID(rand.Intn(30000))
m.keyShare.data = randomBytes(rand.Intn(300), rand)
m.keyShare.data = randomBytes(rand.Intn(300)+1, rand)
} }
if rand.Intn(10) > 5 { if rand.Intn(10) > 5 {
m.psk = true m.psk = true


Loading…
Cancel
Save