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

Function selectCipherSuite

cipher_suites.go:175–189  ·  view source on GitHub ↗

selectCipherSuite returns the first TLS 1.0–1.2 cipher suite from ids which is also in supportedIDs and passes the ok filter.

(ids, supportedIDs []uint16, ok func(*cipherSuite) bool)

Source from the content-addressed store, hash-verified

173// selectCipherSuite returns the first TLS 1.0–1.2 cipher suite from ids which
174// is also in supportedIDs and passes the ok filter.
175func selectCipherSuite(ids, supportedIDs []uint16, ok func(*cipherSuite) bool) *cipherSuite {
176 for _, id := range ids {
177 candidate := cipherSuiteByID(id)
178 if candidate == nil || !ok(candidate) {
179 continue
180 }
181
182 for _, suppID := range supportedIDs {
183 if id == suppID {
184 return candidate
185 }
186 }
187 }
188 return nil
189}
190
191// A cipherSuiteTLS13 defines only the pair of the AEAD algorithm and hash
192// algorithm to be used with HKDF. See RFC 8446, Appendix B.4.

Callers 3

SupportsCertificateMethod · 0.85
pickCipherSuiteMethod · 0.85
checkForResumptionMethod · 0.85

Calls 1

cipherSuiteByIDFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…