Source file
src/crypto/tls/defaults_boring.go
1
2
3
4
5
6
7 package tls
8
9 import (
10 "crypto/ecdsa"
11 "crypto/elliptic"
12 "crypto/rsa"
13 "crypto/x509"
14 )
15
16
17
18
19
20
21
22
23
24 var (
25 allowedSupportedVersionsFIPS = []uint16{
26 VersionTLS12,
27 VersionTLS13,
28 }
29 allowedCurvePreferencesFIPS = []CurveID{
30 CurveP256,
31 CurveP384,
32 CurveP521,
33 }
34 allowedSupportedSignatureAlgorithmsFIPS = []SignatureScheme{
35 PSSWithSHA256,
36 PSSWithSHA384,
37 PSSWithSHA512,
38 PKCS1WithSHA256,
39 ECDSAWithP256AndSHA256,
40 PKCS1WithSHA384,
41 ECDSAWithP384AndSHA384,
42 PKCS1WithSHA512,
43 ECDSAWithP521AndSHA512,
44 }
45 allowedCipherSuitesFIPS = []uint16{
46 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
47 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
48 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
49 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
50 }
51 allowedCipherSuitesTLS13FIPS = []uint16{
52 TLS_AES_128_GCM_SHA256,
53 TLS_AES_256_GCM_SHA384,
54 }
55 )
56
57 func isCertificateAllowedFIPS(c *x509.Certificate) bool {
58
59
60 switch k := c.PublicKey.(type) {
61 case *rsa.PublicKey:
62 size := k.N.BitLen()
63 return size == 2048 || size == 3072 || size == 4096
64 case *ecdsa.PublicKey:
65 return k.Curve == elliptic.P256() || k.Curve == elliptic.P384() || k.Curve == elliptic.P521()
66 }
67
68 return false
69 }
70
View as plain text