Ver código fonte

Test that stray HelloRequests during the handshake are ignored.

Change-Id: I79e21ffce9c2d7f47b055b75bd00b80aafa8b8f0
Reviewed-on: https://boringssl-review.googlesource.com/8668
Reviewed-by: David Benjamin <davidben@google.com>
kris/onging/CECPQ3_patch15
David Benjamin 8 anos atrás
pai
commit
71dd6660e8
3 arquivos alterados com 38 adições e 3 exclusões
  1. +5
    -0
      ssl/test/runner/common.go
  2. +12
    -3
      ssl/test/runner/conn.go
  3. +21
    -0
      ssl/test/runner/runner.go

+ 5
- 0
ssl/test/runner/common.go Ver arquivo

@@ -842,6 +842,11 @@ type ProtocolBugs struct {
// data record. This only makes sense for a server.
SendHelloRequestBeforeEveryAppDataRecord bool

// SendHelloRequestBeforeEveryHandshakeMessage, if true, causes a
// HelloRequest handshake message to be sent before each handshake
// message. This only makes sense for a server.
SendHelloRequestBeforeEveryHandshakeMessage bool

// RequireDHPublicValueLen causes a fatal error if the length (in
// bytes) of the server's Diffie-Hellman public value is not equal to
// this.


+ 12
- 3
ssl/test/runner/conn.go Ver arquivo

@@ -945,9 +945,18 @@ func (c *Conn) writeRecord(typ recordType, data []byte) (n int, err error) {
return c.dtlsWriteRecord(typ, data)
}

if c.config.Bugs.PackHandshakeFlight && typ == recordTypeHandshake {
c.pendingFlight.Write(data)
return len(data), nil
if typ == recordTypeHandshake {
if c.config.Bugs.SendHelloRequestBeforeEveryHandshakeMessage {
newData := make([]byte, 0, 4+len(data))
newData = append(newData, typeHelloRequest, 0, 0, 0)
newData = append(newData, data...)
data = newData
}

if c.config.Bugs.PackHandshakeFlight {
c.pendingFlight.Write(data)
return len(data), nil
}
}

return c.doWriteRecord(typ, data)


+ 21
- 0
ssl/test/runner/runner.go Ver arquivo

@@ -4542,6 +4542,27 @@ func addRenegotiationTests() {
},
})

// Stray HelloRequests during the handshake are ignored.
testCases = append(testCases, testCase{
name: "StrayHelloRequest",
config: Config{
MaxVersion: VersionTLS12,
Bugs: ProtocolBugs{
SendHelloRequestBeforeEveryHandshakeMessage: true,
},
},
})
testCases = append(testCases, testCase{
name: "StrayHelloRequest-Packed",
config: Config{
MaxVersion: VersionTLS12,
Bugs: ProtocolBugs{
PackHandshakeFlight: true,
SendHelloRequestBeforeEveryHandshakeMessage: true,
},
},
})

// TODO(davidben): Add a test that HelloRequests are illegal in TLS 1.3.
}



Carregando…
Cancelar
Salvar