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