MCPcopy
hub / github.com/XTLS/REALITY / checkForResumption

Method checkForResumption

handshake_server_tls13.go:425–563  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

423}
424
425func (hs *serverHandshakeStateTLS13) checkForResumption() error {
426 c := hs.c
427
428 if c.config.SessionTicketsDisabled {
429 return nil
430 }
431
432 modeOK := false
433 for _, mode := range hs.clientHello.pskModes {
434 if mode == pskModeDHE {
435 modeOK = true
436 break
437 }
438 }
439 if !modeOK {
440 return nil
441 }
442
443 if len(hs.clientHello.pskIdentities) != len(hs.clientHello.pskBinders) {
444 c.sendAlert(alertIllegalParameter)
445 return errors.New("tls: invalid or missing PSK binders")
446 }
447 if len(hs.clientHello.pskIdentities) == 0 {
448 return nil
449 }
450
451 for i, identity := range hs.clientHello.pskIdentities {
452 if i >= maxClientPSKIdentities {
453 break
454 }
455
456 var sessionState *SessionState
457 if c.config.UnwrapSession != nil {
458 var err error
459 sessionState, err = c.config.UnwrapSession(identity.label, c.connectionStateLocked())
460 if err != nil {
461 return err
462 }
463 if sessionState == nil {
464 continue
465 }
466 } else {
467 plaintext := c.config.decryptTicket(identity.label, c.ticketKeys)
468 if plaintext == nil {
469 continue
470 }
471 var err error
472 sessionState, err = ParseSessionState(plaintext)
473 if err != nil {
474 continue
475 }
476 }
477
478 if sessionState.version != VersionTLS13 {
479 continue
480 }
481
482 createdAt := time.Unix(int64(sessionState.createdAt), 0)

Callers

nothing calls this directly

Calls 15

NewEarlySecretFunction · 0.92
ParseSessionStateFunction · 0.85
cipherSuiteTLS13ByIDFunction · 0.85
requiresClientCertFunction · 0.85
cloneHashFunction · 0.85
transcriptMsgFunction · 0.85
sendAlertMethod · 0.80
connectionStateLockedMethod · 0.80
decryptTicketMethod · 0.80
timeMethod · 0.80
quicResumeSessionMethod · 0.80
ResumptionBinderKeyMethod · 0.80

Tested by

no test coverage detected