()
| 642 | } |
| 643 | |
| 644 | func (hs *serverHandshakeStateTLS13) sendServerFinished() error { |
| 645 | c := hs.c |
| 646 | |
| 647 | finished := &finishedMsg{ |
| 648 | verifyData: hs.suite.finishedHash(c.out.trafficSecret, hs.transcript), |
| 649 | } |
| 650 | |
| 651 | hs.transcript.Write(finished.marshal()) |
| 652 | if _, err := c.writeRecord(recordTypeHandshake, finished.marshal()); err != nil { |
| 653 | return err |
| 654 | } |
| 655 | |
| 656 | // Derive secrets that take context through the server Finished. |
| 657 | |
| 658 | hs.masterSecret = hs.suite.extract(nil, |
| 659 | hs.suite.deriveSecret(hs.handshakeSecret, "derived", nil)) |
| 660 | |
| 661 | hs.trafficSecret = hs.suite.deriveSecret(hs.masterSecret, |
| 662 | clientApplicationTrafficLabel, hs.transcript) |
| 663 | serverSecret := hs.suite.deriveSecret(hs.masterSecret, |
| 664 | serverApplicationTrafficLabel, hs.transcript) |
| 665 | c.out.setTrafficSecret(hs.suite, serverSecret) |
| 666 | |
| 667 | err := c.config.writeKeyLog(keyLogLabelClientTraffic, hs.clientHello.random, hs.trafficSecret) |
| 668 | if err != nil { |
| 669 | c.sendAlert(alertInternalError) |
| 670 | return err |
| 671 | } |
| 672 | err = c.config.writeKeyLog(keyLogLabelServerTraffic, hs.clientHello.random, serverSecret) |
| 673 | if err != nil { |
| 674 | c.sendAlert(alertInternalError) |
| 675 | return err |
| 676 | } |
| 677 | |
| 678 | c.ekm = hs.suite.exportKeyingMaterial(hs.masterSecret, hs.transcript) |
| 679 | |
| 680 | // If we did not request client certificates, at this point we can |
| 681 | // precompute the client finished and roll the transcript forward to send |
| 682 | // session tickets in our first flight. |
| 683 | if !hs.requestClientCert() { |
| 684 | if err := hs.sendSessionTickets(); err != nil { |
| 685 | return err |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | return nil |
| 690 | } |
| 691 | |
| 692 | func (hs *serverHandshakeStateTLS13) shouldSendSessionTickets() bool { |
| 693 | if hs.c.config.SessionTicketsDisabled { |
no test coverage detected