tris: process ALPN in EE received by client

This commit is contained in:
Peter Wu 2017-09-21 14:27:53 +01:00
parent 0b636d21fb
commit e9ff50fcb0

13
13.go
View File

@ -744,6 +744,15 @@ func (hs *clientHandshakeState) processCertsFromServer13(certMsg *certificateMsg
return hs.processCertsFromServer(certs) 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 { func (hs *clientHandshakeState) verifyPeerCertificate(certVerify *certificateVerifyMsg) error {
pub := hs.c.peerCertificates[0].PublicKey pub := hs.c.peerCertificates[0].PublicKey
_, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, hs.hello.supportedSignatureAlgorithms, hs.c.vers) _, 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) c.sendAlert(alertUnexpectedMessage)
return unexpectedMessageError(encryptedExtensions, msg) return unexpectedMessageError(encryptedExtensions, msg)
} }
if err := hs.processEncryptedExtensions(encryptedExtensions); err != nil {
return err
}
hs.keySchedule.write(encryptedExtensions.marshal()) hs.keySchedule.write(encryptedExtensions.marshal())
// TODO process encryptedExtensions
// PSKs are not supported, so receive Certificate message. // PSKs are not supported, so receive Certificate message.
msg, err = c.readHandshake() msg, err = c.readHandshake()