forked from jshiffer/go-xmpp
Simplify tls-server-end-point channel binding code.
This commit is contained in:
parent
b49bdce100
commit
705f68d1a5
12
xmpp.go
12
xmpp.go
@ -466,20 +466,14 @@ func (c *Client) init(o *Options) error {
|
|||||||
case x509.SHA1WithRSA, x509.SHA256WithRSA, x509.ECDSAWithSHA1,
|
case x509.SHA1WithRSA, x509.SHA256WithRSA, x509.ECDSAWithSHA1,
|
||||||
x509.ECDSAWithSHA256, x509.SHA256WithRSAPSS:
|
x509.ECDSAWithSHA256, x509.SHA256WithRSAPSS:
|
||||||
h := sha256.New()
|
h := sha256.New()
|
||||||
h.Write(tlsState.PeerCertificates[0].Raw)
|
|
||||||
keyingMaterial = h.Sum(nil)
|
|
||||||
h.Reset()
|
|
||||||
case x509.SHA384WithRSA, x509.ECDSAWithSHA384, x509.SHA384WithRSAPSS:
|
case x509.SHA384WithRSA, x509.ECDSAWithSHA384, x509.SHA384WithRSAPSS:
|
||||||
h := sha512.New384()
|
h := sha512.New384()
|
||||||
h.Write(tlsState.PeerCertificates[0].Raw)
|
|
||||||
keyingMaterial = h.Sum(nil)
|
|
||||||
h.Reset()
|
|
||||||
case x509.SHA512WithRSA, x509.ECDSAWithSHA512, x509.SHA512WithRSAPSS:
|
case x509.SHA512WithRSA, x509.ECDSAWithSHA512, x509.SHA512WithRSAPSS:
|
||||||
h := sha512.New()
|
h := sha512.New()
|
||||||
h.Write(tlsState.PeerCertificates[0].Raw)
|
|
||||||
keyingMaterial = h.Sum(nil)
|
|
||||||
h.Reset()
|
|
||||||
}
|
}
|
||||||
|
h.Write(tlsState.PeerCertificates[0].Raw)
|
||||||
|
keyingMaterial = h.Sum(nil)
|
||||||
|
h.Reset()
|
||||||
}
|
}
|
||||||
if len(keyingMaterial) == 0 {
|
if len(keyingMaterial) == 0 {
|
||||||
return errors.New(mechanism + ": no keying material")
|
return errors.New(mechanism + ": no keying material")
|
||||||
|
Loading…
Reference in New Issue
Block a user