mirror of
https://github.com/refraction-networking/utls.git
synced 2025-04-04 04:27:36 +03:00
Fix Client Certificate Verification when Using Extended Master Secret
This commit is contained in:
parent
1b3a9ad4c5
commit
0bf125eab6
2 changed files with 5 additions and 3 deletions
|
@ -600,6 +600,9 @@ func (hs *clientHandshakeState) doFullHandshake() error {
|
|||
}
|
||||
}
|
||||
|
||||
/* sessionHash does not include CertificateVerify */
|
||||
sessionHash := hs.finishedHash.Sum()
|
||||
|
||||
if chainToSend != nil && len(chainToSend.Certificate) > 0 {
|
||||
certVerify := &certificateVerifyMsg{}
|
||||
|
||||
|
@ -649,7 +652,7 @@ func (hs *clientHandshakeState) doFullHandshake() error {
|
|||
}
|
||||
|
||||
if hs.hello.ems && hs.serverHello.ems {
|
||||
hs.masterSecret = extendedMasterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, hs.finishedHash)
|
||||
hs.masterSecret = extendedMasterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, sessionHash)
|
||||
} else {
|
||||
hs.masterSecret = masterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, hs.hello.random, hs.serverHello.random)
|
||||
}
|
||||
|
|
|
@ -530,8 +530,7 @@ var extendedMasterSecretLabel = []byte("extended master secret")
|
|||
|
||||
// extendedMasterFromPreMasterSecret generates the master secret from the pre-master
|
||||
// secret and session hash. See https://tools.ietf.org/html/rfc7627#section-4
|
||||
func extendedMasterFromPreMasterSecret(version uint16, suite *cipherSuite, preMasterSecret []byte, fh finishedHash) []byte {
|
||||
sessionHash := fh.Sum()
|
||||
func extendedMasterFromPreMasterSecret(version uint16, suite *cipherSuite, preMasterSecret []byte, sessionHash []byte) []byte {
|
||||
masterSecret := make([]byte, masterSecretLength)
|
||||
prfForVersion(version, suite)(masterSecret, preMasterSecret, extendedMasterSecretLabel, sessionHash)
|
||||
return masterSecret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue