mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
crypto/tls: simplify keylog tests.
Since there's no aspect of key logging that OpenSSL can check for us, the tests for it might as well just connect to another goroutine as this is lower-maintainance. Change-Id: I746d1dbad1b4bbfc8ef6ccf136ee4824dbda021e Reviewed-on: https://go-review.googlesource.com/30089 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joonas Kuorilehto <joneskoo@derbian.fi> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
7b40b0c3a3
commit
2878cf14f3
6 changed files with 51 additions and 244 deletions
|
|
@ -637,15 +637,19 @@ func (c *Config) BuildNameToCertificate() {
|
|||
}
|
||||
}
|
||||
|
||||
// writeKeyLog logs client random and master secret if logging enabled
|
||||
// by setting KeyLogWriter.
|
||||
// writeKeyLog logs client random and master secret if logging was enabled by
|
||||
// setting c.KeyLogWriter.
|
||||
func (c *Config) writeKeyLog(clientRandom, masterSecret []byte) error {
|
||||
if c.KeyLogWriter == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
logLine := []byte(fmt.Sprintf("CLIENT_RANDOM %x %x\n", clientRandom, masterSecret))
|
||||
|
||||
writerMutex.Lock()
|
||||
_, err := fmt.Fprintf(c.KeyLogWriter, "CLIENT_RANDOM %x %x\n", clientRandom, masterSecret)
|
||||
_, err := c.KeyLogWriter.Write(logLine)
|
||||
writerMutex.Unlock()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue