MCPcopy Create free account
hub / github.com/XTLS/Go / illegalClientHelloChange

Function illegalClientHelloChange

handshake_server_tls13.go:459–512  ·  view source on GitHub ↗

illegalClientHelloChange reports whether the two ClientHello messages are different, with the exception of the changes allowed before and after a HelloRetryRequest. See RFC 8446, Section 4.1.2.

(ch, ch1 *clientHelloMsg)

Source from the content-addressed store, hash-verified

457// different, with the exception of the changes allowed before and after a
458// HelloRetryRequest. See RFC 8446, Section 4.1.2.
459func illegalClientHelloChange(ch, ch1 *clientHelloMsg) bool {
460 if len(ch.supportedVersions) != len(ch1.supportedVersions) ||
461 len(ch.cipherSuites) != len(ch1.cipherSuites) ||
462 len(ch.supportedCurves) != len(ch1.supportedCurves) ||
463 len(ch.supportedSignatureAlgorithms) != len(ch1.supportedSignatureAlgorithms) ||
464 len(ch.supportedSignatureAlgorithmsCert) != len(ch1.supportedSignatureAlgorithmsCert) ||
465 len(ch.alpnProtocols) != len(ch1.alpnProtocols) {
466 return true
467 }
468 for i := range ch.supportedVersions {
469 if ch.supportedVersions[i] != ch1.supportedVersions[i] {
470 return true
471 }
472 }
473 for i := range ch.cipherSuites {
474 if ch.cipherSuites[i] != ch1.cipherSuites[i] {
475 return true
476 }
477 }
478 for i := range ch.supportedCurves {
479 if ch.supportedCurves[i] != ch1.supportedCurves[i] {
480 return true
481 }
482 }
483 for i := range ch.supportedSignatureAlgorithms {
484 if ch.supportedSignatureAlgorithms[i] != ch1.supportedSignatureAlgorithms[i] {
485 return true
486 }
487 }
488 for i := range ch.supportedSignatureAlgorithmsCert {
489 if ch.supportedSignatureAlgorithmsCert[i] != ch1.supportedSignatureAlgorithmsCert[i] {
490 return true
491 }
492 }
493 for i := range ch.alpnProtocols {
494 if ch.alpnProtocols[i] != ch1.alpnProtocols[i] {
495 return true
496 }
497 }
498 return ch.vers != ch1.vers ||
499 !bytes.Equal(ch.random, ch1.random) ||
500 !bytes.Equal(ch.sessionId, ch1.sessionId) ||
501 !bytes.Equal(ch.compressionMethods, ch1.compressionMethods) ||
502 ch.serverName != ch1.serverName ||
503 ch.ocspStapling != ch1.ocspStapling ||
504 !bytes.Equal(ch.supportedPoints, ch1.supportedPoints) ||
505 ch.ticketSupported != ch1.ticketSupported ||
506 !bytes.Equal(ch.sessionTicket, ch1.sessionTicket) ||
507 ch.secureRenegotiationSupported != ch1.secureRenegotiationSupported ||
508 !bytes.Equal(ch.secureRenegotiation, ch1.secureRenegotiation) ||
509 ch.scts != ch1.scts ||
510 !bytes.Equal(ch.cookie, ch1.cookie) ||
511 !bytes.Equal(ch.pskModes, ch1.pskModes)
512}
513
514func (hs *serverHandshakeStateTLS13) sendServerParameters() error {
515 c := hs.c

Callers 1

doHelloRetryRequestMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…