]> Sergey Matveev's repositories - godlighty.git/blob - tls_gost.go
GOST is only for TLS 1.3
[godlighty.git] / tls_gost.go
1 //go:build !nogostls13
2
3 package godlighty
4
5 import "crypto/tls"
6
7 func CHIHasGOST(chi *tls.ClientHelloInfo) bool {
8         tls13Found := false
9         for _, v := range chi.SupportedVersions {
10                 if v == tls.VersionTLS13 {
11                         tls13Found = true
12                         break
13                 }
14         }
15         if !tls13Found {
16                 return false
17         }
18         for _, ss := range chi.SignatureSchemes {
19                 switch ss {
20                 case tls.GOSTR34102012256A, tls.GOSTR34102012256B, tls.GOSTR34102012256C, tls.GOSTR34102012256D, tls.GOSTR34102012512A, tls.GOSTR34102012512B, tls.GOSTR34102012512C:
21                         return true
22                 }
23         }
24         return false
25 }