$61 GRAYBYTE WORDPRESS FILE MANAGER $88

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/golang/src/crypto/tls/

HOME
Current File : /usr/lib/golang/src/crypto/tls//defaults.go
// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package tls

import (
	"internal/godebug"
	"slices"
	_ "unsafe" // for linkname
)

// Defaults are collected in this file to allow distributions to more easily patch
// them to apply local policies.

var tlsmlkem = godebug.New("tlsmlkem")

// defaultCurvePreferences is the default set of supported key exchanges, as
// well as the preference order.
func defaultCurvePreferences() []CurveID {
	if tlsmlkem.Value() == "0" {
		return []CurveID{X25519, CurveP256, CurveP384, CurveP521}
	}
	return []CurveID{X25519MLKEM768, X25519, CurveP256, CurveP384, CurveP521}
}

// defaultSupportedSignatureAlgorithms returns the signature and hash algorithms that
// the code advertises and supports in a TLS 1.2+ ClientHello and in a TLS 1.2+
// CertificateRequest. The two fields are merged to match with TLS 1.3.
// Note that in TLS 1.2, the ECDSA algorithms are not constrained to P-256, etc.
func defaultSupportedSignatureAlgorithms() []SignatureScheme {
	return []SignatureScheme{
		PSSWithSHA256,
		ECDSAWithP256AndSHA256,
		Ed25519,
		PSSWithSHA384,
		PSSWithSHA512,
		PKCS1WithSHA256,
		PKCS1WithSHA384,
		PKCS1WithSHA512,
		ECDSAWithP384AndSHA384,
		ECDSAWithP521AndSHA512,
		PKCS1WithSHA1,
		ECDSAWithSHA1,
	}
}

var tlsrsakex = godebug.New("tlsrsakex")
var tls3des = godebug.New("tls3des")

func supportedCipherSuites(aesGCMPreferred bool) []uint16 {
	if aesGCMPreferred {
		return slices.Clone(cipherSuitesPreferenceOrder)
	} else {
		return slices.Clone(cipherSuitesPreferenceOrderNoAES)
	}
}

func defaultCipherSuites(aesGCMPreferred bool) []uint16 {
	cipherSuites := supportedCipherSuites(aesGCMPreferred)
	return slices.DeleteFunc(cipherSuites, func(c uint16) bool {
		return disabledCipherSuites[c] ||
			tlsrsakex.Value() != "1" && rsaKexCiphers[c] ||
			tls3des.Value() != "1" && tdesCiphers[c]
	})
}

// defaultCipherSuitesTLS13 is also the preference order, since there are no
// disabled by default TLS 1.3 cipher suites. The same AES vs ChaCha20 logic as
// cipherSuitesPreferenceOrder applies.
//
// defaultCipherSuitesTLS13 should be an internal detail,
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
//   - github.com/quic-go/quic-go
//   - github.com/sagernet/quic-go
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
//
//go:linkname defaultCipherSuitesTLS13
var defaultCipherSuitesTLS13 = []uint16{
	TLS_AES_128_GCM_SHA256,
	TLS_AES_256_GCM_SHA384,
	TLS_CHACHA20_POLY1305_SHA256,
}

// defaultCipherSuitesTLS13NoAES should be an internal detail,
// but widely used packages access it using linkname.
// Notable members of the hall of shame include:
//   - github.com/quic-go/quic-go
//   - github.com/sagernet/quic-go
//
// Do not remove or change the type signature.
// See go.dev/issue/67401.
//
//go:linkname defaultCipherSuitesTLS13NoAES
var defaultCipherSuitesTLS13NoAES = []uint16{
	TLS_CHACHA20_POLY1305_SHA256,
	TLS_AES_128_GCM_SHA256,
	TLS_AES_256_GCM_SHA384,
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.30 PM
root / root
0755
fipsonly
--
16 Dec 2025 9.30 PM
root / root
0755
internal
--
4 Dec 2025 6.06 PM
root / root
0755
alert.go
4.295 KB
4 Dec 2025 6.06 PM
root / root
0644
auth.go
9.687 KB
4 Dec 2025 6.06 PM
root / root
0644
bogo_config.json
17.998 KB
4 Dec 2025 6.06 PM
root / root
0644
cache.go
1.258 KB
4 Dec 2025 6.06 PM
root / root
0644
cipher_suites.go
25.916 KB
4 Dec 2025 6.06 PM
root / root
0644
common.go
65.561 KB
4 Dec 2025 6.06 PM
root / root
0644
common_string.go
3.375 KB
4 Dec 2025 6.06 PM
root / root
0644
conn.go
52.15 KB
4 Dec 2025 6.06 PM
root / root
0644
defaults.go
3.057 KB
4 Dec 2025 6.06 PM
root / root
0644
defaults_boring.go
1.729 KB
4 Dec 2025 6.06 PM
root / root
0644
defaults_fips140.go
2.329 KB
4 Dec 2025 6.06 PM
root / root
0644
ech.go
18.911 KB
4 Dec 2025 6.06 PM
root / root
0644
generate_cert.go
4.831 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_client.go
40.648 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_client_tls13.go
28.283 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_messages.go
52.43 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_server.go
30.376 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_server_tls13.go
35.632 KB
4 Dec 2025 6.06 PM
root / root
0644
key_agreement.go
12.354 KB
4 Dec 2025 6.06 PM
root / root
0644
key_schedule.go
3.458 KB
4 Dec 2025 6.06 PM
root / root
0644
prf.go
9.143 KB
4 Dec 2025 6.06 PM
root / root
0644
quic.go
15.06 KB
4 Dec 2025 6.06 PM
root / root
0644
ticket.go
12.627 KB
4 Dec 2025 6.06 PM
root / root
0644
tls.go
12.796 KB
4 Dec 2025 6.06 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF