8000 0803 by SparrowLii · Pull Request #6 · MabinGo/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

0803 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/crypto/tls/handshake_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ func (c *Conn) makeClientHello() (*clientHelloMsg, ecdheParameters, error) {
hello.cipherSuites = append(hello.cipherSuites, defaultCipherSuitesTLS13()...)

curveID := config.curvePreferences()[0]
if _, ok := curveForCurveID(curveID); curveID != X25519 && !ok {
return nil, nil, errors.New("tls: CurvePreferences includes unsupported curve")
}
params, err = generateECDHEParameters(config.rand(), curveID)
if err != nil {
return nil, nil, err
Expand Down
28 changes: 15 additions & 13 deletions src/crypto/tls/handshake_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,26 +357,26 @@ func (hs *serverHandshakeState) checkForResumption() bool {
if plaintext == nil {
return false
}
hs.sessionState = &sessionState{usedOldKey: usedOldKey}
ok := hs.sessionState.unmarshal(plaintext)
clientSessionState := &sessionState{usedOldKey: usedOldKey}
ok := clientSessionState.unmarshal(plaintext)
if !ok {
return false
}

createdAt := time.Unix(int64(hs.sessionState.createdAt), 0)
createdAt := time.Unix(int64(clientSessionState.createdAt), 0)
if c.config.time().Sub(createdAt) > maxSessionTicketLifetime {
return false
}

// Never resume a session for a different TLS version.
if c.vers != hs.sessionState.vers {
if c.vers != clientSessionState.vers {
return false
}

cipherSuiteOk := false
// Check that the client is still offering the ciphersuite in the session.
for _, id := range hs.clientHello.cipherSuites {
if id == hs.sessionState.cipherSuite {
if id == clientSessionState.cipherSuite {
cipherSuiteOk = true
break
}
Expand All @@ -385,14 +385,7 @@ func (hs *serverHandshakeState) checkForResumption() bool {
return false
}

// Check that we also support the ciphersuite from the session.
hs.suite = selectCipherSuite([]uint16{hs.sessionState.cipherSuite},
c.config.cipherSuites(), hs.cipherSuiteOk)
if hs.suite == nil {
return false
}

sessionHasClientCerts := len(hs.sessionState.certificates) != 0
sessionHasClientCerts := len(clientSessionState.certificates) != 0
needClientCerts := requiresClientCert(c.config.ClientAuth)
if needClientCerts && !sessionHasClientCerts {
return false
Expand All @@ -401,6 +394,15 @@ func (hs *serverHandshakeState) checkForResumption() bool {
return false
}

// Check that we also support the ciphersuite from the session.
hs.suite = selectCipherSuite([]uint16{clientSessionState.cipherSuite},
c.config.cipherSuites(), hs.cipherSuiteOk)
if hs.suite == nil {
return false
}

hs.sessionState = clientSessionState

return true
}

Expand Down
0