diff --git a/13.go b/13.go index cc30624..64e0132 100644 --- a/13.go +++ b/13.go @@ -744,6 +744,15 @@ func (hs *clientHandshakeState) processCertsFromServer13(certMsg *certificateMsg return hs.processCertsFromServer(certs) } +func (hs *clientHandshakeState) processEncryptedExtensions(ee *encryptedExtensionsMsg) error { + c := hs.c + if ee.alpnProtocol != "" { + c.clientProtocol = ee.alpnProtocol + c.clientProtocolFallback = false + } + return nil +} + func (hs *clientHandshakeState) verifyPeerCertificate(certVerify *certificateVerifyMsg) error { pub := hs.c.peerCertificates[0].PublicKey _, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, hs.hello.supportedSignatureAlgorithms, hs.c.vers) @@ -805,8 +814,10 @@ func (hs *clientHandshakeState) doTLS13Handshake() error { c.sendAlert(alertUnexpectedMessage) return unexpectedMessageError(encryptedExtensions, msg) } + if err := hs.processEncryptedExtensions(encryptedExtensions); err != nil { + return err + } hs.keySchedule.write(encryptedExtensions.marshal()) - // TODO process encryptedExtensions // PSKs are not supported, so receive Certificate message. msg, err = c.readHandshake()