Source file
src/crypto/tls/defaults.go
1
2
3
4
5 package tls
6
7 import (
8 "internal/godebug"
9 "slices"
10 _ "unsafe"
11 )
12
13
14
15
16 var tlskyber = godebug.New("tlskyber")
17
18 func defaultCurvePreferences() []CurveID {
19 if tlskyber.Value() == "0" {
20 return []CurveID{X25519, CurveP256, CurveP384, CurveP521}
21 }
22
23 return []CurveID{x25519Kyber768Draft00, X25519, CurveP256, CurveP384, CurveP521}
24 }
25
26
27
28
29
30 var defaultSupportedSignatureAlgorithms = []SignatureScheme{
31 PSSWithSHA256,
32 ECDSAWithP256AndSHA256,
33 Ed25519,
34 PSSWithSHA384,
35 PSSWithSHA512,
36 PKCS1WithSHA256,
37 PKCS1WithSHA384,
38 PKCS1WithSHA512,
39 ECDSAWithP384AndSHA384,
40 ECDSAWithP521AndSHA512,
41 PKCS1WithSHA1,
42 ECDSAWithSHA1,
43 }
44
45 var tlsrsakex = godebug.New("tlsrsakex")
46 var tls3des = godebug.New("tls3des")
47
48 func defaultCipherSuites() []uint16 {
49 suites := slices.Clone(cipherSuitesPreferenceOrder)
50 return slices.DeleteFunc(suites, func(c uint16) bool {
51 return disabledCipherSuites[c] ||
52 tlsrsakex.Value() != "1" && rsaKexCiphers[c] ||
53 tls3des.Value() != "1" && tdesCiphers[c]
54 })
55 }
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 var defaultCipherSuitesTLS13 = []uint16{
72 TLS_AES_128_GCM_SHA256,
73 TLS_AES_256_GCM_SHA384,
74 TLS_CHACHA20_POLY1305_SHA256,
75 }
76
77
78
79
80
81
82
83
84
85
86
87 var defaultCipherSuitesTLS13NoAES = []uint16{
88 TLS_CHACHA20_POLY1305_SHA256,
89 TLS_AES_128_GCM_SHA256,
90 TLS_AES_256_GCM_SHA384,
91 }
92
93
94
95 var defaultSupportedVersionsFIPS = []uint16{
96 VersionTLS12,
97 VersionTLS13,
98 }
99
100
101
102 var defaultCurvePreferencesFIPS = []CurveID{CurveP256, CurveP384}
103
104
105
106 var defaultSupportedSignatureAlgorithmsFIPS = []SignatureScheme{
107 PSSWithSHA256,
108 PSSWithSHA384,
109 PSSWithSHA512,
110 PKCS1WithSHA256,
111 ECDSAWithP256AndSHA256,
112 PKCS1WithSHA384,
113 ECDSAWithP384AndSHA384,
114 PKCS1WithSHA512,
115 }
116
117
118 var defaultCipherSuitesFIPS = []uint16{
119 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
120 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
121 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
122 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
123 }
124
125
126 var defaultCipherSuitesTLS13FIPS = []uint16{
127 TLS_AES_128_GCM_SHA256,
128 TLS_AES_256_GCM_SHA384,
129 }
130
View as plain text