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

Function isAESGCMPreferred

cipher_suites.go:390–403  ·  view source on GitHub ↗

isAESGCMPreferred returns whether we have hardware support for AES-GCM, and the first known cipher in the peer's preference list is an AES-GCM cipher, implying the peer also has hardware support for it.

(ciphers []uint16)

Source from the content-addressed store, hash-verified

388// first known cipher in the peer's preference list is an AES-GCM cipher,
389// implying the peer also has hardware support for it.
390func isAESGCMPreferred(ciphers []uint16) bool {
391 if !hasAESGCMHardwareSupport {
392 return false
393 }
394 for _, cID := range ciphers {
395 if c := cipherSuiteByID(cID); c != nil {
396 return aesgcmCiphers[cID]
397 }
398 if c := cipherSuiteTLS13ByID(cID); c != nil {
399 return aesgcmCiphers[cID]
400 }
401 }
402 return false
403}
404
405func cipherRC4(key, iv []byte, isRead bool) any {
406 cipher, _ := rc4.NewCipher(key)

Callers 2

processClientHelloMethod · 0.85
pickCipherSuiteMethod · 0.85

Calls 2

cipherSuiteByIDFunction · 0.85
cipherSuiteTLS13ByIDFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…