update main-with-bazel from main branch

This commit is contained in:
BoringSSL Robot
2025-02-13 23:53:47 +00:00
2 changed files with 51 additions and 3 deletions
+47 -1
View File
@@ -91,12 +91,58 @@ const (
typeFinished uint8 = 20
typeCertificateStatus uint8 = 22
typeKeyUpdate uint8 = 24
typeCompressedCertificate uint8 = 25 // Not IANA assigned
typeCompressedCertificate uint8 = 25
typeNextProtocol uint8 = 67 // Not IANA assigned
typeChannelID uint8 = 203 // Not IANA assigned
typeMessageHash uint8 = 254
)
func messageTypeToString(typ uint8) string {
switch typ {
case typeHelloRequest:
return "HelloRequest"
case typeClientHello:
return "ClientHello"
case typeServerHello:
return "ServerHello"
case typeHelloVerifyRequest:
return "HelloVerifyRequest"
case typeNewSessionTicket:
return "NewSessionTicket"
case typeEndOfEarlyData:
return "EndOfEarlyData"
case typeEncryptedExtensions:
return "EncryptedExtensions"
case typeCertificate:
return "Certificate"
case typeServerKeyExchange:
return "ServerKeyExchange"
case typeCertificateRequest:
return "CertificateRequest"
case typeServerHelloDone:
return "ServerHelloDone"
case typeCertificateVerify:
return "CertificateVerify"
case typeClientKeyExchange:
return "ClientKeyExchange"
case typeFinished:
return "Finished"
case typeCertificateStatus:
return "CertificateStatus"
case typeKeyUpdate:
return "KeyUpdate"
case typeCompressedCertificate:
return "CompressedCertificate"
case typeNextProtocol:
return "NextProtocol"
case typeChannelID:
return "ChannelID"
case typeMessageHash:
return "MessageHash"
}
return fmt.Sprintf("unknown(%d)", typ)
}
// TLS compression types.
const (
compressionNone uint8 = 0
+4 -2
View File
@@ -1447,8 +1447,9 @@ func (c *Conn) readHandshake() (any, error) {
return nil, err
}
typ := data[0]
var m handshakeMessage
switch data[0] {
switch typ {
case typeHelloRequest:
m = new(helloRequestMsg)
case typeClientHello:
@@ -1523,7 +1524,8 @@ func (c *Conn) readHandshake() (any, error) {
}
if !m.unmarshal(data) {
return nil, c.in.setErrorLocked(c.sendAlert(alertDecodeError))
c.sendAlert(alertDecodeError)
return nil, c.in.setErrorLocked(fmt.Errorf("tls: error decoding %s message", messageTypeToString(typ)))
}
return m, nil
}