(label string, clientRandom, secret []byte)
| 1568 | ) |
| 1569 | |
| 1570 | func (c *Config) writeKeyLog(label string, clientRandom, secret []byte) error { |
| 1571 | if c.KeyLogWriter == nil { |
| 1572 | return nil |
| 1573 | } |
| 1574 | |
| 1575 | logLine := fmt.Appendf(nil, "%s %x %x\n", label, clientRandom, secret) |
| 1576 | |
| 1577 | writerMutex.Lock() |
| 1578 | _, err := c.KeyLogWriter.Write(logLine) |
| 1579 | writerMutex.Unlock() |
| 1580 | |
| 1581 | return err |
| 1582 | } |
| 1583 | |
| 1584 | // writerMutex protects all KeyLogWriters globally. It is rarely enabled, |
| 1585 | // and is only for debugging, so a global mutex saves space. |
no test coverage detected