(label string, clientRandom, secret []byte)
| 1325 | ) |
| 1326 | |
| 1327 | func (c *Config) writeKeyLog(label string, clientRandom, secret []byte) error { |
| 1328 | if c.KeyLogWriter == nil { |
| 1329 | return nil |
| 1330 | } |
| 1331 | |
| 1332 | logLine := []byte(fmt.Sprintf("%s %x %x\n", label, clientRandom, secret)) |
| 1333 | |
| 1334 | writerMutex.Lock() |
| 1335 | _, err := c.KeyLogWriter.Write(logLine) |
| 1336 | writerMutex.Unlock() |
| 1337 | |
| 1338 | return err |
| 1339 | } |
| 1340 | |
| 1341 | // writerMutex protects all KeyLogWriters globally. It is rarely enabled, |
| 1342 | // and is only for debugging, so a global mutex saves space. |
no test coverage detected