Kaynağa Gözat

Add tests for certificate mismatch.

Cover another mildly interesting error case.

Change-Id: Ice773af79f5e03f39f0cd2a9e158bae03e065392
Reviewed-on: https://boringssl-review.googlesource.com/2841
Reviewed-by: Adam Langley <agl@google.com>
kris/onging/CECPQ3_patch15
David Benjamin 9 yıl önce
committed by Adam Langley
ebeveyn
işleme
6095de8da2
3 değiştirilmiş dosya ile 32 ekleme ve 0 silme
  1. +5
    -0
      ssl/test/runner/common.go
  2. +3
    -0
      ssl/test/runner/handshake_server.go
  3. +24
    -0
      ssl/test/runner/runner.go

+ 5
- 0
ssl/test/runner/common.go Dosyayı Görüntüle

@@ -594,6 +594,11 @@ type ProtocolBugs struct {
// MaxPacketLength, if non-zero, is the maximum acceptable size for a
// packet.
MaxPacketLength int

// SendCipherSuite, if non-zero, is the cipher suite value that the
// server will send in the ServerHello. This does not affect the cipher
// the server believes it has actually negotiated.
SendCipherSuite uint16
}

func (c *Config) serverInit() {


+ 3
- 0
ssl/test/runner/handshake_server.go Dosyayı Görüntüle

@@ -444,6 +444,9 @@ func (hs *serverHandshakeState) doFullHandshake() error {

hs.hello.ticketSupported = hs.clientHello.ticketSupported && !config.SessionTicketsDisabled && c.vers > VersionSSL30
hs.hello.cipherSuite = hs.suite.id
if config.Bugs.SendCipherSuite != 0 {
hs.hello.cipherSuite = config.Bugs.SendCipherSuite
}
c.extendedMasterSecret = hs.hello.extendedMasterSecret

// Generate a session ID if we're to save the session.


+ 24
- 0
ssl/test/runner/runner.go Dosyayı Görüntüle

@@ -588,6 +588,30 @@ var testCases = []testCase{
shouldFail: true,
expectedLocalError: "dtls: exceeded maximum packet length",
},
{
name: "CertMismatchRSA",
config: Config{
CipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256},
Certificates: []Certificate{getECDSACertificate()},
Bugs: ProtocolBugs{
SendCipherSuite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
},
},
shouldFail: true,
expectedError: ":WRONG_CERTIFICATE_TYPE:",
},
{
name: "CertMismatchECDSA",
config: Config{
CipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256},
Certificates: []Certificate{getRSACertificate()},
Bugs: ProtocolBugs{
SendCipherSuite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
},
},
shouldFail: true,
expectedError: ":WRONG_CERTIFICATE_TYPE:",
},
}

func doExchange(test *testCase, config *Config, conn net.Conn, messageLen int, isResume bool) error {


Yükleniyor…
İptal
Kaydet