()
| 822 | } |
| 823 | |
| 824 | func (hs *serverHandshakeStateTLS13) sendServerParameters() error { |
| 825 | c := hs.c |
| 826 | |
| 827 | if hs.echContext != nil { |
| 828 | copy(hs.hello.random[32-8:], make([]byte, 8)) |
| 829 | echTranscript := cloneHash(hs.transcript, hs.suite.hash) |
| 830 | echTranscript.Write(hs.clientHello.original) |
| 831 | if err := transcriptMsg(hs.hello, echTranscript); err != nil { |
| 832 | return err |
| 833 | } |
| 834 | // compute the acceptance message |
| 835 | h := hs.suite.hash.New |
| 836 | prk, err := hkdf.Extract(h, hs.clientHello.random, nil) |
| 837 | if err != nil { |
| 838 | c.sendAlert(alertInternalError) |
| 839 | return err |
| 840 | } |
| 841 | acceptConfirmation := tls13.ExpandLabel(h, prk, "ech accept confirmation", echTranscript.Sum(nil), 8) |
| 842 | copy(hs.hello.random[32-8:], acceptConfirmation) |
| 843 | } |
| 844 | |
| 845 | if err := transcriptMsg(hs.clientHello, hs.transcript); err != nil { |
| 846 | return err |
| 847 | } |
| 848 | |
| 849 | /* |
| 850 | if _, err := hs.c.writeHandshakeRecord(hs.hello, hs.transcript); err != nil { |
| 851 | return err |
| 852 | } |
| 853 | */ |
| 854 | { |
| 855 | hs.transcript.Write(hs.hello.original) |
| 856 | if _, err := hs.c.writeRecord(recordTypeHandshake, hs.hello.original); err != nil { |
| 857 | return err |
| 858 | } |
| 859 | } |
| 860 | |
| 861 | if err := hs.sendDummyChangeCipherSpec(); err != nil { |
| 862 | return err |
| 863 | } |
| 864 | |
| 865 | earlySecret := hs.earlySecret |
| 866 | if earlySecret == nil { |
| 867 | earlySecret = tls13.NewEarlySecret(hs.suite.hash.New, nil) |
| 868 | } |
| 869 | hs.handshakeSecret = earlySecret.HandshakeSecret(hs.sharedKey) |
| 870 | |
| 871 | clientSecret := hs.handshakeSecret.ClientHandshakeTrafficSecret(hs.transcript) |
| 872 | c.in.setTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret) |
| 873 | serverSecret := hs.handshakeSecret.ServerHandshakeTrafficSecret(hs.transcript) |
| 874 | c.out.setTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret) |
| 875 | |
| 876 | if c.quic != nil { |
| 877 | if c.hand.Len() != 0 { |
| 878 | c.sendAlert(alertUnexpectedMessage) |
| 879 | } |
| 880 | c.quicSetWriteSecret(QUICEncryptionLevelHandshake, hs.suite.id, serverSecret) |
| 881 | c.quicSetReadSecret(QUICEncryptionLevelHandshake, hs.suite.id, clientSecret) |
no test coverage detected