(keyUpdate *keyUpdateMsg)
| 1489 | } |
| 1490 | |
| 1491 | func (c *Conn) handleKeyUpdate(keyUpdate *keyUpdateMsg) error { |
| 1492 | cipherSuite := cipherSuiteTLS13ByID(c.cipherSuite) |
| 1493 | if cipherSuite == nil { |
| 1494 | return c.in.setErrorLocked(c.sendAlert(alertInternalError)) |
| 1495 | } |
| 1496 | |
| 1497 | newSecret := cipherSuite.nextTrafficSecret(c.in.trafficSecret) |
| 1498 | c.in.setTrafficSecret(cipherSuite, newSecret) |
| 1499 | |
| 1500 | if keyUpdate.updateRequested { |
| 1501 | c.out.Lock() |
| 1502 | defer c.out.Unlock() |
| 1503 | |
| 1504 | msg := &keyUpdateMsg{} |
| 1505 | _, err := c.writeRecordLocked(recordTypeHandshake, msg.marshal()) |
| 1506 | if err != nil { |
| 1507 | // Surface the error at the next write. |
| 1508 | c.out.setErrorLocked(err) |
| 1509 | return nil |
| 1510 | } |
| 1511 | |
| 1512 | newSecret := cipherSuite.nextTrafficSecret(c.out.trafficSecret) |
| 1513 | c.out.setTrafficSecret(cipherSuite, newSecret) |
| 1514 | } |
| 1515 | |
| 1516 | return nil |
| 1517 | } |
| 1518 | |
| 1519 | // Read reads data from the connection. |
| 1520 | // |
no test coverage detected