Source file
src/crypto/tls/defaults_fips140.go
1
2
3
4
5
6
7 package tls
8
9 import (
10 "crypto/ecdsa"
11 "crypto/ed25519"
12 "crypto/elliptic"
13 "crypto/internal/boring"
14 "crypto/mldsa"
15 "crypto/rsa"
16 "crypto/x509"
17 )
18
19
20
21
22
23
24
25
26
27
28
29
30 var (
31 allowedSupportedVersionsFIPS = []uint16{
32 VersionTLS12,
33 VersionTLS13,
34 }
35 allowedCurvePreferencesFIPS = []CurveID{
36 X25519MLKEM768,
37 SecP256r1MLKEM768,
38 SecP384r1MLKEM1024,
39 MLKEM1024,
40 CurveP256,
41 CurveP384,
42 CurveP521,
43 }
44 allowedSignatureAlgorithmsFIPS = []SignatureScheme{
45 PSSWithSHA256,
46 ECDSAWithP256AndSHA256,
47 Ed25519,
48 MLDSA44,
49 MLDSA65,
50 MLDSA87,
51 PSSWithSHA384,
52 PSSWithSHA512,
53 PKCS1WithSHA256,
54 PKCS1WithSHA384,
55 PKCS1WithSHA512,
56 ECDSAWithP384AndSHA384,
57 ECDSAWithP521AndSHA512,
58 }
59 allowedCipherSuitesFIPS = []uint16{
60 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
61 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
62 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
63 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
64 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
65 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
66 }
67 allowedCipherSuitesTLS13FIPS = []uint16{
68 TLS_AES_128_GCM_SHA256,
69 TLS_AES_256_GCM_SHA384,
70 }
71 )
72
73 func isCertificateAllowedFIPS(c *x509.Certificate) bool {
74 switch k := c.PublicKey.(type) {
75 case *rsa.PublicKey:
76 return k.N.BitLen() >= 2048
77 case *ecdsa.PublicKey:
78 return k.Curve == elliptic.P256() || k.Curve == elliptic.P384() || k.Curve == elliptic.P521()
79 case ed25519.PublicKey:
80 return true
81 case *mldsa.PublicKey:
82
83 return !boring.Enabled
84 default:
85 return false
86 }
87 }
88
View as plain text