(config *Config)
| 280 | ) |
| 281 | |
| 282 | func validateConfig(config *Config) error { //nolint:cyclop |
| 283 | switch { |
| 284 | case config == nil: |
| 285 | return errNoConfigProvided |
| 286 | case config.PSKIdentityHint != nil && config.PSK == nil: |
| 287 | return errIdentityNoPSK |
| 288 | } |
| 289 | |
| 290 | for _, cert := range config.Certificates { |
| 291 | if cert.Certificate == nil { |
| 292 | return errInvalidCertificate |
| 293 | } |
| 294 | if cert.PrivateKey != nil { |
| 295 | signer, ok := cert.PrivateKey.(crypto.Signer) |
| 296 | if !ok { |
| 297 | return errInvalidPrivateKey |
| 298 | } |
| 299 | switch signer.Public().(type) { |
| 300 | case ed25519.PublicKey: |
| 301 | case *ecdsa.PublicKey: |
| 302 | case *rsa.PublicKey: |
| 303 | default: |
| 304 | return errInvalidPrivateKey |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | _, err := parseCipherSuites( |
| 310 | config.CipherSuites, config.CustomCipherSuites, config.includeCertificateSuites(), config.PSK != nil, |
| 311 | ) |
| 312 | |
| 313 | return err |
| 314 | } |
searching dependent graphs…